Home | History | Annotate | Download | only in include
      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 _ROUTPROT_H_
      7 #define _ROUTPROT_H_
      8 
      9 #include "stm.h"
     10 
     11 #ifdef __cplusplus
     12 extern "C" {
     13 #endif
     14 
     15 #define RF_ROUTING 0x00000001
     16 #define RF_DEMAND_UPDATE_ROUTES 0x00000004
     17 #define RF_ADD_ALL_INTERFACES 0x00000010
     18 #define RF_MULTICAST 0x00000020
     19 #define RF_POWER 0x00000040
     20 
     21 #if MPR50
     22 #define MS_ROUTER_VERSION 0x00000500
     23 #else
     24 #error Router version not defined
     25 #endif
     26 
     27   typedef enum _ROUTING_PROTOCOL_EVENTS {
     28     ROUTER_STOPPED,SAVE_GLOBAL_CONFIG_INFO,SAVE_INTERFACE_CONFIG_INFO,UPDATE_COMPLETE
     29   } ROUTING_PROTOCOL_EVENTS;
     30 
     31   typedef enum _NET_INTERFACE_TYPE {
     32     PERMANENT,DEMAND_DIAL,LOCAL_WORKSTATION_DIAL,REMOTE_WORKSTATION_DIAL
     33   } NET_INTERFACE_TYPE;
     34 
     35 #define IR_PROMISCUOUS 0
     36 #define IR_PROMISCUOUS_MULTICAST 1
     37 
     38   typedef struct _SUPPORT_FUNCTIONS {
     39     __C89_NAMELESS union {
     40       ULONGLONG _Align8;
     41       __C89_NAMELESS struct {
     42 	DWORD dwVersion;
     43 	DWORD dwReserved;
     44       };
     45     };
     46     DWORD (WINAPI *DemandDialRequest)(DWORD ProtocolId,DWORD InterfaceIndex);
     47     DWORD (WINAPI *SetInterfaceReceiveType)(DWORD ProtocolId,DWORD InterfaceIndex,DWORD InterfaceReceiveType,WINBOOL bActivate);
     48     DWORD (WINAPI *ValidateRoute)(DWORD ProtocolId,PVOID RouteInfo,PVOID DestAddress);
     49     DWORD (WINAPI *MIBEntryCreate)(DWORD dwRoutingPid,DWORD dwEntrySize,LPVOID lpEntry);
     50     DWORD (WINAPI *MIBEntryDelete)(DWORD dwRoutingPid,DWORD dwEntrySize,LPVOID lpEntry);
     51     DWORD (WINAPI *MIBEntrySet)(DWORD dwRoutingPid,DWORD dwEntrySize,LPVOID lpEntry);
     52     DWORD (WINAPI *MIBEntryGet)(DWORD dwRoutingPid,DWORD dwInEntrySize,LPVOID lpInEntry,LPDWORD lpOutEntrySize,LPVOID lpOutEntry);
     53     DWORD (WINAPI *MIBEntryGetFirst)(DWORD dwRoutingPid,DWORD dwInEntrySize,LPVOID lpInEntry,LPDWORD lpOutEntrySize,LPVOID lpOutEntry);
     54     DWORD (WINAPI *MIBEntryGetNext)(DWORD dwRoutingPid,DWORD dwInEntrySize,LPVOID lpInEntry,LPDWORD lpOutEntrySize,LPVOID lpOutEntry);
     55     DWORD (WINAPI *GetRouterId)(VOID);
     56     WINBOOL (WINAPI *HasMulticastBoundary)(DWORD dwIfIndex,DWORD dwGroupAddress);
     57   } SUPPORT_FUNCTIONS,*PSUPPORT_FUNCTIONS;
     58 
     59 #define PROTO_IP_OTHER 1
     60 #define PROTO_IP_LOCAL 2
     61 #define PROTO_IP_NETMGMT 3
     62 #define PROTO_IP_ICMP 4
     63 #define PROTO_IP_EGP 5
     64 #define PROTO_IP_GGP 6
     65 #define PROTO_IP_HELLO 7
     66 #define PROTO_IP_RIP 8
     67 #define PROTO_IP_IS_IS 9
     68 #define PROTO_IP_ES_IS 10
     69 #define PROTO_IP_CISCO 11
     70 #define PROTO_IP_BBN 12
     71 #define PROTO_IP_OSPF 13
     72 #define PROTO_IP_BGP 14
     73 
     74 #define PROTO_IP_MSDP 9
     75 #define PROTO_IP_IGMP 10
     76 #define PROTO_IP_BGMP 11
     77 
     78 #define PROTO_IP_VRRP 112
     79 #define PROTO_IP_BOOTP 9999
     80 #define PROTO_IP_NT_AUTOSTATIC 10002
     81 #define PROTO_IP_DNS_PROXY 10003
     82 #define PROTO_IP_DHCP_ALLOCATOR 10004
     83 #define PROTO_IP_NAT 10005
     84 #define PROTO_IP_NT_STATIC 10006
     85 #define PROTO_IP_NT_STATIC_NON_DOD 10007
     86 #define PROTO_IP_DIFFSERV 10008
     87 #define PROTO_IP_MGM 10009
     88 #define PROTO_IP_ALG 10010
     89 #define PROTO_IP_H323 10011
     90 #define PROTO_IP_FTP 10012
     91 #define PROTO_IP_DTP 10013
     92 
     93 #define PROTOCOL_ID(Type,VendorId,ProtocolId) (((Type & 0x03)<<30)|((VendorId & 0x3FFF)<<16)|(ProtocolId & 0xFFFF))
     94 
     95 #define TYPE_FROM_PROTO_ID(X) (((X) >> 30) & 0x03)
     96 #define VENDOR_FROM_PROTO_ID(X) (((X) >> 16) & 0x3FFF)
     97 #define PROTO_FROM_PROTO_ID(X) ((X) & 0xFFFF)
     98 
     99 #define PROTO_TYPE_UCAST 0
    100 #define PROTO_TYPE_MCAST 1
    101 #define PROTO_TYPE_MS0 2
    102 #define PROTO_TYPE_MS1 3
    103 
    104 #define PROTO_VENDOR_MS0 0x0000
    105 #define PROTO_VENDOR_MS1 0x137
    106 #define PROTO_VENDOR_MS2 0x3FFF
    107 
    108 #define MS_IP_BOOTP PROTOCOL_ID(PROTO_TYPE_UCAST,PROTO_VENDOR_MS0,PROTO_IP_BOOTP)
    109 #define MS_IP_RIP PROTOCOL_ID(PROTO_TYPE_UCAST,PROTO_VENDOR_MS0,PROTO_IP_RIP)
    110 #define MS_IP_OSPF PROTOCOL_ID(PROTO_TYPE_UCAST,PROTO_VENDOR_MS0,PROTO_IP_OSPF)
    111 #define MS_IP_BGP PROTOCOL_ID(PROTO_TYPE_UCAST,PROTO_VENDOR_MS1,PROTO_IP_BGP)
    112 #define MS_IP_IGMP PROTOCOL_ID(PROTO_TYPE_MCAST,PROTO_VENDOR_MS1,PROTO_IP_IGMP)
    113 #define MS_IP_BGMP PROTOCOL_ID(PROTO_TYPE_MCAST,PROTO_VENDOR_MS1,PROTO_IP_BGMP)
    114 #define MS_IP_MSDP PROTOCOL_ID(PROTO_TYPE_MCAST,PROTO_VENDOR_MS1,PROTO_IP_MSDP)
    115 #define MS_IP_DNS_PROXY PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_DNS_PROXY)
    116 #define MS_IP_DHCP_ALLOCATOR PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_DHCP_ALLOCATOR)
    117 #define MS_IP_NAT PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_NAT)
    118 #define MS_IP_DIFFSERV PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_DIFFSERV)
    119 #define MS_IP_MGM PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_MGM)
    120 #define MS_IP_VRRP PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_VRRP)
    121 #define MS_IP_DTP PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_DTP)
    122 #define MS_IP_H323 PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_H323)
    123 #define MS_IP_FTP PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_FTP)
    124 #define MS_IP_ALG PROTOCOL_ID(PROTO_TYPE_MS0,PROTO_VENDOR_MS1,PROTO_IP_ALG)
    125 
    126 #define IPX_PROTOCOL_BASE 0x0001ffff
    127 #define IPX_PROTOCOL_RIP IPX_PROTOCOL_BASE + 1
    128 #define IPX_PROTOCOL_SAP IPX_PROTOCOL_BASE + 2
    129 #define IPX_PROTOCOL_NLSP IPX_PROTOCOL_BASE + 3
    130 
    131   typedef struct _UPDATE_COMPLETE_MESSAGE {
    132     ULONG InterfaceIndex;
    133     ULONG UpdateType;
    134     ULONG UpdateStatus;
    135   } UPDATE_COMPLETE_MESSAGE,*PUPDATE_COMPLETE_MESSAGE;
    136 
    137   typedef union _MESSAGE {
    138     UPDATE_COMPLETE_MESSAGE UpdateCompleteMessage;
    139     DWORD InterfaceIndex;
    140   } MESSAGE,*PMESSAGE;
    141 
    142 #define RIS_INTERFACE_ADDRESS_CHANGE 0
    143 #define RIS_INTERFACE_ENABLED 1
    144 #define RIS_INTERFACE_DISABLED 2
    145 #define RIS_INTERFACE_MEDIA_PRESENT 3
    146 #define RIS_INTERFACE_MEDIA_ABSENT 4
    147 
    148   typedef struct IPX_ADAPTER_BINDING_INFO {
    149     ULONG AdapterIndex;
    150     UCHAR Network[4];
    151     UCHAR LocalNode[6];
    152     UCHAR RemoteNode[6];
    153     ULONG MaxPacketSize;
    154     ULONG LinkSpeed;
    155   } IPX_ADAPTER_BINDING_INFO,*PIPX_ADAPTER_BINDING_INFO;
    156 
    157   typedef struct IP_LOCAL_BINDING {
    158     DWORD Address;
    159     DWORD Mask;
    160   } IP_LOCAL_BINDING,*PIP_LOCAL_BINDING;
    161 
    162   typedef struct IP_ADAPTER_BINDING_INFO {
    163     ULONG AddressCount;
    164     DWORD RemoteAddress;
    165     ULONG Mtu;
    166     ULONGLONG Speed;
    167     IP_LOCAL_BINDING Address[0];
    168   } IP_ADAPTER_BINDING_INFO,*PIP_ADAPTER_BINDING_INFO;
    169 
    170 #define SIZEOF_IP_BINDING(X) (FIELD_OFFSET(IP_ADAPTER_BINDING_INFO,Address[0]) + ((X) *sizeof(IP_LOCAL_BINDING)))
    171 
    172   typedef DWORD (WINAPI *PSTART_PROTOCOL)(HANDLE NotificationEvent,PSUPPORT_FUNCTIONS SupportFunctions,LPVOID GlobalInfo,ULONG StructureVersion,ULONG StructureSize,ULONG StructureCount);
    173   typedef DWORD (WINAPI *PSTART_COMPLETE)(VOID);
    174   typedef DWORD (WINAPI *PSTOP_PROTOCOL)(VOID);
    175   typedef DWORD (WINAPI *PADD_INTERFACE)(LPWSTR InterfaceName,ULONG InterfaceIndex,NET_INTERFACE_TYPE InterfaceType,DWORD MediaType,WORD AccessType,WORD ConnectionType,PVOID InterfaceInfo,ULONG StructureVersion,ULONG StructureSize,ULONG StructureCount);
    176   typedef DWORD (WINAPI *PDELETE_INTERFACE)(ULONG InterfaceIndex);
    177   typedef DWORD (WINAPI *PGET_EVENT_MESSAGE)(ROUTING_PROTOCOL_EVENTS *Event,MESSAGE *Result);
    178   typedef DWORD (WINAPI *PGET_INTERFACE_INFO)(ULONG InterfaceIndex,PVOID InterfaceInfo,PULONG BufferSize,PULONG StructureVersion,PULONG StructureSize,PULONG StructureCount);
    179   typedef DWORD (WINAPI *PSET_INTERFACE_INFO)(ULONG InterfaceIndex,PVOID InterfaceInfo,ULONG StructureVersion,ULONG StructureSize,ULONG StructureCount);
    180   typedef DWORD (WINAPI *PINTERFACE_STATUS)(ULONG InterfaceIndex,WINBOOL InterfaceActive,DWORD StatusType,PVOID StatusInfo);
    181   typedef DWORD (WINAPI *PQUERY_POWER)(DWORD PowerType);
    182   typedef DWORD (WINAPI *PSET_POWER)(DWORD PowerType);
    183   typedef DWORD (WINAPI *PGET_GLOBAL_INFO)(PVOID GlobalInfo,PULONG BufferSize,PULONG StructureVersion,PULONG StructureSize,PULONG StructureCount);
    184   typedef DWORD (WINAPI *PSET_GLOBAL_INFO)(PVOID GlobalInfo,ULONG StructureVersion,ULONG StructureSize,ULONG StructureCount);
    185   typedef DWORD (WINAPI *PDO_UPDATE_ROUTES)(ULONG InterfaceIndex);
    186   typedef DWORD (WINAPI *PMIB_CREATE)(ULONG InputDataSize,PVOID InputData);
    187   typedef DWORD (WINAPI *PMIB_DELETE)(ULONG InputDataSize,PVOID InputData);
    188   typedef DWORD (WINAPI *PMIB_GET)(ULONG InputDataSize,PVOID InputData,PULONG OutputDataSize,PVOID OutputData);
    189   typedef DWORD (WINAPI *PMIB_SET)(ULONG InputDataSize,PVOID InputData);
    190   typedef DWORD (WINAPI *PMIB_GET_FIRST)(ULONG InputDataSize,PVOID InputData,PULONG OutputDataSize,PVOID OutputData);
    191   typedef DWORD (WINAPI *PMIB_GET_NEXT)(ULONG InputDataSize,PVOID InputData,PULONG OutputDataSize,PVOID OutputData);
    192   typedef DWORD (WINAPI *PMIB_SET_TRAP_INFO)(HANDLE Event,ULONG InputDataSize,PVOID InputData,PULONG OutputDataSize,PVOID OutputData);
    193   typedef DWORD (WINAPI *PMIB_GET_TRAP_INFO)(ULONG InputDataSize,PVOID InputData,PULONG OutputDataSize,PVOID OutputData);
    194   typedef DWORD (WINAPI *PCONNECT_CLIENT)(ULONG InterfaceIndex,PVOID ClientAddress);
    195   typedef DWORD (WINAPI *PDISCONNECT_CLIENT)(ULONG InterfaceIndex,PVOID ClientAddress);
    196 
    197 #define MRINFO_TUNNEL_FLAG 0x01
    198 #define MRINFO_PIM_FLAG 0x04
    199 #define MRINFO_DOWN_FLAG 0x10
    200 #define MRINFO_DISABLED_FLAG 0x20
    201 #define MRINFO_QUERIER_FLAG 0x40
    202 #define MRINFO_LEAF_FLAG 0x80
    203 
    204   typedef DWORD (WINAPI *PGET_NEIGHBORS)(DWORD InterfaceIndex,PDWORD NeighborList,PDWORD NeighborListSize,PBYTE InterfaceFlags);
    205 
    206 #define MFE_NO_ERROR 0
    207 #define MFE_REACHED_CORE 1
    208 
    209 #define MFE_OIF_PRUNED 5
    210 
    211 #define MFE_PRUNED_UPSTREAM 4
    212 #define MFE_OLD_ROUTER 11
    213 
    214 #define MFE_NOT_FORWARDING 2
    215 #define MFE_WRONG_IF 3
    216 #define MFE_BOUNDARY_REACHED 6
    217 #define MFE_NO_MULTICAST 7
    218 #define MFE_IIF 8
    219 #define MFE_NO_ROUTE 9
    220 #define MFE_NOT_LAST_HOP 10
    221 #define MFE_PROHIBITED 12
    222 #define MFE_NO_SPACE 13
    223 
    224   typedef DWORD (WINAPI *PGET_MFE_STATUS)(DWORD InterfaceIndex,DWORD GroupAddress,DWORD SourceAddress,PBYTE StatusCode);
    225 
    226   typedef struct _MPR50_ROUTING_CHARACTERISTICS {
    227     DWORD dwVersion;
    228     DWORD dwProtocolId;
    229     DWORD fSupportedFunctionality;
    230     PSTART_PROTOCOL pfnStartProtocol;
    231     PSTART_COMPLETE pfnStartComplete;
    232     PSTOP_PROTOCOL pfnStopProtocol;
    233     PGET_GLOBAL_INFO pfnGetGlobalInfo;
    234     PSET_GLOBAL_INFO pfnSetGlobalInfo;
    235     PQUERY_POWER pfnQueryPower;
    236     PSET_POWER pfnSetPower;
    237     PADD_INTERFACE pfnAddInterface;
    238     PDELETE_INTERFACE pfnDeleteInterface;
    239     PINTERFACE_STATUS pfnInterfaceStatus;
    240     PGET_INTERFACE_INFO pfnGetInterfaceInfo;
    241     PSET_INTERFACE_INFO pfnSetInterfaceInfo;
    242     PGET_EVENT_MESSAGE pfnGetEventMessage;
    243     PDO_UPDATE_ROUTES pfnUpdateRoutes;
    244     PCONNECT_CLIENT pfnConnectClient;
    245     PDISCONNECT_CLIENT pfnDisconnectClient;
    246     PGET_NEIGHBORS pfnGetNeighbors;
    247     PGET_MFE_STATUS pfnGetMfeStatus;
    248     PMIB_CREATE pfnMibCreateEntry;
    249     PMIB_DELETE pfnMibDeleteEntry;
    250     PMIB_GET pfnMibGetEntry;
    251     PMIB_SET pfnMibSetEntry;
    252     PMIB_GET_FIRST pfnMibGetFirstEntry;
    253     PMIB_GET_NEXT pfnMibGetNextEntry;
    254     PMIB_SET_TRAP_INFO pfnMibSetTrapInfo;
    255     PMIB_GET_TRAP_INFO pfnMibGetTrapInfo;
    256   } MPR50_ROUTING_CHARACTERISTICS;
    257 
    258 #if MPR50
    259   typedef MPR50_ROUTING_CHARACTERISTICS MPR_ROUTING_CHARACTERISTICS;
    260 #endif
    261 
    262   typedef MPR_ROUTING_CHARACTERISTICS *PMPR_ROUTING_CHARACTERISTICS;
    263 
    264 #define REGISTER_PROTOCOL_ENTRY_POINT RegisterProtocol
    265 #define REGISTER_PROTOCOL_ENTRY_POINT_STRING "RegisterProtocol"
    266 
    267   typedef DWORD (WINAPI *PREGISTER_PROTOCOL) (PMPR_ROUTING_CHARACTERISTICS pRoutingChar,PMPR_SERVICE_CHARACTERISTICS pServiceChar);
    268 
    269 #ifdef __cplusplus
    270 }
    271 #endif
    272 #endif
    273