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.

344 lines
9.7 KiB

  1. /* Copyright (c) 1993, Microsoft Corporation, all rights reserved
  2. **
  3. ** rasipcp.h
  4. ** Remote Access PPP Internet Protocol Control Protocol
  5. **
  6. ** 11/05/93 Steve Cobb
  7. */
  8. #ifndef _RASIPCP_H_
  9. #define _RASIPCP_H_
  10. #include "dhcpcsdk.h"
  11. /*----------------------------------------------------------------------------
  12. ** Constants
  13. **----------------------------------------------------------------------------
  14. */
  15. /* Highest PPP packet code used by IPCP.
  16. */
  17. #define MAXIPCPCODE 7
  18. /* IPCP configuration option codes.
  19. */
  20. #define OPTION_IpCompression 2 // Official PPP code
  21. #define OPTION_IpAddress 3 // Official PPP code
  22. #define OPTION_DnsIpAddress 129 // Private RAS code
  23. #define OPTION_WinsIpAddress 130 // Private RAS code
  24. #define OPTION_DnsBackupIpAddress 131 // Private RAS code
  25. #define OPTION_WinsBackupIpAddress 132 // Private RAS code
  26. /* Length of an IP address option, i.e. IpAddress, DnsIpAddress, and
  27. ** WinsIpAddress. Length of IP compression option, always Van Jacobson.
  28. */
  29. #define IPADDRESSOPTIONLEN 6
  30. #define IPCOMPRESSIONOPTIONLEN 6
  31. /* Compression protocol codes, per PPP spec.
  32. */
  33. #define COMPRESSION_VanJacobson 0x002D
  34. /* Macros for shortening cumbersome RAS_PROTOCOLCOMPRESSION expressions.
  35. */
  36. #define Protocol(r) (r).RP_ProtocolType.RP_IP.RP_IPCompressionProtocol
  37. #define MaxSlotId(r) (r).RP_ProtocolType.RP_IP.RP_MaxSlotID
  38. #define CompSlotId(r) (r).RP_ProtocolType.RP_IP.RP_CompSlotID
  39. /* Used to trace IPCP
  40. */
  41. #define PPPIPCP_TRACE 0x00010000
  42. #define DNS_SUFFIX_SIZE 255
  43. /*----------------------------------------------------------------------------
  44. ** Datatypes
  45. **----------------------------------------------------------------------------
  46. */
  47. /* Defines the WorkBuf stored for us by the PPP engine.
  48. */
  49. typedef struct tagIPCPWB
  50. {
  51. BOOL fServer;
  52. HPORT hport;
  53. /* Indicates the remote network should be given priority on address
  54. ** conflicts and that the default gateway on the remote network should be
  55. ** used rather than the one on the local network. This is sent down from
  56. ** the UI. (client only)
  57. */
  58. BOOL fPrioritizeRemote;
  59. /* Indicates the link has been reconfigured with PPP IP settings. When
  60. ** set renegotiation is not allowed without dropping the link, due to
  61. ** RasActivateRoute/RasDeAllocateRoute restrictions.
  62. */
  63. BOOL fRasConfigActive;
  64. /* Indicates a ThisLayerUp has been successfully processed and we are
  65. ** waiting for the NBFCP projection result before activating the route.
  66. ** Reset once the route is activated.
  67. */
  68. BOOL fExpectingProjection;
  69. /* Indicates the given option should not be requested in future Config-Req
  70. ** packets. This typically means the option has been rejected by the
  71. ** peer, but may also indicate that a registry parameter has
  72. ** "pre-rejected" the option.
  73. */
  74. BOOL fIpCompressionRejected;
  75. BOOL fIpaddrRejected;
  76. BOOL fIpaddrDnsRejected;
  77. BOOL fIpaddrWinsRejected;
  78. BOOL fIpaddrDnsBackupRejected;
  79. BOOL fIpaddrWinsBackupRejected;
  80. /* Indicates some protocol aberration has occurred and we are trying a
  81. ** configuration without MS extensions in a last ditch attempt to
  82. ** negotiate something satisfactory.
  83. */
  84. BOOL fTryWithoutExtensions;
  85. /* Unnumbered IPCP
  86. */
  87. BOOL fUnnumbered;
  88. BOOL fRegisterWithWINS;
  89. BOOL fRegisterWithDNS;
  90. BOOL fRegisterAdapterDomainName;
  91. BOOL fRouteActivated;
  92. BOOL fDisableNetbt;
  93. /* The number of Config-Reqs sent without receiving a response. After 3
  94. ** consecutive attempts an attempt without MS extensions is attempted.
  95. */
  96. DWORD cRequestsWithoutResponse;
  97. /* Current value of negotiated IP address parameters.
  98. */
  99. IPINFO IpInfoLocal;
  100. IPINFO IpInfoRemote;
  101. IPADDR IpAddressLocal;
  102. IPADDR IpAddressRemote;
  103. IPADDR IpAddressToHandout;
  104. DWORD dwNumDNSAddresses;
  105. DWORD* pdwDNSAddresses;
  106. /* Current value of "send" and "receive" compression parameters. The
  107. ** "send compression" flag is set when a compression option from the
  108. ** remote peer is acknowledged and indicates whether the "send"
  109. ** capabilities stored in 'rpcSend' should be activated.
  110. ** 'fIpCompressionRejected' provides this same information (though
  111. ** inverted) for the 'rpcReceive' capabilities.
  112. */
  113. RAS_PROTOCOLCOMPRESSION rpcSend;
  114. RAS_PROTOCOLCOMPRESSION rpcReceive;
  115. BOOL fSendCompression;
  116. /* RAS Manager interface buffers.
  117. */
  118. RASMAN_ROUTEINFO routeinfo;
  119. WCHAR* pwszDevice;
  120. /* This flag is set in IpcpBegin when an error occurs after
  121. ** RasAllocateRoute has succeeded. IpcpMakeConfigReq (always called) will
  122. ** notice and return the error. This results in IpcpEnd being called when
  123. ** it is safe to call RasDeAllocateRoute, which would not occur if the
  124. ** error were returned from IpcpBegin directly. RasDeAllocateRoute cannot
  125. ** be called in IpcpBegin because the port is open, which is a limitation
  126. ** in NDISWAN.
  127. */
  128. DWORD dwErrInBegin;
  129. WCHAR wszUserName[UNLEN+1];
  130. WCHAR wszPortName[MAX_PORT_NAME+1];
  131. CHAR szDnsSuffix[DNS_SUFFIX_SIZE + 1];
  132. HBUNDLE hConnection;
  133. HANDLE hIPInterface;
  134. ROUTER_INTERFACE_TYPE IfType;
  135. /*
  136. ** The following field is used to store the DHCP route that
  137. ** is send by option 133 from DHCP server.
  138. */
  139. PBYTE pbDhcpRoutes;
  140. } IPCPWB;
  141. /*----------------------------------------------------------------------------
  142. ** Globals
  143. **----------------------------------------------------------------------------
  144. */
  145. #ifdef RASIPCPGLOBALS
  146. #define GLOBALS
  147. #define EXTERN
  148. #else
  149. #define EXTERN extern
  150. #endif
  151. /* Handle to RAS ARP.
  152. */
  153. EXTERN HANDLE HRasArp
  154. #ifdef GLOBALS
  155. = INVALID_HANDLE_VALUE
  156. #endif
  157. ;
  158. /* DHCP.DLL handle and entry points. The handle is NULL if the DLL is not
  159. ** loaded.
  160. */
  161. EXTERN HINSTANCE HDhcpDll
  162. #ifdef GLOBALS
  163. = NULL
  164. #endif
  165. ;
  166. typedef
  167. DWORD
  168. (APIENTRY *DHCPNOTIFYCONFIGCHANGEEX)(
  169. LPWSTR ServerName,
  170. LPWSTR AdapterName,
  171. BOOL IsNewIpAddress,
  172. DWORD IpIndex,
  173. DWORD IpAddress,
  174. DWORD SubnetMask,
  175. SERVICE_ENABLE DhcpServiceEnabled,
  176. ULONG ulFlags
  177. );
  178. EXTERN
  179. DHCPNOTIFYCONFIGCHANGEEX PDhcpNotifyConfigChange2
  180. #ifdef GLOBALS
  181. = NULL
  182. #endif
  183. ;
  184. typedef
  185. DWORD // Request client for options.. and get the options.
  186. (APIENTRY *DHCPREQUESTOPTIONS)(
  187. LPWSTR AdapterName,
  188. BYTE *pbRequestedOptions,
  189. DWORD dwNumberOfOptions,
  190. BYTE **ppOptionList, // out param
  191. DWORD *pdwOptionListSize, // out param
  192. BYTE **ppbReturnedOptions, // out param
  193. DWORD *pdwNumberOfAvailableOptions // out param
  194. );
  195. EXTERN
  196. DHCPREQUESTOPTIONS PDhcpRequestOptions
  197. #ifdef GLOBALS
  198. = NULL
  199. #endif
  200. ;
  201. typedef
  202. DWORD
  203. (APIENTRY *DHCPREQUESTPARAMS) (
  204. // must be DHCPCAPI_REQUEST_SYNCHRONOUS
  205. IN DWORD Flags,
  206. // this parameter is reserved
  207. IN LPVOID Reserved,
  208. // adapter name to request for
  209. IN LPWSTR AdapterName,
  210. // reserved must be NULL
  211. IN LPDHCPCAPI_CLASSID ClassId,
  212. // parameters to send.
  213. IN DHCPCAPI_PARAMS_ARRAY SendParams,
  214. // parameters that are to be requested..
  215. IN OUT DHCPCAPI_PARAMS_ARRAY RecdParams,
  216. // a buffer to hold data for RecdParams
  217. IN LPBYTE Buffer,
  218. // i/p: size of above in BYTES, o/p required bytes..
  219. IN OUT LPDWORD pSize,
  220. // needed for persistent requests
  221. IN LPWSTR RequestIdStr
  222. );
  223. //
  224. // returns ERROR_MORE_DATA if o/p buffer is of insufficient size,
  225. // and fills in reqd size in # of bytes
  226. //
  227. EXTERN
  228. DHCPREQUESTPARAMS PDhcpRequestParams = NULL;
  229. /* TRACE ID
  230. */
  231. EXTERN DWORD DwIpcpTraceId
  232. #ifdef GLOBALS
  233. = INVALID_TRACEID
  234. #endif
  235. ;
  236. #undef EXTERN
  237. #undef GLOBALS
  238. /*----------------------------------------------------------------------------
  239. ** Prototypes
  240. **----------------------------------------------------------------------------
  241. */
  242. DWORD IpcpChangeNotification( VOID );
  243. DWORD IpcpBegin( VOID**, VOID* );
  244. DWORD IpcpThisLayerFinished( VOID* );
  245. DWORD IpcpEnd( VOID* );
  246. DWORD IpcpReset( VOID* );
  247. DWORD IpcpThisLayerUp( VOID* );
  248. DWORD IpcpPreDisconnectCleanup( VOID* );
  249. DWORD IpcpMakeConfigRequest( VOID*, PPP_CONFIG*, DWORD );
  250. DWORD IpcpMakeConfigResult( VOID*, PPP_CONFIG*, PPP_CONFIG*, DWORD, BOOL );
  251. DWORD IpcpConfigAckReceived( VOID*, PPP_CONFIG* );
  252. DWORD IpcpConfigNakReceived( VOID*, PPP_CONFIG* );
  253. DWORD IpcpConfigRejReceived( VOID*, PPP_CONFIG* );
  254. DWORD IpcpGetNegotiatedInfo( VOID*, VOID* );
  255. DWORD IpcpProjectionNotification( VOID*, VOID* );
  256. DWORD IpcpTimeSinceLastActivity( VOID*, DWORD* );
  257. DWORD
  258. ResetNetBTConfigInfo(
  259. IN IPCPWB* pwb );
  260. VOID AbcdFromIpaddr( IPADDR, WCHAR* );
  261. VOID AddIpAddressOption( BYTE UNALIGNED*, BYTE, IPADDR );
  262. VOID AddIpCompressionOption( BYTE UNALIGNED* pbBuf,
  263. RAS_PROTOCOLCOMPRESSION* prpc );
  264. DWORD DeActivateRasConfig( IPCPWB* );
  265. // DWORD LoadDhcpDll();
  266. DWORD NakCheck( IPCPWB*, PPP_CONFIG*, PPP_CONFIG*, DWORD, BOOL*, BOOL );
  267. BOOL NakCheckNameServerOption( IPCPWB*, BOOL, PPP_OPTION UNALIGNED*,
  268. PPP_OPTION UNALIGNED** );
  269. DWORD RejectCheck( IPCPWB*, PPP_CONFIG*, PPP_CONFIG*, DWORD, BOOL* );
  270. DWORD ReconfigureTcpip( WCHAR*, BOOL, IPADDR, IPADDR);
  271. // VOID UnloadDhcpDll();
  272. VOID TraceIp(CHAR * Format, ... );
  273. VOID TraceIpDump( LPVOID lpData, DWORD dwByteCount );
  274. VOID
  275. PrintMwsz(
  276. CHAR* sz,
  277. WCHAR* mwsz
  278. );
  279. #define DUMPB TraceIpDump
  280. #endif // _RASIPCP_H_