Leaked source code of windows server 2003
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.

259 lines
7.3 KiB

  1. /*
  2. Copyright (c) 1998, Microsoft Corporation, all rights reserved
  3. Description:
  4. History:
  5. */
  6. #ifndef _RASIPHLP__H_
  7. #define _RASIPHLP__H_
  8. #include <nt.h>
  9. #include <ntrtl.h>
  10. #include <nturtl.h>
  11. #include <windows.h>
  12. #include <rtutils.h>
  13. #include <dhcpcapi.h>
  14. #include <iprtrmib.h>
  15. #include <ntddip.h>
  16. #include <iptypes.h>
  17. #include "rasiphlp.h"
  18. #define REGKEY_TCPIP_NDISWANIP_W L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Adapters\\NdisWanIp"
  19. #define REGKEY_TCPIP_PARAM_W L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
  20. #define REGKEY_NETBT_PARAM_W L"System\\CurrentControlSet\\Services\\NetBT\\Parameters"
  21. #define REGKEY_INTERFACES_W L"Interfaces"
  22. #define REGVAL_ADAPTERGUID_W L"NetworkAdapterGUID"
  23. #define REGVAL_NAMESERVERLIST_W L"NameServerList"
  24. #define REGVAL_NETBIOSOPTIONS_W L"NetbiosOptions"
  25. #define REGVAL_DHCPIPADDRESS_W L"DhcpIPAddress"
  26. #define REGVAL_DHCPSUBNETMASK_W L"DhcpSubnetMask"
  27. #define REGVAL_DOMAIN_W L"Domain"
  28. #define REGVAL_NAMESERVER_W L"NameServer"
  29. #define REGVAL_IPCONFIG_W L"IpConfig"
  30. #define WCH_TCPIP_ L"Tcpip_"
  31. #define WCH_TCPIP_PARAM_INT_W L"Tcpip\\Parameters\\Interfaces\\"
  32. #define REGKEY_RAS_IP_PARAM_A "System\\CurrentControlSet\\Services\\RemoteAccess\\Parameters\\Ip"
  33. #define REGKEY_ADDR_POOL_A "System\\CurrentControlSet\\Services\\RemoteAccess\\Parameters\\Ip\\StaticAddressPool"
  34. #define REGKEY_BUILTIN_PARAM_A "System\\CurrentControlSet\\Services\\Rasman\\PPP\\ControlProtocols\\BuiltIn"
  35. #define REGVAL_FROM_A "From"
  36. #define REGVAL_TO_A "To"
  37. #define REGVAL_IPADDRESS_A "IpAddress"
  38. #define REGVAL_IPMASK_A "IpMask"
  39. #define REGVAL_USEDHCPADDRESSING_A "UseDhcpAddressing"
  40. #define REGVAL_SUPPRESSWINS_A "SuppressWINSNameServers"
  41. #define REGVAL_SUPPRESSDNS_A "SuppressDNSNameServers"
  42. #define REGVAL_WINSSERVER_A "WINSNameServer"
  43. #define REGVAL_WINSSERVERBACKUP_A "WINSNameServerBackup"
  44. #define REGVAL_DNSSERVERS_A "DNSNameServers"
  45. #define REGVAL_CHUNK_SIZE_A "InitialAddressPoolSize"
  46. #define REGVAL_ALLOW_NETWORK_ACCESS_A "AllowNetworkAccess"
  47. #define REGVAL_DISABLE_NETBT 2
  48. #define HOST_MASK 0xffffffff
  49. #define ALL_NETWORKS_ROUTE 0x00000000
  50. #define INVALID_INDEX 0xffffffff
  51. #define CLASSA_HBO_ADDR(a) (((a) & 0x80000000) == 0)
  52. #define CLASSB_HBO_ADDR(a) (((a) & 0xc0000000) == 0x80000000)
  53. #define CLASSC_HBO_ADDR(a) (((a) & 0xe0000000) == 0xc0000000)
  54. #define LOOPBACK_HBO_ADDR(a) (((a) & 0xFF000000) == 0x7F000000)
  55. #define INVALID_HBO_CLASS(x) (x >= 0xE0000000)
  56. #define CLASSA_HBO_ADDR_MASK 0xff000000
  57. #define CLASSB_HBO_ADDR_MASK 0xffff0000
  58. #define CLASSC_HBO_ADDR_MASK 0xffffff00
  59. #define CLASSA_NBO_ADDR(a) (((*((uchar *)&(a))) & 0x80) == 0)
  60. #define CLASSB_NBO_ADDR(a) (((*((uchar *)&(a))) & 0xc0) == 0x80)
  61. #define CLASSC_NBO_ADDR(a) (((*((uchar *)&(a))) & 0xe0) == 0xc0)
  62. typedef struct _ADDR_POOL
  63. {
  64. struct _ADDR_POOL* pNext; // Next pool
  65. IPADDR hboFirstIpAddr; // First address in the pool
  66. IPADDR hboLastIpAddr; // Last address in the pool
  67. IPADDR hboMask;
  68. IPADDR hboNextIpAddr; // Next address to use from the pool
  69. } ADDR_POOL;
  70. typedef struct _REGISTRY_VALUES
  71. {
  72. BOOL fSuppressWINSNameServers;
  73. BOOL fSuppressDNSNameServers;
  74. DWORD dwChunkSize;
  75. BOOL fUseDhcpAddressing;
  76. IPADDR nboWINSNameServer1;
  77. IPADDR nboWINSNameServer2;
  78. IPADDR nboDNSNameServer1;
  79. IPADDR nboDNSNameServer2;
  80. BOOL fEnableRoute;
  81. BOOL fNICChosen;
  82. ADDR_POOL* pAddrPool;
  83. GUID guidChosenNIC;
  84. } REGVAL;
  85. extern REGVAL HelperRegVal;
  86. typedef
  87. DWORD
  88. (APIENTRY *DHCPNOTIFYCONFIGCHANGE)(
  89. LPWSTR ServerName,
  90. LPWSTR AdapterName,
  91. BOOL IsNewIpAddress,
  92. DWORD IpIndex,
  93. DWORD IpAddress,
  94. DWORD SubnetMask,
  95. SERVICE_ENABLE DhcpServiceEnabled
  96. );
  97. extern DHCPNOTIFYCONFIGCHANGE PDhcpNotifyConfigChange;
  98. typedef
  99. DWORD
  100. (*DHCPLEASEIPADDRESS)(
  101. DWORD AdapterIpAddress,
  102. LPDHCP_CLIENT_UID ClientUID,
  103. DWORD DesiredIpAddress,
  104. LPDHCP_OPTION_LIST OptionList,
  105. LPDHCP_LEASE_INFO *LeaseInfo,
  106. LPDHCP_OPTION_INFO *OptionInfo
  107. );
  108. extern DHCPLEASEIPADDRESS PDhcpLeaseIpAddress;
  109. typedef
  110. DWORD
  111. (*DHCPRENEWIPADDRESSLEASE)(
  112. DWORD AdapterIpAddress,
  113. LPDHCP_LEASE_INFO ClientLeaseInfo,
  114. LPDHCP_OPTION_LIST OptionList,
  115. LPDHCP_OPTION_INFO *OptionInfo
  116. );
  117. extern DHCPRENEWIPADDRESSLEASE PDhcpRenewIpAddressLease;
  118. typedef
  119. DWORD
  120. (*DHCPRELEASEIPADDRESSLEASE)(
  121. DWORD AdapterIpAddress,
  122. LPDHCP_LEASE_INFO ClientLeaseInfo
  123. );
  124. extern DHCPRELEASEIPADDRESSLEASE PDhcpReleaseIpAddressLease;
  125. typedef
  126. DWORD
  127. (*ALLOCATEANDGETIPADDRTABLEFROMSTACK)(
  128. OUT MIB_IPADDRTABLE **ppIpAddrTable,
  129. IN BOOL bOrder,
  130. IN HANDLE hHeap,
  131. IN DWORD dwFlags
  132. );
  133. extern ALLOCATEANDGETIPADDRTABLEFROMSTACK PAllocateAndGetIpAddrTableFromStack;
  134. typedef
  135. DWORD
  136. (*SETPROXYARPENTRYTOSTACK)(
  137. IN DWORD dwAddress,
  138. IN DWORD dwMask,
  139. IN DWORD dwAdapterIndex,
  140. IN BOOL bAddEntry,
  141. IN BOOL bForceUpdate
  142. );
  143. extern SETPROXYARPENTRYTOSTACK PSetProxyArpEntryToStack;
  144. typedef
  145. DWORD
  146. (*SETIPFORWARDENTRYTOSTACK)(
  147. IN PMIB_IPFORWARDROW pForwardRow
  148. );
  149. extern SETIPFORWARDENTRYTOSTACK PSetIpForwardEntryToStack;
  150. typedef
  151. DWORD
  152. (*SETIPFORWARDENTRY)(
  153. IN PMIB_IPFORWARDROW pForwardRow
  154. );
  155. extern SETIPFORWARDENTRY PSetIpForwardEntry;
  156. typedef
  157. DWORD
  158. (*DELETEIPFORWARDENTRY)(
  159. IN PMIB_IPFORWARDROW pForwardRow
  160. );
  161. extern DELETEIPFORWARDENTRY PDeleteIpForwardEntry;
  162. typedef
  163. DWORD
  164. (*NHPALLOCATEANDGETINTERFACEINFOFROMSTACK)(
  165. OUT IP_INTERFACE_NAME_INFO **ppTable,
  166. OUT PDWORD pdwCount,
  167. IN BOOL bOrder,
  168. IN HANDLE hHeap,
  169. IN DWORD dwFlags
  170. );
  171. extern NHPALLOCATEANDGETINTERFACEINFOFROMSTACK PNhpAllocateAndGetInterfaceInfoFromStack;
  172. typedef
  173. DWORD
  174. (*ALLOCATEANDGETIPFORWARDTABLEFROMSTACK)(
  175. OUT MIB_IPFORWARDTABLE **ppForwardTable,
  176. IN BOOL bOrder,
  177. IN HANDLE hHeap,
  178. IN DWORD dwFlags
  179. );
  180. extern ALLOCATEANDGETIPFORWARDTABLEFROMSTACK PAllocateAndGetIpForwardTableFromStack;
  181. typedef
  182. DWORD
  183. (*GETADAPTERSINFO)(
  184. PIP_ADAPTER_INFO pAdapterInfo,
  185. PULONG pOutBufLen
  186. );
  187. extern GETADAPTERSINFO PGetAdaptersInfo;
  188. typedef
  189. DWORD
  190. (*GETPERADAPTERINFO)(
  191. ULONG IfIndex,
  192. PIP_PER_ADAPTER_INFO pPerAdapterInfo,
  193. PULONG pOutBufLen
  194. );
  195. extern GETPERADAPTERINFO PGetPerAdapterInfo;
  196. typedef
  197. VOID
  198. (APIENTRY *ENABLEDHCPINFORMSERVER)(
  199. IN DWORD DhcpInformServer
  200. );
  201. extern ENABLEDHCPINFORMSERVER PEnableDhcpInformServer;
  202. typedef
  203. VOID
  204. (APIENTRY *DISABLEDHCPINFORMSERVER)(
  205. VOID
  206. );
  207. extern DISABLEDHCPINFORMSERVER PDisableDhcpInformServer;
  208. #endif // #ifndef _RASIPHLP__H_