home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / PPPBCKP / SRC15B23.ZIP / WATTSRC.ZIP / INCLUDE / ICMP.H < prev    next >
Text File  |  1994-05-28  |  2KB  |  102 lines

  1.  
  2. #ifndef _wattcp_icmp_h
  3. #define _wattcp_icmp_h
  4.  
  5. //#include <wattcp/wattcp.h>
  6. #include <wattcp.h>
  7.  
  8. typedef struct icmp_unused {
  9.     byte     type;
  10.     byte    code;
  11.     word    checksum;
  12.     longword    unused;
  13.     in_Header    ip;
  14.     byte    spares[ 8 ];
  15. };
  16.  
  17. typedef struct icmp_pointer {
  18.     byte    type;
  19.     byte    code;
  20.     word    checksum;
  21.     byte    pointer;
  22.     byte    unused[ 3 ];
  23.     in_Header    ip;
  24. };
  25. typedef struct icmp_ip {
  26.     byte    type;
  27.     byte    code;
  28.     word    checksum;
  29.     longword    ipaddr;
  30.     in_Header    ip;
  31. };
  32. typedef struct icmp_echo {
  33.     byte    type;
  34.     byte    code;
  35.     word    checksum;
  36.     word    identifier;
  37.     word    sequence;
  38.     longword index;
  39. };
  40.  
  41. typedef struct icmp_timestamp {
  42.     byte    type;
  43.     byte    code;
  44.     word    checksum;
  45.     word    identifier;
  46.     word    sequence;
  47.     longword    original;    /* original timestamp */
  48.     longword    receive;    /* receive timestamp */
  49.     longword    transmit;    /* transmit timestamp */
  50. };
  51.  
  52. typedef struct icmp_info {
  53.     byte    type;
  54.     byte    code;
  55.     word    checksum;
  56.     word    identifier;
  57.     word    sequence;
  58. };
  59.  
  60. typedef union  {
  61.     struct icmp_unused    unused;
  62.     struct icmp_pointer    pointer;
  63.     struct icmp_ip        ip;
  64.     struct icmp_echo    echo;
  65.     struct icmp_timestamp    timestamp;
  66.     struct icmp_info    info;
  67. } icmp_pkt;
  68.  
  69. typedef struct _pkt {
  70.     in_Header     in;
  71.     icmp_pkt     icmp;
  72.     in_Header    data;
  73. };
  74.  
  75. #define ICMPTYPE_ECHOREPLY       0
  76. #define ICMPTYPE_UNREACHABLE     3
  77. #define ICMPTYPE_TIMEEXCEEDED    11
  78.  
  79. typedef enum ICMP_UnreachableCodes
  80. {
  81.    ICMP_UNREACH_NET = 0,
  82.    ICMP_UNREACH_HOST = 1,
  83.    ICMP_UNREACH_PROTO = 2,
  84.    ICMP_UNREACH_PORT = 3,
  85.    ICMP_UNREACH_FRAGNEEDED = 4,
  86.    ICMP_UNREACH_SRCROUTEFAILED = 5
  87. };
  88.  
  89. typedef enum ICMP_TimeExceededCodes
  90. {
  91.    ICMP_EXCEEDED_TTL = 0,
  92.    ICMP_EXCEEDED_FRAGREASM = 1
  93. };
  94.  
  95. /* a user-installed ICMP handler */
  96. typedef int (*icmp_handler_type)( in_Header *ip );
  97.  
  98. /* install a user ICMP handler, or NULL to disable */
  99. void set_icmp_handler( icmp_handler_type user_handler );
  100.  
  101. #endif /* ndef _wattcp_icmp_h */
  102.