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.

110 lines
4.0 KiB

  1. //================================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // All dealings with the stack and other non-Dhcp components go through the API
  5. // given here
  6. //================================================================================
  7. #ifndef STACK_H_INCLUDED
  8. #define STACK_H_INCLUDED
  9. #include <iphlpapi.h>
  10. //================================================================================
  11. // Exported API's
  12. //================================================================================
  13. DWORD // win32 status
  14. DhcpClearAllStackParameters( // undo the effects
  15. IN PDHCP_CONTEXT DhcpContext // the adapter to undo
  16. );
  17. DWORD // win32 status
  18. DhcpSetAllStackParameters( // set all stack details
  19. IN PDHCP_CONTEXT DhcpContext, // the context to set stuff
  20. IN PDHCP_FULL_OPTIONS DhcpOptions // pick up the configuration from off here
  21. );
  22. DWORD
  23. GetIpPrimaryAddresses(
  24. IN PMIB_IPADDRTABLE *IpAddrTable
  25. );
  26. DWORD
  27. DhcpSetGateways(
  28. IN PDHCP_CONTEXT DhcpContext,
  29. IN PDHCP_FULL_OPTIONS DhcpOptions,
  30. IN BOOLEAN fForceUpdate
  31. );
  32. // The classless route layout is:
  33. // - 1 byte encoding the route subnet mask
  34. // - depending on the mask, 0 to 4 bytes encoding the route destination address
  35. // - 4 bytes for the gateway address for the route
  36. // The route destination is encoded based on the value of mask:
  37. // mask = 0 => destination = 0.0.0.0 (no bytes to encode it)
  38. // mask = 1..8 => destination = b1.0.0.0 (1 byte to encode it)
  39. // mask = 9..16 => destination = b1.b2.0.0 (2 bytes for encoding)
  40. // mask = 17..24 => destination = b1.b2.b3.0 (3 bytes for encoding)
  41. // mask = 25..32 => destination = b1.b2.b3.b4 (4 bytes for encoding)
  42. #define CLASSLESS_ROUTE_LEN(x) (1+((x)?((((x)-1)>>3)+1):0)+4)
  43. DWORD
  44. GetCLRoute(
  45. IN LPBYTE RouteData,
  46. OUT LPBYTE RouteDest,
  47. OUT LPBYTE RouteMask,
  48. OUT LPBYTE RouteGateway
  49. );
  50. DWORD
  51. CheckCLRoutes(
  52. IN DWORD RoutesDataLen,
  53. IN LPBYTE RoutesData,
  54. OUT LPDWORD pNRoutes
  55. );
  56. DWORD
  57. DhcpSetStaticRoutes(
  58. IN PDHCP_CONTEXT DhcpContext,
  59. IN PDHCP_FULL_OPTIONS DhcpOptions
  60. );
  61. DWORD
  62. DhcpRegisterWithDns(
  63. IN PDHCP_CONTEXT DhcpContext,
  64. IN BOOL fDeRegister
  65. );
  66. #endif STACK_H_INCLUDED
  67. #ifndef SYSSTACK_H_INCLUDED
  68. #define SYSSTACK_H_INCLUDED
  69. //================================================================================
  70. // imported api's
  71. //================================================================================
  72. DWORD // return interface index or -1
  73. DhcpIpGetIfIndex( // get the IF index for this adapter
  74. IN PDHCP_CONTEXT DhcpContext // context of adapter to get IfIndex for
  75. );
  76. DWORD // win32 status
  77. DhcpSetRoute( // set a route with the stack
  78. IN DWORD Dest, // network order destination
  79. IN DWORD DestMask, // network order destination mask
  80. IN DWORD IfIndex, // interface index to route
  81. IN DWORD NextHop, // next hop n/w order address
  82. IN DWORD Metric, // metric
  83. IN BOOL IsLocal, // is this a local address? (IRE_DIRECT)
  84. IN BOOL IsDelete // is this route being deleted?
  85. );
  86. ULONG
  87. TcpIpNotifyRouterDiscoveryOption(
  88. IN LPCWSTR AdapterName,
  89. IN BOOL fOptionPresent,
  90. IN DWORD OptionValue
  91. );
  92. #endif SYSSTACK_H_INCLUDED