ip.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: <waltje@uWalt.NL.Mugnet.ORG>
011: 
012: 
013: 
014: 
015: 
016: 
017: #ifndef _LINUX_IP_H
018: #define _LINUX_IP_H
019: #include <linux/types.h>
020: #include <asm/byteorder.h>
021: 
022: #define IPTOS_TOS_MASK          0x1E
023: #define IPTOS_TOS(tos)          ((tos)&IPTOS_TOS_MASK)
024: #define IPTOS_LOWDELAY          0x10
025: #define IPTOS_THROUGHPUT        0x08
026: #define IPTOS_RELIABILITY       0x04
027: #define IPTOS_MINCOST           0x02
028: 
029: #define IPTOS_PREC_MASK         0xE0
030: #define IPTOS_PREC(tos)         ((tos)&IPTOS_PREC_MASK)
031: #define IPTOS_PREC_NETCONTROL           0xe0
032: #define IPTOS_PREC_INTERNETCONTROL      0xc0
033: #define IPTOS_PREC_CRITIC_ECP           0xa0
034: #define IPTOS_PREC_FLASHOVERRIDE        0x80
035: #define IPTOS_PREC_FLASH                0x60
036: #define IPTOS_PREC_IMMEDIATE            0x40
037: #define IPTOS_PREC_PRIORITY             0x20
038: #define IPTOS_PREC_ROUTINE              0x00
039: 
040: 
041: 
042: #define IPOPT_COPY              0x80
043: #define IPOPT_CLASS_MASK        0x60
044: #define IPOPT_NUMBER_MASK       0x1f
045: 
046: #define IPOPT_COPIED(o)         ((o)&IPOPT_COPY)
047: #define IPOPT_CLASS(o)          ((o)&IPOPT_CLASS_MASK)
048: #define IPOPT_NUMBER(o)         ((o)&IPOPT_NUMBER_MASK)
049: 
050: #define IPOPT_CONTROL           0x00
051: #define IPOPT_RESERVED1         0x20
052: #define IPOPT_MEASUREMENT       0x40
053: #define IPOPT_RESERVED2         0x60
054: 
055: #define IPOPT_END       (0 |IPOPT_CONTROL)
056: #define IPOPT_NOOP      (1 |IPOPT_CONTROL)
057: #define IPOPT_SEC       (2 |IPOPT_CONTROL|IPOPT_COPY)
058: #define IPOPT_LSRR      (3 |IPOPT_CONTROL|IPOPT_COPY)
059: #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
060: #define IPOPT_CIPSO     (6 |IPOPT_CONTROL|IPOPT_COPY)
061: #define IPOPT_RR        (7 |IPOPT_CONTROL)
062: #define IPOPT_SID       (8 |IPOPT_CONTROL|IPOPT_COPY)
063: #define IPOPT_SSRR      (9 |IPOPT_CONTROL|IPOPT_COPY)
064: #define IPOPT_RA        (20|IPOPT_CONTROL|IPOPT_COPY)
065: 
066: #define IPVERSION       4
067: #define MAXTTL          255
068: #define IPDEFTTL        64
069: 
070: #define IPOPT_OPTVAL 0
071: #define IPOPT_OLEN   1
072: #define IPOPT_OFFSET 2
073: #define IPOPT_MINOFF 4
074: #define MAX_IPOPTLEN 40
075: #define IPOPT_NOP IPOPT_NOOP
076: #define IPOPT_EOL IPOPT_END
077: #define IPOPT_TS  IPOPT_TIMESTAMP
078: 
079: #define IPOPT_TS_TSONLY         0               
080: #define IPOPT_TS_TSANDADDR      1               
081: #define IPOPT_TS_PRESPEC        3               
082: 
083: #define IPV4_BEET_PHMAXLEN 8
084: 
085: struct iphdr {
086: #if defined(__LITTLE_ENDIAN_BITFIELD)
087:         __u8    ihl:4,
088:                 version:4;
089: #elif defined (__BIG_ENDIAN_BITFIELD)
090:         __u8    version:4,
091:                 ihl:4;
092: #else
093: #error  "Please fix <asm/byteorder.h>"
094: #endif
095:         __u8    tos;
096:         __be16  tot_len;
097:         __be16  id;
098:         __be16  frag_off;
099:         __u8    ttl;
100:         __u8    protocol;
101:         __sum16 check;
102:         __be32  saddr;
103:         __be32  daddr;
104:         
105: };
106: 
107: 
108: struct ip_auth_hdr {
109:         __u8  nexthdr;
110:         __u8  hdrlen;           
111:         __be16 reserved;
112:         __be32 spi;
113:         __be32 seq_no;          
114:         __u8  auth_data[0];     
115: };
116: 
117: struct ip_esp_hdr {
118:         __be32 spi;
119:         __be32 seq_no;          
120:         __u8  enc_data[0];      
121: };
122: 
123: struct ip_comp_hdr {
124:         __u8 nexthdr;
125:         __u8 flags;
126:         __be16 cpi;
127: };
128: 
129: struct ip_beet_phdr {
130:         __u8 nexthdr;
131:         __u8 hdrlen;
132:         __u8 padlen;
133:         __u8 reserved;
134: };
135: 
136: #endif  
137: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved