home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff225.lzh / AmigaTCP / src / ip.h < prev    next >
C/C++ Source or Header  |  1989-06-24  |  3KB  |  94 lines

  1. #define    NROUTE    5    /* Number of hash chains in routing table */
  2.  
  3. extern int32 ip_addr;    /* Our IP address for ICMP and source routing */
  4.  
  5. extern char ip_ttl;    /* Default time-to-live for IP datagrams */
  6.  
  7. struct ip_header {
  8.     char v_ihl;        /* Version + IP header length */
  9. #define    IPVERSION    4
  10.     char tos;        /* Type of service */
  11.     int16 length;        /* Total length */
  12.     int16 id;        /* Identification */
  13.     int16 fl_offs;        /* Flags + fragment offset */
  14.  
  15. #define    F_OFFSET    0x1fff    /* Offset field */
  16. #define    DF    0x4000        /* Don't fragment flag */
  17. #define    MF    0x2000        /* More Fragments flag */    
  18.  
  19.     char ttl;        /* Time to live */
  20.     char protocol;        /* Protocol */
  21.     int16 checksum;        /* Header checksum */
  22.     int32 source;        /* Source address */
  23.     int32 dest;        /* Destination address */
  24. };
  25.  
  26. /* Fields in option type byte */
  27. #define    OPT_COPIED    0x80    /* Copied-on-fragmentation flag */
  28. #define    OPT_CLASS    0x60    /* Option class */
  29. #define    OPT_NUMBER    0x1f    /* Option number */
  30.  
  31. /* IP option numbers */
  32. #define    IP_EOL        0    /* End of options list */
  33. #define    IP_NOOP        1    /* No Operation */
  34. #define    IP_SECURITY    2    /* Security parameters */
  35. #define    IP_LSROUTE    3    /* Loose Source Routing */
  36. #define    IP_TIMESTAMP    4    /* Internet Timestamp */
  37. #define    IP_RROUTE    7    /* Record Route */
  38. #define    IP_STREAMID    8    /* Stream ID */
  39. #define    IP_SSROUTE    9    /* Strict Source Routing */
  40.  
  41. /* Timestamp option flags */
  42. #define    TS_ONLY        0    /* Time stamps only */
  43. #define    TS_ADDRESS    1    /* Addresses + Time stamps */
  44. #define    TS_PRESPEC    3    /* Prespecified addresses only */
  45.  
  46. /* IP routing table entry */
  47. struct route {
  48.     struct route *prev;    /* Linked list pointers */
  49.     struct route *next;
  50.     int32 target;        /* Target IP address */
  51.     int32 gateway;        /* IP address of local gateway for this target */
  52.     int metric;        /* Hop count, whatever */
  53.     struct interface *interface;    /* Device interface structure */
  54. };
  55. #define    NULLROUTE    (struct route *)NULL
  56.  
  57. /* Reassembly descriptor */
  58. struct reasm {
  59.     struct reasm *next;    /* Linked list pointers */
  60.     struct reasm *prev;
  61.     int32 source;        /* These four fields uniquely describe a datagram */
  62.     int32 dest;
  63.     int16 id;
  64.     char protocol;
  65.     int16 length;        /* Entire datagram length, if known */
  66.     struct timer timer;    /* Reassembly timeout timer */
  67.     struct frag *fraglist;    /* Head of data fragment chain */
  68. };
  69. #define    NULLREASM    (struct reasm *)NULL
  70.  
  71. /* Fragment descriptor in a reassembly list */
  72. struct frag {
  73.     struct frag *prev;    /* Previous fragment on list */
  74.     struct frag *next;    /* Next fragment */
  75.     struct mbuf *buf;    /* Actual fragment data */
  76.     int16 offset;        /* Starting offset of fragment */
  77.     int16 last;        /* Ending offset of fragment */
  78. };
  79. #define    NULLFRAG    (struct frag *)NULL
  80.  
  81. extern struct reasm *reasmq;    /* The list of reassembly descriptors */
  82.  
  83. /* IP error logging counters */
  84. struct ip_stats {
  85.     long total;        /* Total packets received */
  86.     unsigned runt;        /* Smaller than minimum size */
  87.     unsigned length;    /* IP header length field too small */
  88.     unsigned version;    /* Wrong IP version */
  89.     unsigned checksum;    /* IP header checksum errors */
  90.     unsigned badproto;    /* Unsupported protocol */
  91. };
  92. extern struct ip_stats ip_stats;
  93. void ip_dump();
  94.