Main Page | Class List | File List | Class Members | File Members

ip.h

Go to the documentation of this file.
00001 /* 00002 * INET An implementation of the TCP/IP protocol suite for the LINUX 00003 * operating system. INET is implemented using the BSD Socket 00004 * interface as the means of communication with the user level. 00005 * 00006 * Definitions for the IP protocol. 00007 * 00008 * Version: @(#)ip.h 1.0.2 04/28/93 00009 * 00010 * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 00011 * 00012 * This program is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU General Public License 00014 * as published by the Free Software Foundation; either version 00015 * 2 of the License, or (at your option) any later version. 00016 */ 00017 #ifndef _LINUX_IP_H 00018 #define _LINUX_IP_H 00019 #include <asm/byteorder.h> 00020 00021 /* SOL_IP socket options */ 00022 00023 #define IPTOS_TOS_MASK 0x1E 00024 #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) 00025 #define IPTOS_LOWDELAY 0x10 00026 #define IPTOS_THROUGHPUT 0x08 00027 #define IPTOS_RELIABILITY 0x04 00028 #define IPTOS_MINCOST 0x02 00029 00030 #define IPTOS_PREC_MASK 0xE0 00031 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) 00032 #define IPTOS_PREC_NETCONTROL 0xe0 00033 #define IPTOS_PREC_INTERNETCONTROL 0xc0 00034 #define IPTOS_PREC_CRITIC_ECP 0xa0 00035 #define IPTOS_PREC_FLASHOVERRIDE 0x80 00036 #define IPTOS_PREC_FLASH 0x60 00037 #define IPTOS_PREC_IMMEDIATE 0x40 00038 #define IPTOS_PREC_PRIORITY 0x20 00039 #define IPTOS_PREC_ROUTINE 0x00 00040 00041 00042 /* IP options */ 00043 #define IPOPT_COPY 0x80 00044 #define IPOPT_CLASS_MASK 0x60 00045 #define IPOPT_NUMBER_MASK 0x1f 00046 00047 #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) 00048 #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) 00049 #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) 00050 00051 #define IPOPT_CONTROL 0x00 00052 #define IPOPT_RESERVED1 0x20 00053 #define IPOPT_MEASUREMENT 0x40 00054 #define IPOPT_RESERVED2 0x60 00055 00056 #define IPOPT_END (0 |IPOPT_CONTROL) 00057 #define IPOPT_NOOP (1 |IPOPT_CONTROL) 00058 #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) 00059 #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) 00060 #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) 00061 #define IPOPT_RR (7 |IPOPT_CONTROL) 00062 #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) 00063 #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) 00064 #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) 00065 00066 #define IPVERSION 4 00067 #define MAXTTL 255 00068 #define IPDEFTTL 64 00069 00070 /* struct timestamp, struct route and MAX_ROUTES are removed. 00071 00072 REASONS: it is clear that nobody used them because: 00073 - MAX_ROUTES value was wrong. 00074 - "struct route" was wrong. 00075 - "struct timestamp" had fatally misaligned bitfields and was completely unusable. 00076 */ 00077 00078 #define IPOPT_OPTVAL 0 00079 #define IPOPT_OLEN 1 00080 #define IPOPT_OFFSET 2 00081 #define IPOPT_MINOFF 4 00082 #define MAX_IPOPTLEN 40 00083 #define IPOPT_NOP IPOPT_NOOP 00084 #define IPOPT_EOL IPOPT_END 00085 #define IPOPT_TS IPOPT_TIMESTAMP 00086 00087 #define IPOPT_TS_TSONLY 0 /* timestamps only */ 00088 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 00089 #define IPOPT_TS_PRESPEC 3 /* specified modules only */ 00090 00091 #ifdef __KERNEL__ 00092 00093 struct ip_options { 00094 __u32 faddr; /* Saved first hop address */ 00095 unsigned char optlen; 00096 unsigned char srr; 00097 unsigned char rr; 00098 unsigned char ts; 00099 unsigned char is_setbyuser:1, /* Set by setsockopt? */ 00100 is_data:1, /* Options in __data, rather than skb */ 00101 is_strictroute:1, /* Strict source route */ 00102 srr_is_hit:1, /* Packet destination addr was our one */ 00103 is_changed:1, /* IP checksum more not valid */ 00104 rr_needaddr:1, /* Need to record addr of outgoing dev */ 00105 ts_needtime:1, /* Need to record timestamp */ 00106 ts_needaddr:1; /* Need to record addr of outgoing dev */ 00107 unsigned char router_alert; 00108 unsigned char __pad1; 00109 unsigned char __pad2; 00110 unsigned char __data[0]; 00111 }; 00112 00113 #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) 00114 #endif 00115 00116 struct iphdr { 00117 #if defined(__LITTLE_ENDIAN_BITFIELD) 00118 __u8 ihl:4, 00119 version:4; 00120 #elif defined (__BIG_ENDIAN_BITFIELD) 00121 __u8 version:4, 00122 ihl:4; 00123 #else 00124 #error "Please fix <asm/byteorder.h>" 00125 #endif 00126 __u8 tos; 00127 __u16 tot_len; 00128 __u16 id; 00129 __u16 frag_off; 00130 __u8 ttl; 00131 __u8 protocol; 00132 __u16 check; 00133 __u32 saddr; 00134 __u32 daddr; 00135 /*The options start here. */ 00136 }; 00137 00138 #endif /* _LINUX_IP_H */

Generated on Wed Dec 1 21:25:30 2004 for Linux 2.4.23 Networking by doxygen 1.3.8