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.

343 lines
10 KiB

  1. //============================================================================
  2. // Copyright (c) 1995, Microsoft Corporation
  3. //
  4. // File: ipbootp.h
  5. //
  6. // History:
  7. // Abolade Gbadegesin August 31, 1995 Created
  8. //
  9. // Definitions for IP BOOTP Relay Agent, used by IP Router Manager
  10. //============================================================================
  11. #ifndef _IPBOOTP_H_
  12. #define _IPBOOTP_H_
  13. //----------------------------------------------------------------------------
  14. // CONSTANTS AND MACRO DECLARATIONS
  15. //----------------------------------------------------------------------------
  16. //----------------------------------------------------------------------------
  17. // current bootp config version
  18. //----------------------------------------------------------------------------
  19. #define BOOTP_CONFIG_VERSION_500 500
  20. //----------------------------------------------------------------------------
  21. // constants for the MIB tables exposed b IPBOOTP
  22. //----------------------------------------------------------------------------
  23. #define IPBOOTP_GLOBAL_CONFIG_ID 0
  24. #define IPBOOTP_IF_STATS_ID 1
  25. #define IPBOOTP_IF_CONFIG_ID 2
  26. #define IPBOOTP_IF_BINDING_ID 3
  27. //----------------------------------------------------------------------------
  28. // constants for the field IPBOOTP_GLOBAL_CONFIG::GC_LoggingLevel
  29. //----------------------------------------------------------------------------
  30. #define IPBOOTP_LOGGING_NONE 0
  31. #define IPBOOTP_LOGGING_ERROR 1
  32. #define IPBOOTP_LOGGING_WARN 2
  33. #define IPBOOTP_LOGGING_INFO 3
  34. //----------------------------------------------------------------------------
  35. // constants used for the fields IPBOOTP_IF_STATS::IS_State
  36. // and IPBOOTP_IF_CONFIG::IC_State
  37. //----------------------------------------------------------------------------
  38. #define IPBOOTP_STATE_ENABLED 0x00000001
  39. #define IPBOOTP_STATE_BOUND 0x00000002
  40. //----------------------------------------------------------------------------
  41. // constants for the field IPBOOTP_IF_CONFIG::IC_RelayMode
  42. //----------------------------------------------------------------------------
  43. #define IPBOOTP_RELAY_DISABLED 0
  44. #define IPBOOTP_RELAY_ENABLED 1
  45. //----------------------------------------------------------------------------
  46. // macros for manipulating the variable length IPBOOTP_GLOBAL_CONFIG struct
  47. //
  48. // IPBOOTP_GLOBAL_CONFIG_SIZE computes the size of a global config struct
  49. //
  50. // IPBOOTP_GLOBAL_SERVER_TABLE computes the starting address of the series
  51. // of DHCP/BOOTP server IP addresses in a global config struct
  52. //
  53. // e.g.
  54. // PIPBOOTP_GLOBAL_CONFIG pigcSource, pigcDest;
  55. //
  56. // pigcDest = malloc(IPBOOTP_GLOBAL_CONFIG_SIZE(pigcSource));
  57. // memcpy(pigcDest, pigcSource, IPBOOTP_GLOBAL_CONFIG_SIZE(pigcSource));
  58. //
  59. // e.g.
  60. // DWORD i, *pdwSrv;
  61. // PIPBOOTP_GLOBAL_CONFIG pigc;
  62. //
  63. // pdwSrv = IPBOOTP_GLOBAL_SERVER_TABLE(pigc);
  64. // for (i = 0; i < pigc->GC_ServerCount; i++) {
  65. // printf("%s\n", inet_ntoa(*(struct in_addr *)pdwSrv));
  66. // }
  67. //----------------------------------------------------------------------------
  68. #define IPBOOTP_GLOBAL_CONFIG_SIZE(cfg) \
  69. (sizeof(IPBOOTP_GLOBAL_CONFIG) + (cfg)->GC_ServerCount * sizeof(DWORD))
  70. #define IPBOOTP_GLOBAL_SERVER_TABLE(cfg) ((PDWORD)((cfg) + 1))
  71. //----------------------------------------------------------------------------
  72. // macros for manipulating the variable-length IPBOOTP_IF_BINDING structure
  73. //
  74. // IPBOOTP_IF_BINDING_SIZE computes the size of a binding structure.
  75. //
  76. // IPBOOTP_IF_ADDRESS_TABLE computes the starting address in a binding struct
  77. // of the series of IPBOOTP_IP_ADDRESS structures which are the bindings
  78. // for the interface in question.
  79. //
  80. // e.g.
  81. // PIPBOOTP_IF_BINDING piibSource, piibDest;
  82. //
  83. // piibDest = malloc(IPBOOTP_IF_BINDING_SIZE(piicSource));
  84. // memcpy(piibDest, piicSource, IPBOOTP_IF_BINDING_SIZE(piicSource));
  85. //
  86. // e.g.
  87. // DWORD i;
  88. // PIPBOOTP_IF_BINDING piib;
  89. // PIPBOOTP_IP_ADDRESS *pdwAddr;
  90. //
  91. // pdwAddr = IPBOOTP_IF_ADDRESS_TABLE(piib);
  92. // for (i = 0; i < piib->IB_AddrCount; i++) {
  93. // printf("%s-", inet_ntoa(*(struct in_addr *)&pdwAddr->IA_Address));
  94. // printf("%s\n", inet_ntoa(*(struct in_addr *)&pdwAddr->IA_Netmask));
  95. // }
  96. //----------------------------------------------------------------------------
  97. #define IPBOOTP_IF_BINDING_SIZE(bind) \
  98. (sizeof(IPBOOTP_IF_BINDING) + \
  99. (bind)->IB_AddrCount * sizeof(IPBOOTP_IP_ADDRESS))
  100. #define IPBOOTP_IF_ADDRESS_TABLE(bind) ((PIPBOOTP_IP_ADDRESS)((bind) + 1))
  101. //----------------------------------------------------------------------------
  102. // STRUCTURE DEFINITIONS
  103. //----------------------------------------------------------------------------
  104. //----------------------------------------------------------------------------
  105. // struct: IPBOOTP_GLOBAL_CONFIG
  106. //
  107. // This MIB entry stores global configuration for IPBOOTP.
  108. // There is only one instance, so this entry has no index.
  109. //
  110. // THIS STRUCTURE IS VARIABLE LENGTH:
  111. //
  112. // after the base structure comes an array of GC_ServerCount DWORDs,
  113. // each of which contains an IP address which is a DHCP/BOOTP server
  114. // to which packets will be sent.
  115. //
  116. // All IP address fields must be in network order.
  117. //----------------------------------------------------------------------------
  118. typedef struct _IPBOOTP_GLOBAL_CONFIG {
  119. DWORD GC_LoggingLevel;
  120. DWORD GC_MaxRecvQueueSize;
  121. DWORD GC_ServerCount;
  122. } IPBOOTP_GLOBAL_CONFIG, *PIPBOOTP_GLOBAL_CONFIG;
  123. //----------------------------------------------------------------------------
  124. // struct: IPBOOTP_IF_STATS
  125. //
  126. // This MIB entry stores per-interface statistics for IPBOOTP.
  127. // All IP addresses are in network order.
  128. //
  129. // This structure is read-only.
  130. //----------------------------------------------------------------------------
  131. typedef struct _IPBOOTP_IF_STATS {
  132. DWORD IS_State;
  133. DWORD IS_SendFailures;
  134. DWORD IS_ReceiveFailures;
  135. DWORD IS_ArpUpdateFailures;
  136. DWORD IS_RequestsReceived;
  137. DWORD IS_RequestsDiscarded;
  138. DWORD IS_RepliesReceived;
  139. DWORD IS_RepliesDiscarded;
  140. } IPBOOTP_IF_STATS, *PIPBOOTP_IF_STATS;
  141. //----------------------------------------------------------------------------
  142. // struct: IPBOOTP_IF_CONFIG
  143. //
  144. // This MIB entry describes per-interface configuration
  145. // All IP address are in network order.
  146. //
  147. // Note:
  148. // The field IC_State is read-only.
  149. //----------------------------------------------------------------------------
  150. typedef struct _IPBOOTP_IF_CONFIG {
  151. DWORD IC_State;
  152. DWORD IC_RelayMode;
  153. DWORD IC_MaxHopCount;
  154. DWORD IC_MinSecondsSinceBoot;
  155. } IPBOOTP_IF_CONFIG, *PIPBOOTP_IF_CONFIG;
  156. //----------------------------------------------------------------------------
  157. // struct: IPBOOTP_IF_BINDING
  158. //
  159. // This MIB entry contains the table of IP addresses to which each interface
  160. // is bound.
  161. // All IP addresses are in network order.
  162. //
  163. // THIS STRUCTURE IS VARIABLE LENGTH:
  164. //
  165. // The base structure contains of the field IB_AddrCount, which gives
  166. // the number of IP addresses to which the indexed interface is bound.
  167. // The IP addresses themselves follow the base structure, and are given
  168. // as IPBOOTP_IP_ADDRESS structures.
  169. //
  170. // This MIB entry is read-only.
  171. //----------------------------------------------------------------------------
  172. typedef struct _IPBOOTP_IF_BINDING {
  173. DWORD IB_State;
  174. DWORD IB_AddrCount;
  175. } IPBOOTP_IF_BINDING, *PIPBOOTP_IF_BINDING;
  176. //----------------------------------------------------------------------------
  177. // struct: IPBOOTP_IP_ADDRESS
  178. //
  179. // This structure is used for storing interface bindings.
  180. // A series of structures of this type follows the IPBOOTP_IF_BINDING
  181. // structure (described above).
  182. //
  183. // Both fields are IP address fields in network-order.
  184. //----------------------------------------------------------------------------
  185. typedef struct _IPBOOTP_IP_ADDRESS {
  186. DWORD IA_Address;
  187. DWORD IA_Netmask;
  188. } IPBOOTP_IP_ADDRESS, *PIPBOOTP_IP_ADDRESS;
  189. //----------------------------------------------------------------------------
  190. // struct: IPBOOTP_MIB_SET_INPUT_DATA
  191. //
  192. // This is passed as input data for MibSet
  193. // Note that only the global config and interface config are writable
  194. //----------------------------------------------------------------------------
  195. typedef struct _IPBOOTP_MIB_SET_INPUT_DATA {
  196. DWORD IMSID_TypeID;
  197. DWORD IMSID_IfIndex;
  198. DWORD IMSID_BufferSize;
  199. DWORD IMSID_Buffer[1];
  200. } IPBOOTP_MIB_SET_INPUT_DATA, *PIPBOOTP_MIB_SET_INPUT_DATA;
  201. //----------------------------------------------------------------------------
  202. // struct: IPBOOTP_MIB_GET_INPUT_DATA
  203. //
  204. // This is passed as input data for MibGet, MibGetFirst, and MibGetNext
  205. //----------------------------------------------------------------------------
  206. typedef struct _IPBOOTP_MIB_GET_INPUT_DATA {
  207. DWORD IMGID_TypeID;
  208. DWORD IMGID_IfIndex;
  209. } IPBOOTP_MIB_GET_INPUT_DATA, *PIPBOOTP_MIB_GET_INPUT_DATA;
  210. //----------------------------------------------------------------------------
  211. // struct: IPBOOTP_MIB_GET_OUTPUT_DATA
  212. //
  213. // This is passed as output data for MibGet, MibGetFirst, and MibGetNext
  214. // Note that at the end of a table MibGetNext wraps to the next table,
  215. // and therefore the value IMGOD_TypeID should be examined to see the type
  216. // of the data returned in the output buffer
  217. //----------------------------------------------------------------------------
  218. typedef struct _IPBOOTP_MIB_GET_OUTPUT_DATA {
  219. DWORD IMGOD_TypeID;
  220. DWORD IMGOD_IfIndex;
  221. BYTE IMGOD_Buffer[1];
  222. } IPBOOTP_MIB_GET_OUTPUT_DATA, *PIPBOOTP_MIB_GET_OUTPUT_DATA;
  223. //----------------------------------------------------------------------------
  224. // Function: EnableDhcpInformServer
  225. // DisableDhcpInformServer
  226. //
  227. // Routines used by the RAS server to redirect DHCP inform packets
  228. // to a particular server.
  229. //----------------------------------------------------------------------------
  230. VOID APIENTRY
  231. EnableDhcpInformServer(
  232. DWORD DhcpInformServer
  233. );
  234. VOID APIENTRY
  235. DisableDhcpInformServer(
  236. VOID
  237. );
  238. #endif // _IPBOOTP_H_