Dr Andrew Scott G7VAV

My photo
 
May 2024
Mo Tu We Th Fr Sa Su
29 30 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2
3 4 5 6 7 8 9


ip.h
001: /*
002:  * INET         An implementation of the TCP/IP protocol suite for the LINUX
003:  *              operating system.  INET is implemented using the  BSD Socket
004:  *              interface as the means of communication with the user level.
005:  *
006:  *              Definitions for the IP protocol.
007:  *
008:  * Version:     @(#)ip.h        1.0.2   04/28/93
009:  *
010:  * Authors:     Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
011:  *
012:  *              This program is free software; you can redistribute it and/or
013:  *              modify it under the terms of the GNU General Public License
014:  *              as published by the Free Software Foundation; either version
015:  *              2 of the License, or (at your option) any later version.
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: /* IP options */
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               /* timestamps only */
080: #define IPOPT_TS_TSANDADDR      1               /* timestamps and addresses */
081: #define IPOPT_TS_PRESPEC        3               /* specified modules only */
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:         /*The options start here. */
105: };
106: 
107: 
108: struct ip_auth_hdr {
109:         __u8  nexthdr;
110:         __u8  hdrlen;           /* This one is measured in 32 bit units! */
111:         __be16 reserved;
112:         __be32 spi;
113:         __be32 seq_no;          /* Sequence number */
114:         __u8  auth_data[0];     /* Variable len but >=4. Mind the 64 bit alignment! */
115: };
116: 
117: struct ip_esp_hdr {
118:         __be32 spi;
119:         __be32 seq_no;          /* Sequence number */
120:         __u8  enc_data[0];      /* Variable len but >=8. Mind the 64 bit alignment! */
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  /* _LINUX_IP_H */
137: 


for client 18.222.193.207
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/