home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / ipexport.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  7.7 KB  |  220 lines

  1. /********************************************************************/
  2. /**                     Microsoft LAN Manager                      **/
  3. /**               Copyright(c) Microsoft Corp., 1990-1999          **/
  4. /********************************************************************/
  5. /* :ts=4 */
  6.  
  7. //** IPEXPORT.H - IP public definitions.
  8. //
  9. //  This file contains public definitions exported to transport layer and
  10. //  application software.
  11. //
  12.  
  13. #ifndef IP_EXPORT_INCLUDED
  14. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  15. #define IP_EXPORT_INCLUDED  1
  16.  
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif
  20.  
  21. //#include <windef.h> // for FAR decl
  22. #undef FAR
  23. #define FAR
  24.  
  25. //
  26. // IP type definitions.
  27. //
  28. typedef unsigned long   IPAddr;     // An IP address.
  29. typedef unsigned long   IPMask;     // An IP subnet mask.
  30. typedef unsigned long   IP_STATUS;  // Status code returned from IP APIs.
  31.  
  32.  
  33. /*INC*/
  34.  
  35. //
  36. // The ip_option_information structure describes the options to be
  37. // included in the header of an IP packet. The TTL, TOS, and Flags
  38. // values are carried in specific fields in the header. The OptionsData
  39. // bytes are carried in the options area following the standard IP header.
  40. // With the exception of source route options, this data must be in the
  41. // format to be transmitted on the wire as specified in RFC 791. A source
  42. // route option should contain the full route - first hop thru final
  43. // destination - in the route data. The first hop will be pulled out of the
  44. // data and the option will be reformatted accordingly. Otherwise, the route
  45. // option should be formatted as specified in RFC 791.
  46. //
  47. struct ip_option_information {
  48.     unsigned char      Ttl;             // Time To Live
  49.     unsigned char      Tos;             // Type Of Service
  50.     unsigned char      Flags;           // IP header flags
  51.     unsigned char      OptionsSize;     // Size in bytes of options data
  52.     unsigned char FAR *OptionsData;     // Pointer to options data
  53. }; /* ip_option_information */
  54.  
  55. //
  56. // The icmp_echo_reply structure describes the data returned in response
  57. // to an echo request.
  58. //
  59. struct icmp_echo_reply {
  60.     IPAddr                         Address;         // Replying address
  61.     unsigned long                  Status;          // Reply IP_STATUS
  62.     unsigned long                  RoundTripTime;   // RTT in milliseconds
  63.     unsigned short                 DataSize;        // Reply data size in bytes
  64.     unsigned short                 Reserved;        // Reserved for system use
  65.     void FAR                      *Data;            // Pointer to the reply data
  66.     struct ip_option_information   Options;         // Reply options
  67. }; /* icmp_echo_reply */
  68.  
  69.  
  70. /*NOINC*/
  71.  
  72. typedef struct ip_option_information IP_OPTION_INFORMATION,
  73.                                      FAR *PIP_OPTION_INFORMATION;
  74.  
  75. typedef struct icmp_echo_reply ICMP_ECHO_REPLY,
  76.                                FAR *PICMP_ECHO_REPLY;
  77.  
  78. /*INC*/
  79.  
  80.  
  81.  
  82. struct ArpRequestBuffer {
  83.    IPAddr DestAddress;
  84.    IPAddr SrcAddress;
  85. }; /* ArpRequestBuffer */
  86.  
  87. /*NOINC*/
  88.  
  89. typedef struct ArpRequestBuffer ARP_SEND_REPLY,
  90.                                FAR *PARP_SEND_REPLY;
  91.  
  92. typedef struct _TCP_RESERVE_PORT_RANGE
  93. {
  94.  
  95.    USHORT  UpperRange;
  96.    USHORT  LowerRange;
  97. }TCP_RESERVE_PORT_RANGE, *PTCP_RESERVE_PORT_RANGE;
  98.  
  99. #define MAX_ADAPTER_NAME 128
  100.  
  101. typedef struct _IP_ADAPTER_INDEX_MAP
  102. {
  103.    ULONG Index;
  104.    WCHAR  Name[MAX_ADAPTER_NAME];
  105. }IP_ADAPTER_INDEX_MAP, *PIP_ADAPTER_INDEX_MAP;
  106.  
  107. typedef struct _IP_INTERFACE_INFO
  108. {
  109.      LONG    NumAdapters;
  110.      IP_ADAPTER_INDEX_MAP Adapter[1];
  111. } IP_INTERFACE_INFO,*PIP_INTERFACE_INFO;
  112.  
  113. typedef struct _IP_UNIDIRECTIONAL_ADAPTER_ADDRESS
  114. {
  115.      ULONG    NumAdapters;
  116.      IPAddr  Address[1];
  117. } IP_UNIDIRECTIONAL_ADAPTER_ADDRESS, *PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
  118.  
  119. typedef struct _IP_ADAPTER_ORDER_MAP
  120. {
  121.     ULONG NumAdapters;
  122.     ULONG AdapterOrder[1];
  123. } IP_ADAPTER_ORDER_MAP, *PIP_ADAPTER_ORDER_MAP;
  124.  
  125. //
  126. // IP_STATUS codes returned from IP APIs
  127. //
  128.  
  129. #define IP_STATUS_BASE              11000
  130.  
  131. #define IP_SUCCESS                  0
  132. #define IP_BUF_TOO_SMALL            (IP_STATUS_BASE + 1)
  133. #define IP_DEST_NET_UNREACHABLE     (IP_STATUS_BASE + 2)
  134. #define IP_DEST_HOST_UNREACHABLE    (IP_STATUS_BASE + 3)
  135. #define IP_DEST_PROT_UNREACHABLE    (IP_STATUS_BASE + 4)
  136. #define IP_DEST_PORT_UNREACHABLE    (IP_STATUS_BASE + 5)
  137. #define IP_NO_RESOURCES             (IP_STATUS_BASE + 6)
  138. #define IP_BAD_OPTION               (IP_STATUS_BASE + 7)
  139. #define IP_HW_ERROR                 (IP_STATUS_BASE + 8)
  140. #define IP_PACKET_TOO_BIG           (IP_STATUS_BASE + 9)
  141. #define IP_REQ_TIMED_OUT            (IP_STATUS_BASE + 10)
  142. #define IP_BAD_REQ                  (IP_STATUS_BASE + 11)
  143. #define IP_BAD_ROUTE                (IP_STATUS_BASE + 12)
  144. #define IP_TTL_EXPIRED_TRANSIT      (IP_STATUS_BASE + 13)
  145. #define IP_TTL_EXPIRED_REASSEM      (IP_STATUS_BASE + 14)
  146. #define IP_PARAM_PROBLEM            (IP_STATUS_BASE + 15)
  147. #define IP_SOURCE_QUENCH            (IP_STATUS_BASE + 16)
  148. #define IP_OPTION_TOO_BIG           (IP_STATUS_BASE + 17)
  149. #define IP_BAD_DESTINATION          (IP_STATUS_BASE + 18)
  150.  
  151.  
  152. //
  153. // The next group are status codes passed up on status indications to
  154. // transport layer protocols.
  155. //
  156. #define IP_ADDR_DELETED             (IP_STATUS_BASE + 19)
  157. #define IP_SPEC_MTU_CHANGE          (IP_STATUS_BASE + 20)
  158. #define IP_MTU_CHANGE               (IP_STATUS_BASE + 21)
  159. #define IP_UNLOAD                   (IP_STATUS_BASE + 22)
  160. #define IP_ADDR_ADDED               (IP_STATUS_BASE + 23)
  161. #define IP_MEDIA_CONNECT            (IP_STATUS_BASE + 24)
  162. #define IP_MEDIA_DISCONNECT         (IP_STATUS_BASE + 25)
  163. #define IP_BIND_ADAPTER             (IP_STATUS_BASE + 26)
  164. #define IP_UNBIND_ADAPTER           (IP_STATUS_BASE + 27)
  165. #define IP_DEVICE_DOES_NOT_EXIST    (IP_STATUS_BASE + 28)
  166. #define IP_DUPLICATE_ADDRESS        (IP_STATUS_BASE + 29)
  167. #define IP_INTERFACE_METRIC_CHANGE  (IP_STATUS_BASE + 30)
  168. #define IP_RECONFIG_SECFLTR         (IP_STATUS_BASE + 31)
  169. #define IP_NEGOTIATING_IPSEC        (IP_STATUS_BASE + 32)
  170. #define IP_INTERFACE_WOL_CAPABILITY_CHANGE  (IP_STATUS_BASE + 33)
  171. #define IP_DUPLICATE_IPADD          (IP_STATUS_BASE + 34)
  172.  
  173. #define IP_GENERAL_FAILURE          (IP_STATUS_BASE + 50)
  174. #define MAX_IP_STATUS               IP_GENERAL_FAILURE
  175. #define IP_PENDING                  (IP_STATUS_BASE + 255)
  176.  
  177.  
  178. //
  179. // Values used in the IP header Flags field.
  180. //
  181. #define IP_FLAG_DF      0x2         // Don't fragment this packet.
  182.  
  183. //
  184. // Supported IP Option Types.
  185. //
  186. // These types define the options which may be used in the OptionsData field
  187. // of the ip_option_information structure.  See RFC 791 for a complete
  188. // description of each.
  189. //
  190. #define IP_OPT_EOL      0          // End of list option
  191. #define IP_OPT_NOP      1          // No operation
  192. #define IP_OPT_SECURITY 0x82       // Security option
  193. #define IP_OPT_LSRR     0x83       // Loose source route
  194. #define IP_OPT_SSRR     0x89       // Strict source route
  195. #define IP_OPT_RR       0x7        // Record route
  196. #define IP_OPT_TS       0x44       // Timestamp
  197. #define IP_OPT_SID      0x88       // Stream ID (obsolete)
  198. #define IP_OPT_ROUTER_ALERT 0x94  // Router Alert Option
  199.  
  200. #define MAX_OPT_SIZE    40         // Maximum length of IP options in bytes
  201.  
  202. #ifdef CHICAGO
  203.  
  204. // Ioctls code exposed by Memphis tcpip stack.
  205. // For NT these ioctls are define in ntddip.h  (private\inc)
  206.  
  207. #define IOCTL_IP_RTCHANGE_NOTIFY_REQUEST   101
  208. #define IOCTL_IP_ADDCHANGE_NOTIFY_REQUEST  102
  209. #define IOCTL_ARP_SEND_REQUEST             103
  210. #define IOCTL_IP_INTERFACE_INFO            104
  211. #define IOCTL_IP_GET_BEST_INTERFACE        105
  212. #define IOCTL_IP_UNIDIRECTIONAL_ADAPTER_ADDRESS        106
  213.  
  214. #endif
  215.  
  216.  
  217. #pragma option pop /*P_O_Pop*/
  218. #endif // IP_EXPORT_INCLUDED
  219.  
  220.