[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef __ROUTING_RTM_H__
|
---|
| 7 | #define __ROUTING_RTM_H__
|
---|
| 8 |
|
---|
| 9 | #ifdef __cplusplus
|
---|
| 10 | extern "C" {
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #define RTM_PROTOCOL_FAMILY_IPX 0
|
---|
| 14 | #define RTM_PROTOCOL_FAMILY_IP 1
|
---|
| 15 |
|
---|
| 16 | #define ERROR_MORE_MESSAGES ERROR_MORE_DATA
|
---|
| 17 | #define ERROR_CLIENT_ALREADY_EXISTS ERROR_ALREADY_EXISTS
|
---|
| 18 | #define ERROR_NO_MESSAGES ERROR_NO_MORE_ITEMS
|
---|
| 19 |
|
---|
| 20 | #define ERROR_NO_MORE_ROUTES ERROR_NO_MORE_ITEMS
|
---|
| 21 | #define ERROR_NO_ROUTES ERROR_NO_MORE_ITEMS
|
---|
| 22 | #define ERROR_NO_SUCH_ROUTE ERROR_NO_MORE_ITEMS
|
---|
| 23 |
|
---|
| 24 | typedef struct _IPX_NETWORK {
|
---|
| 25 | DWORD N_NetNumber;
|
---|
| 26 | } IPX_NETWORK,*PIPX_NETWORK;
|
---|
| 27 |
|
---|
| 28 | typedef struct _IP_NETWORK {
|
---|
| 29 | DWORD N_NetNumber;
|
---|
| 30 | DWORD N_NetMask;
|
---|
| 31 | } IP_NETWORK,*PIP_NETWORK;
|
---|
| 32 |
|
---|
| 33 | typedef struct _IPX_NEXT_HOP_ADDRESS {
|
---|
| 34 | BYTE NHA_Mac[6];
|
---|
| 35 | } IPX_NEXT_HOP_ADDRESS,*PIPX_NEXT_HOP_ADDRESS;
|
---|
| 36 |
|
---|
| 37 | typedef IP_NETWORK IP_NEXT_HOP_ADDRESS,*PIP_NEXT_HOP_ADDRESS;
|
---|
| 38 |
|
---|
| 39 | typedef struct _IPX_SPECIFIC_DATA {
|
---|
| 40 | DWORD FSD_Flags;
|
---|
| 41 | USHORT FSD_TickCount;
|
---|
| 42 | USHORT FSD_HopCount;
|
---|
| 43 | } IPX_SPECIFIC_DATA,*PIPX_SPECIFIC_DATA;
|
---|
| 44 |
|
---|
| 45 | #define IPX_GLOBAL_CLIENT_WAN_ROUTE 0x00000001
|
---|
| 46 |
|
---|
| 47 | typedef struct _IP_SPECIFIC_DATA {
|
---|
| 48 | DWORD FSD_Type;
|
---|
| 49 | DWORD FSD_Policy;
|
---|
| 50 | DWORD FSD_NextHopAS;
|
---|
| 51 | DWORD FSD_Priority;
|
---|
| 52 | DWORD FSD_Metric;
|
---|
| 53 | DWORD FSD_Metric1;
|
---|
| 54 | DWORD FSD_Metric2;
|
---|
| 55 | DWORD FSD_Metric3;
|
---|
| 56 | DWORD FSD_Metric4;
|
---|
| 57 | DWORD FSD_Metric5;
|
---|
| 58 | DWORD FSD_Flags;
|
---|
| 59 | } IP_SPECIFIC_DATA,*PIP_SPECIFIC_DATA;
|
---|
| 60 |
|
---|
| 61 | #define IP_VALID_ROUTE 0x00000001
|
---|
| 62 | #define ClearRouteFlags(pRoute) ((pRoute)->RR_FamilySpecificData.FSD_Flags = 0x00000000)
|
---|
| 63 | #define IsRouteValid(pRoute) ((pRoute)->RR_FamilySpecificData.FSD_Flags & IP_VALID_ROUTE)
|
---|
| 64 | #define SetRouteValid(pRoute) ((pRoute)->RR_FamilySpecificData.FSD_Flags |= IP_VALID_ROUTE)
|
---|
| 65 | #define ClearRouteValid(pRoute) ((pRoute)->RR_FamilySpecificData.FSD_Flags &= ~IP_VALID_ROUTE)
|
---|
| 66 | #define IsRouteNonUnicast(pRoute) (((DWORD)((pRoute)->RR_Network.N_NetNumber & 0x000000FF)) >= ((DWORD)0x000000E0))
|
---|
| 67 | #define IsRouteLoopback(pRoute) ((((pRoute)->RR_Network.N_NetNumber & 0x000000FF)==0x0000007F) || ((pRoute)->RR_NextHopAddress.N_NetNumber==0x0100007F))
|
---|
| 68 |
|
---|
| 69 | typedef struct _PROTOCOL_SPECIFIC_DATA {
|
---|
| 70 | DWORD PSD_Data[4];
|
---|
| 71 | } PROTOCOL_SPECIFIC_DATA,*PPROTOCOL_SPECIFIC_DATA;
|
---|
| 72 |
|
---|
| 73 | #define DWORD_ALIGN(type,field) union { type field; DWORD field##Align; }
|
---|
| 74 |
|
---|
| 75 | #define ROUTE_HEADER DWORD_ALIGN (FILETIME,RR_TimeStamp); DWORD RR_RoutingProtocol; DWORD RR_InterfaceID; DWORD_ALIGN (PROTOCOL_SPECIFIC_DATA,RR_ProtocolSpecificData)
|
---|
| 76 |
|
---|
| 77 | typedef struct _RTM_IPX_ROUTE {
|
---|
| 78 | ROUTE_HEADER;
|
---|
| 79 | DWORD_ALIGN (IPX_NETWORK,RR_Network);
|
---|
| 80 | DWORD_ALIGN (IPX_NEXT_HOP_ADDRESS,RR_NextHopAddress);
|
---|
| 81 | DWORD_ALIGN (IPX_SPECIFIC_DATA,RR_FamilySpecificData);
|
---|
| 82 | } RTM_IPX_ROUTE,*PRTM_IPX_ROUTE;
|
---|
| 83 |
|
---|
| 84 | typedef struct _RTM_IP_ROUTE {
|
---|
| 85 | ROUTE_HEADER;
|
---|
| 86 | DWORD_ALIGN (IP_NETWORK,RR_Network);
|
---|
| 87 | DWORD_ALIGN (IP_NEXT_HOP_ADDRESS,RR_NextHopAddress);
|
---|
| 88 | DWORD_ALIGN (IP_SPECIFIC_DATA,RR_FamilySpecificData);
|
---|
| 89 | } RTM_IP_ROUTE,*PRTM_IP_ROUTE;
|
---|
| 90 |
|
---|
| 91 | #define RTM_CURRENT_BEST_ROUTE 0x00000001
|
---|
| 92 | #define RTM_PREVIOUS_BEST_ROUTE 0x00000002
|
---|
| 93 |
|
---|
| 94 | #define RTM_NO_CHANGE 0
|
---|
| 95 | #define RTM_ROUTE_ADDED RTM_CURRENT_BEST_ROUTE
|
---|
| 96 | #define RTM_ROUTE_DELETED RTM_PREVIOUS_BEST_ROUTE
|
---|
| 97 | #define RTM_ROUTE_CHANGED (RTM_CURRENT_BEST_ROUTE|RTM_PREVIOUS_BEST_ROUTE)
|
---|
| 98 |
|
---|
| 99 | #define RTM_ONLY_THIS_NETWORK 0x00000001
|
---|
| 100 | #define RTM_ONLY_THIS_INTERFACE 0x00000002
|
---|
| 101 | #define RTM_ONLY_THIS_PROTOCOL 0x00000004
|
---|
| 102 | #define RTM_ONLY_BEST_ROUTES 0x00000008
|
---|
| 103 |
|
---|
| 104 | #define RTM_PROTOCOL_SINGLE_ROUTE 0x00000001
|
---|
| 105 |
|
---|
| 106 | HANDLE WINAPI RtmRegisterClient(DWORD ProtocolFamily,DWORD RoutingProtocol,HANDLE ChangeEvent,DWORD Flags);
|
---|
| 107 | DWORD WINAPI RtmDeregisterClient(HANDLE ClientHandle);
|
---|
| 108 | DWORD WINAPI RtmDequeueRouteChangeMessage(HANDLE ClientHandle,DWORD *Flags,PVOID CurBestRoute,PVOID PrevBestRoute);
|
---|
| 109 | DWORD WINAPI RtmAddRoute(HANDLE ClientHandle,PVOID Route,DWORD TimeToLive,DWORD *Flags,PVOID CurBestRoute,PVOID PrevBestRoute);
|
---|
| 110 | DWORD WINAPI RtmDeleteRoute(HANDLE ClientHandle,PVOID Route,DWORD *Flags,PVOID CurBestRoute);
|
---|
| 111 | WINBOOL WINAPI RtmIsRoute(DWORD ProtocolFamily,PVOID Network,PVOID BestRoute);
|
---|
| 112 | ULONG WINAPI RtmGetNetworkCount(DWORD ProtocolFamily);
|
---|
| 113 | ULONG WINAPI RtmGetRouteAge(PVOID Route);
|
---|
| 114 | HANDLE WINAPI RtmCreateEnumerationHandle(DWORD ProtocolFamily,DWORD EnumerationFlags,PVOID CriteriaRoute);
|
---|
| 115 | DWORD WINAPI RtmEnumerateGetNextRoute(HANDLE EnumerationHandle,PVOID Route);
|
---|
| 116 | DWORD WINAPI RtmCloseEnumerationHandle(HANDLE EnumerationHandle);
|
---|
| 117 | DWORD WINAPI RtmBlockDeleteRoutes(HANDLE ClientHandle,DWORD EnumerationFlags,PVOID CriteriaRoute);
|
---|
| 118 | DWORD WINAPI RtmGetFirstRoute(DWORD ProtocolFamily,DWORD EnumerationFlags,PVOID Route);
|
---|
| 119 |
|
---|
| 120 | #define RtmGetSpecificRoute(ProtocolFamily,Route) RtmGetFirstRoute(ProtocolFamily,RTM_ONLY_THIS_NETWORK | RTM_ONLY_THIS_PROTOCOL | RTM_ONLY_THIS_INTERFACE,Route)
|
---|
| 121 |
|
---|
| 122 | DWORD WINAPI RtmGetNextRoute(DWORD ProtocolFamily,DWORD EnumerationFlags,PVOID Route);
|
---|
| 123 | WINBOOL WINAPI RtmLookupIPDestination(DWORD dwDestAddr,PRTM_IP_ROUTE prir);
|
---|
| 124 |
|
---|
| 125 | #ifdef __cplusplus
|
---|
| 126 | }
|
---|
| 127 | #endif
|
---|
| 128 | #endif
|
---|