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.

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