Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

292 lines
10 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. private\inc\ipxfwd.h
  5. Abstract:
  6. Router Manager Interface to IPX Forwarder Driver
  7. Author:
  8. Vadim Eydelman
  9. Revision History:
  10. --*/
  11. #ifndef _IPXFWD_
  12. #define _IPXFWD_
  13. #define FWD_INTERNAL_INTERFACE_INDEX 0
  14. // Forwarder interface statistic structure
  15. typedef struct _FWD_IF_STATS {
  16. ULONG OperationalState; // Real state of the interface
  17. #define FWD_OPER_STATE_UP 0
  18. #define FWD_OPER_STATE_DOWN 1
  19. #define FWD_OPER_STATE_SLEEPING 2
  20. ULONG MaxPacketSize; // Maximum packet size allowed on the intf
  21. ULONG InHdrErrors; // Num. of packets received with header errors
  22. ULONG InFiltered; // Num. of received packets that were filtered out
  23. ULONG InNoRoutes; // Num, of received packets with unknonw dest.
  24. ULONG InDiscards; // Num. of received packets discarded for other reasons
  25. ULONG InDelivers; // Num. of received packets delivered to dest
  26. ULONG OutFiltered; // Num. of sent packets fitered out
  27. ULONG OutDiscards; // Num. of sent packets discarded for other reasons
  28. ULONG OutDelivers; // Num. of sent packets delivered to dest
  29. ULONG NetbiosReceived; // Num. of received Netbios packets
  30. ULONG NetbiosSent; // Num. of sent Netbios packets
  31. } FWD_IF_STATS, *PFWD_IF_STATS;
  32. typedef struct _FWD_ADAPTER_BINDING_INFO {
  33. ULONG AdapterIndex;
  34. ULONG Network;
  35. UCHAR LocalNode[6];
  36. UCHAR RemoteNode[6];
  37. ULONG MaxPacketSize;
  38. ULONG LinkSpeed;
  39. } FWD_ADAPTER_BINDING_INFO, *PFWD_ADAPTER_BINDING_INFO;
  40. typedef struct FWD_NB_NAME {
  41. UCHAR Name[16];
  42. } FWD_NB_NAME, *PFWD_NB_NAME;
  43. typedef struct _FWD_PERFORMANCE {
  44. LONGLONG TotalPacketProcessingTime;
  45. LONGLONG TotalNbPacketProcessingTime;
  46. LONGLONG MaxPacketProcessingTime;
  47. LONGLONG MaxNbPacketProcessingTime;
  48. LONG PacketCounter;
  49. LONG NbPacketCounter;
  50. } FWD_PERFORMANCE, *PFWD_PERFORMANCE;
  51. typedef struct _FWD_DIAL_REQUEST {
  52. ULONG IfIndex;
  53. UCHAR Packet[30];
  54. } FWD_DIAL_REQUEST, *PFWD_DIAL_REQUEST;
  55. #define IPXFWD_NAME L"\\Device\\NwLnkFwd"
  56. //
  57. // Define the various device type values. Note that values used by Microsoft
  58. // Corporation are in the range 0-32767, and 32768-65535 are reserved for use
  59. // by customers.
  60. //
  61. #define FILE_DEVICE_IPXFWD FILE_DEVICE_NETWORK
  62. //
  63. // Macro definition for defining IOCTL and FSCTL function control codes. Note
  64. // that function codes 0-2047 are reserved for Microsoft Corporation, and
  65. // 2048-4095 are reserved for customers.
  66. //
  67. #define IPXFWD_IOCTL_INDEX (ULONG)0x00000800
  68. //
  69. // Define our own private IOCTLs
  70. //
  71. // Adds interface to the forwarder table, FWD_IF_SET_PARAMS should be passed in
  72. // the input buffer
  73. #define IOCTL_FWD_CREATE_INTERFACE \
  74. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+1,METHOD_BUFFERED,FILE_ANY_ACCESS)
  75. // Deletes interface from the forwarder table, Interface index should be passed in
  76. // the input buffer
  77. #define IOCTL_FWD_DELETE_INTERFACE \
  78. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+2,METHOD_BUFFERED,FILE_ANY_ACCESS)
  79. // Sets interface parameters, FWD_IF_SET_PARAMS should be passed in
  80. // the input buffer
  81. #define IOCTL_FWD_SET_INTERFACE \
  82. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+3,METHOD_BUFFERED,FILE_ANY_ACCESS)
  83. // Gets interface parameters, FWD_IF_GET_PARAMS will be returned in
  84. // the input buffer
  85. #define IOCTL_FWD_GET_INTERFACE \
  86. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+4,METHOD_BUFFERED,FILE_ANY_ACCESS)
  87. // Binds interface to physical adapter, FWD_IF_BIND_PARAMS should be passed in
  88. // the input buffer
  89. #define IOCTL_FWD_BIND_INTERFACE \
  90. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+5,METHOD_BUFFERED,FILE_ANY_ACCESS)
  91. // Unbinds interface from the adapter, Interface index should be passed in
  92. // the input buffer
  93. #define IOCTL_FWD_UNBIND_INTERFACE \
  94. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+6,METHOD_BUFFERED,FILE_ANY_ACCESS)
  95. // Disables forwarder operations in the interface, Interface index should be
  96. // passed in the input buffer
  97. #define IOCTL_FWD_DISABLE_INTERFACE \
  98. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+7,METHOD_BUFFERED,FILE_ANY_ACCESS)
  99. // Enables forwarder operations in the interface, Interface index should be
  100. // passed in the input buffer
  101. #define IOCTL_FWD_ENABLE_INTERFACE \
  102. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+8,METHOD_BUFFERED,FILE_ANY_ACCESS)
  103. // Sets netbios names in to resolve netbios broadcasts to this interface,
  104. // Interface index should be passed in the input buffer,
  105. // FWD_NB_NAMES_PARAMS structure should be passed in the output buffer
  106. #define IOCTL_FWD_SET_NB_NAMES \
  107. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_IN_DIRECT,FILE_ANY_ACCESS)
  108. // Resets netbios names on the interface (deletes all of them).
  109. // Interface index should be passed in the input buffer,
  110. #define IOCTL_FWD_RESET_NB_NAMES \
  111. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_BUFFERED,FILE_ANY_ACCESS)
  112. // Sets netbios names in to resolve netbios broadcasts to this interface,
  113. // Interface index should be passed in the input buffer,
  114. // FWD_NB_NAMES_PARAMS structure will be returned in the output buffer
  115. #define IOCTL_FWD_GET_NB_NAMES \
  116. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+10,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)
  117. // Adds/deletes/updates routes in forwarder table, array of FWD_ROUTE_SET_PARAMS
  118. // should be passed in the input buffer. Returns number of processed routes in the
  119. // ioStatus.Information field
  120. #define IOCTL_FWD_SET_ROUTES \
  121. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+11,METHOD_BUFFERED,FILE_ANY_ACCESS)
  122. // Returns forwarder dial requests, FWD_DIAL_REQUEST_PARAMS structure
  123. // for interfaces for which connection should be established returned
  124. // in the output buffer (number of bytest returned is placed in the
  125. // Information field of IO_STATUS block)
  126. #define IOCTL_FWD_GET_DIAL_REQUEST \
  127. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+12,METHOD_BUFFERED,FILE_ANY_ACCESS)
  128. // Informs forwarder that its connection request could not be satisfied,
  129. // Interface index should be passed in the input buffer
  130. #define IOCTL_FWD_DIAL_REQUEST_FAILED \
  131. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+13,METHOD_BUFFERED,FILE_ANY_ACCESS)
  132. // Initializes and start forwarder
  133. // FWD_START_PARAMS structure should be passed in the input buffer
  134. #define IOCTL_FWD_START \
  135. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+14,METHOD_BUFFERED,FILE_ANY_ACCESS)
  136. #define IOCTL_FWD_GET_PERF_COUNTERS \
  137. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+15,METHOD_BUFFERED,FILE_ANY_ACCESS)
  138. // Instructs the forwarder to renumber it's nicids according to an opcode and
  139. // threshold passed in the input buffer. No data is returned.
  140. #define IOCTL_FWD_RENUMBER_NICS \
  141. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+16,METHOD_BUFFERED,FILE_ANY_ACCESS)
  142. // Dumps as much of the ipx interface table into the given buffer as possible.
  143. #define IOCTL_FWD_GET_IF_TABLE \
  144. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+17,METHOD_BUFFERED,FILE_ANY_ACCESS)
  145. // Updates the configuration of the forwarder for pnp
  146. #define IOCTL_FWD_UPDATE_CONFIG \
  147. CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+18,METHOD_BUFFERED,FILE_ANY_ACCESS)
  148. // Structure passed with IOCTL_FWD_CREATE_INTERFACE call
  149. typedef struct _FWD_IF_CREATE_PARAMS {
  150. ULONG Index; // Interface index
  151. BOOLEAN NetbiosAccept; // Whether to accept nb packets
  152. UCHAR NetbiosDeliver; // NB deliver mode
  153. // Forwarder netbios broadcast delivery options
  154. #define FWD_NB_DONT_DELIVER 0
  155. #define FWD_NB_DELIVER_STATIC 1
  156. #define FWD_NB_DELIVER_IF_UP 2
  157. #define FWD_NB_DELIVER_ALL 3
  158. UCHAR InterfaceType; // Interface type
  159. // Forwarder interface types
  160. #define FWD_IF_PERMANENT 0
  161. #define FWD_IF_DEMAND_DIAL 1
  162. #define FWD_IF_LOCAL_WORKSTATION 2
  163. #define FWD_IF_REMOTE_WORKSTATION 3
  164. } FWD_IF_CREATE_PARAMS, *PFWD_IF_CREATE_PARAMS;
  165. // Structure passed with IOCTL_FWD_SET_INTERFACE call
  166. typedef struct _FWD_IF_SET_PARAMS {
  167. ULONG Index; // Interface index
  168. BOOLEAN NetbiosAccept; // Whether to accept nb packets
  169. UCHAR NetbiosDeliver; // NB deliver mode
  170. } FWD_IF_SET_PARAMS, *PFWD_IF_SET_PARAMS;
  171. // Structure returned in IOCTL_FWD_GET_INTERFACE call
  172. typedef struct _FWD_IF_GET_PARAMS {
  173. FWD_IF_STATS Stats; // Interface statistics
  174. BOOLEAN NetbiosAccept; // Whether to accept nb packets
  175. UCHAR NetbiosDeliver; // NB deliver mode
  176. } FWD_IF_GET_PARAMS, *PFWD_IF_GET_PARAMS;
  177. // Structure returned in IOCTL_FWD_BIND_INTERFACE call
  178. typedef struct _FWD_IF_BIND_PARAMS {
  179. ULONG Index; // Interface index
  180. FWD_ADAPTER_BINDING_INFO Info; // Interface binding information
  181. } FWD_IF_BIND_PARAMS, *PFWD_IF_BIND_PARAMS;
  182. // Structure passed with IOCTL_FWD_SET_ROUTES call
  183. typedef struct _FWD_ROUTE_SET_PARAMS {
  184. ULONG Network; // Route's destination network
  185. UCHAR NextHopAddress[6]; // Node address of the next hop
  186. // router if network is not
  187. // connected directly
  188. USHORT TickCount;
  189. USHORT HopCount;
  190. ULONG InterfaceIndex; // Interface to use to route to
  191. // the dest network
  192. ULONG Action; // Action to take with the route:
  193. #define FWD_ADD_ROUTE 0 // route should be added to the table
  194. #define FWD_DELETE_ROUTE 1 // route should be deleted from the table
  195. #define FWD_UPDATE_ROUTE 2 // route should be updated
  196. } FWD_ROUTE_SET_PARAMS, *PFWD_ROUTE_SET_PARAMS;
  197. typedef struct _FWD_START_PARAMS {
  198. ULONG RouteHashTableSize; // Size of route hash table
  199. BOOLEAN ThisMachineOnly; // allow access to this machine only
  200. // for dialin clients
  201. #define FWD_SMALL_ROUTE_HASH_SIZE 31
  202. #define FWD_MEDIUM_ROUTE_HASH_SIZE 257
  203. #define FWD_LARGE_ROUTE_HASH_SIZE 1027
  204. } FWD_START_PARAMS, *PFWD_START_PARAMS;
  205. typedef struct _FWD_NB_NAMES_PARAMS {
  206. ULONG TotalCount;
  207. FWD_NB_NAME Names[1];
  208. } FWD_NB_NAMES_PARAMS, *PFWD_NB_NAMES_PARAMS;
  209. typedef struct _FWD_PERFORMANCE FWD_PERFORMANCE_PARAMS, *PFWD_PERFORMANCE_PARAMS;
  210. // Structure and definitions passed with IOCTL_FWD_RENUMBER_NICS call
  211. #define FWD_NIC_OPCODE_DECREMENT 1
  212. #define FWD_NIC_OPCODE_INCREMENT 2
  213. typedef struct _FWD_RENUMBER_NICS_DATA {
  214. ULONG ulOpCode;
  215. USHORT usThreshold;
  216. } FWD_RENUMBER_NICS_DATA;
  217. // Structures to use with IOCTL_FWD_GET_IF_TABLE
  218. typedef struct _FWD_INTERFACE_TABLE_ROW {
  219. ULONG dwIndex;
  220. ULONG dwNetwork;
  221. UCHAR uNode[6];
  222. UCHAR uRemoteNode[6];
  223. USHORT usNicId;
  224. UCHAR ucType;
  225. } FWD_INTERFACE_TABLE_ROW;
  226. typedef struct _FWD_INTERFACE_TABLE {
  227. ULONG dwNumRows;
  228. FWD_INTERFACE_TABLE_ROW * pRows;
  229. } FWD_INTERFACE_TABLE;
  230. // Structure to use with IOCTL_FWD_UPDATE_CONFIG
  231. typedef struct _FWD_UPDATE_CONFIG_PARAMS {
  232. BOOLEAN bThisMachineOnly;
  233. } FWD_UPDATE_CONFIG_PARAMS;
  234. #endif