home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / NETTOOLS.ZIP / ipexport.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-12-15  |  5.7 KB  |  157 lines

  1. /********************************************************************/
  2. /**                     Microsoft LAN Manager                      **/
  3. /**               Copyright(c) Microsoft Corp., 1990-1992          **/
  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. #define IP_EXPORT_INCLUDED  1
  15.  
  16. /*NOINC*/
  17.  
  18. //
  19. // IP type definitions.
  20. //
  21. typedef unsigned long   IPAddr;     // An IP address.
  22. typedef unsigned long   IPMask;     // An IP subnet mask.
  23. typedef unsigned long   IP_STATUS;  // Status code returned from IP APIs.
  24. #define MAXHOSTNAME 128
  25. #define PING_NROUTES  9   // max hops for record route.
  26.  
  27.  
  28. /*INC*/
  29.  
  30. //
  31. // The ip_option_information structure describes the options to be
  32. // included in the header of an IP packet. The TTL, TOS, and Flags
  33. // values are carried in specific fields in the header. The OptionsData
  34. // bytes are carried in the options area following the standard IP header.
  35. // With the exception of source route options, this data must be in the
  36. // format to be transmitted on the wire as specified in RFC 791. A source
  37. // route option should contain the full route - first hop thru final
  38. // destination - in the route data. The first hop will be pulled out of the
  39. // data and the option will be reformatted accordingly. Otherwise, the route
  40. // option should be formatted as specified in RFC 791.
  41. //
  42.  
  43. struct ipopt_info {
  44.     unsigned char      Ttl;             // Time To Live
  45.     unsigned char      Tos;             // Type Of Service
  46.     unsigned char      Flags;           // IP header flags
  47.     unsigned char      OptionsSize;     // Size in bytes of options data
  48.     unsigned char FAR *OptionsData;     // Pointer to options data
  49. };
  50.  
  51. #define IPOPT_INFO_LEN sizeof(ipopt_info)
  52. //
  53. // The icmp_echo_reply structure describes the data returned in response
  54. // to an echo request.
  55. //
  56. struct icmp_reply {
  57.     IPAddr                         Address;         // Replying address
  58.     unsigned long                  Status;          // Reply IP_STATUS
  59.     unsigned long                  RoundTripTime;   // RTT in milliseconds
  60.     unsigned short                 DataSize;        // Reply data size in bytes
  61.     unsigned short                 Reserved;        // Reserved for system use
  62.     void FAR                      *Data;            // Pointer to the reply data
  63.     ipopt_info                     Options;         // Reply options
  64. };
  65.  
  66. #define ECHO_REPLY_LEN sizeof(icmp_reply) 
  67.  
  68.  
  69.  
  70.  
  71. /*NOINC*/
  72.  
  73.  
  74.  
  75. /*INC*/
  76.  
  77. //
  78. // IP_STATUS codes returned from IP APIs
  79. //
  80.  
  81. #define IP_STATUS_BASE              11000
  82.  
  83. #define IP_SUCCESS                  0
  84. #define IP_BUF_TOO_SMALL            (IP_STATUS_BASE + 1)
  85. #define IP_DEST_NET_UNREACHABLE     (IP_STATUS_BASE + 2)
  86. #define IP_DEST_HOST_UNREACHABLE    (IP_STATUS_BASE + 3)
  87. #define IP_DEST_PROT_UNREACHABLE    (IP_STATUS_BASE + 4)
  88. #define IP_DEST_PORT_UNREACHABLE    (IP_STATUS_BASE + 5)
  89. #define IP_NO_RESOURCES             (IP_STATUS_BASE + 6)
  90. #define IP_BAD_OPTION               (IP_STATUS_BASE + 7)
  91. #define IP_HW_ERROR                 (IP_STATUS_BASE + 8)
  92. #define IP_PACKET_TOO_BIG           (IP_STATUS_BASE + 9)
  93. #define IP_REQ_TIMED_OUT            (IP_STATUS_BASE + 10)
  94. #define IP_BAD_REQ                  (IP_STATUS_BASE + 11)
  95. #define IP_BAD_ROUTE                (IP_STATUS_BASE + 12)
  96. #define IP_TTL_EXPIRED_TRANSIT      (IP_STATUS_BASE + 13)
  97. #define IP_TTL_EXPIRED_REASSEM      (IP_STATUS_BASE + 14)
  98. #define IP_PARAM_PROBLEM            (IP_STATUS_BASE + 15)
  99. #define IP_SOURCE_QUENCH            (IP_STATUS_BASE + 16)
  100. #define IP_OPTION_TOO_BIG           (IP_STATUS_BASE + 17)
  101. #define IP_BAD_DESTINATION          (IP_STATUS_BASE + 18)
  102.  
  103.  
  104. //
  105. // The next group are status codes passed up on status indications to
  106. // transport layer protocols.
  107. //
  108. #define IP_ADDR_DELETED             (IP_STATUS_BASE + 19)
  109. #define IP_SPEC_MTU_CHANGE          (IP_STATUS_BASE + 20)
  110. #define IP_MTU_CHANGE               (IP_STATUS_BASE + 21)
  111. #define IP_UNLOAD                   (IP_STATUS_BASE + 22)
  112.  
  113. #define IP_GENERAL_FAILURE          (IP_STATUS_BASE + 50)
  114. #define MAX_IP_STATUS               IP_GENERAL_FAILURE
  115. #define IP_PENDING                  (IP_STATUS_BASE + 255)
  116.  
  117.  
  118. //
  119. // Values used in the IP header Flags field.
  120. //
  121. #define IP_FLAG_DF      0x2         // Don't fragment this packet.
  122.  
  123. //
  124. // Supported IP Option Types.
  125. //
  126. // These types define the options which may be used in the OptionsData field
  127. // of the ip_option_information structure.  See RFC 791 for a complete
  128. // description of each.
  129. //
  130. #define IP_OPT_EOL        0     // End of list option
  131. #define IP_OPT_NOP        1     // No operation
  132. #define IP_OPT_SECURITY   0x82  // Security option
  133. #define IP_OPT_LSRR       0x83  // Loose source route
  134. #define IP_OPT_SSRR       0x89  // Strict source route
  135. #define IP_OPT_RR         0x7   // Record route
  136. #define IP_OPT_TS         0x44  // Timestamp
  137. #define IP_OPT_TS_TSONLY  0     //return timestamps only
  138. #define IP_OPT_TS_REGADDR 1     //return ts and addrs
  139. #define IP_OPT_TS_ADDRSUP 3     //return ts for these addrs
  140. #define IP_OPT_SID        0x88  // Stream ID (obsolete)
  141.  
  142. #define MAX_OPT_SIZE    40         // Maximum length of IP options in bytes
  143. //
  144. // IPOPT vals for buiding parm area 
  145. //
  146. #define IPOPT_OPTVAL      0   // offset to options
  147. #define IPOPT_OLEN        1   // offset to opt len
  148. #define IPOPT_OFFSET      2   // offset to option offset
  149. #define IPOPT_MINOFF      4   // min offset val to data
  150. #define IPOPT_TSFLAGS     3   // offset to timestamp flgs
  151.  
  152.  
  153.  
  154.  
  155. #endif // IP_EXPORT_INCLUDED
  156.  
  157.