~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/ip.h

Version: ~ [ linux-6.0 ] ~ [ linux-5.19.12 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.71 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.146 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.215 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.260 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.295 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.330 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * INET         An implementation of the TCP/IP protocol suite for the LINUX
  3  *              operating system.  INET is implemented using the  BSD Socket
  4  *              interface as the means of communication with the user level.
  5  *
  6  *              Definitions for the IP protocol.
  7  *
  8  * Version:     @(#)ip.h        1.0.2   04/28/93
  9  *
 10  * Authors:     Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
 11  *
 12  *              This program is free software; you can redistribute it and/or
 13  *              modify it under the terms of the GNU General Public License
 14  *              as published by the Free Software Foundation; either version
 15  *              2 of the License, or (at your option) any later version.
 16  */
 17 #ifndef _LINUX_IP_H
 18 #define _LINUX_IP_H
 19 #include <asm/byteorder.h>
 20 
 21 /* SOL_IP socket options */
 22 
 23 #define IPTOS_TOS_MASK          0x1E
 24 #define IPTOS_TOS(tos)          ((tos)&IPTOS_TOS_MASK)
 25 #define IPTOS_LOWDELAY          0x10
 26 #define IPTOS_THROUGHPUT        0x08
 27 #define IPTOS_RELIABILITY       0x04
 28 #define IPTOS_MINCOST           0x02
 29 
 30 #define IPTOS_PREC_MASK         0xE0
 31 #define IPTOS_PREC(tos)         ((tos)&IPTOS_PREC_MASK)
 32 #define IPTOS_PREC_NETCONTROL           0xe0
 33 #define IPTOS_PREC_INTERNETCONTROL      0xc0
 34 #define IPTOS_PREC_CRITIC_ECP           0xa0
 35 #define IPTOS_PREC_FLASHOVERRIDE        0x80
 36 #define IPTOS_PREC_FLASH                0x60
 37 #define IPTOS_PREC_IMMEDIATE            0x40
 38 #define IPTOS_PREC_PRIORITY             0x20
 39 #define IPTOS_PREC_ROUTINE              0x00
 40 
 41 
 42 /* IP options */
 43 #define IPOPT_COPY              0x80
 44 #define IPOPT_CLASS_MASK        0x60
 45 #define IPOPT_NUMBER_MASK       0x1f
 46 
 47 #define IPOPT_COPIED(o)         ((o)&IPOPT_COPY)
 48 #define IPOPT_CLASS(o)          ((o)&IPOPT_CLASS_MASK)
 49 #define IPOPT_NUMBER(o)         ((o)&IPOPT_NUMBER_MASK)
 50 
 51 #define IPOPT_CONTROL           0x00
 52 #define IPOPT_RESERVED1         0x20
 53 #define IPOPT_MEASUREMENT       0x40
 54 #define IPOPT_RESERVED2         0x60
 55 
 56 #define IPOPT_END       (0 |IPOPT_CONTROL)
 57 #define IPOPT_NOOP      (1 |IPOPT_CONTROL)
 58 #define IPOPT_SEC       (2 |IPOPT_CONTROL|IPOPT_COPY)
 59 #define IPOPT_LSRR      (3 |IPOPT_CONTROL|IPOPT_COPY)
 60 #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
 61 #define IPOPT_RR        (7 |IPOPT_CONTROL)
 62 #define IPOPT_SID       (8 |IPOPT_CONTROL|IPOPT_COPY)
 63 #define IPOPT_SSRR      (9 |IPOPT_CONTROL|IPOPT_COPY)
 64 #define IPOPT_RA        (20|IPOPT_CONTROL|IPOPT_COPY)
 65 
 66 #define IPVERSION       4
 67 #define MAXTTL          255
 68 #define IPDEFTTL        64
 69 
 70 /* struct timestamp, struct route and MAX_ROUTES are removed.
 71 
 72    REASONS: it is clear that nobody used them because:
 73    - MAX_ROUTES value was wrong.
 74    - "struct route" was wrong.
 75    - "struct timestamp" had fatally misaligned bitfields and was completely unusable.
 76  */
 77 
 78 #define IPOPT_OPTVAL 0
 79 #define IPOPT_OLEN   1
 80 #define IPOPT_OFFSET 2
 81 #define IPOPT_MINOFF 4
 82 #define MAX_IPOPTLEN 40
 83 #define IPOPT_NOP IPOPT_NOOP
 84 #define IPOPT_EOL IPOPT_END
 85 #define IPOPT_TS  IPOPT_TIMESTAMP
 86 
 87 #define IPOPT_TS_TSONLY         0               /* timestamps only */
 88 #define IPOPT_TS_TSANDADDR      1               /* timestamps and addresses */
 89 #define IPOPT_TS_PRESPEC        3               /* specified modules only */
 90 
 91 #ifdef __KERNEL__
 92 
 93 struct ip_options {
 94   __u32         faddr;                          /* Saved first hop address */
 95   unsigned char optlen;
 96   unsigned char srr;
 97   unsigned char rr;
 98   unsigned char ts;
 99   unsigned char is_setbyuser:1,                 /* Set by setsockopt?                   */
100                 is_data:1,                      /* Options in __data, rather than skb   */
101                 is_strictroute:1,               /* Strict source route                  */
102                 srr_is_hit:1,                   /* Packet destination addr was our one  */
103                 is_changed:1,                   /* IP checksum more not valid           */      
104                 rr_needaddr:1,                  /* Need to record addr of outgoing dev  */
105                 ts_needtime:1,                  /* Need to record timestamp             */
106                 ts_needaddr:1;                  /* Need to record addr of outgoing dev  */
107   unsigned char router_alert;
108   unsigned char __pad1;
109   unsigned char __pad2;
110   unsigned char __data[0];
111 };
112 
113 #define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
114 #endif
115 
116 struct iphdr {
117 #if defined(__LITTLE_ENDIAN_BITFIELD)
118         __u8    ihl:4,
119                 version:4;
120 #elif defined (__BIG_ENDIAN_BITFIELD)
121         __u8    version:4,
122                 ihl:4;
123 #else
124 #error  "Please fix <asm/byteorder.h>"
125 #endif
126         __u8    tos;
127         __u16   tot_len;
128         __u16   id;
129         __u16   frag_off;
130         __u8    ttl;
131         __u8    protocol;
132         __u16   check;
133         __u32   saddr;
134         __u32   daddr;
135         /*The options start here. */
136 };
137 
138 #endif  /* _LINUX_IP_H */
139 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp