Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/netinet/ip.h
$ cat -n /usr/include/netinet/ip.h 1 /* Copyright (C) 1991-2024 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16
. */ 17 18 #ifndef __NETINET_IP_H 19 #define __NETINET_IP_H 1 20 21 #include
22 #include
23 24 #include
25 26 __BEGIN_DECLS 27 28 struct timestamp 29 { 30 uint8_t len; 31 uint8_t ptr; 32 #if __BYTE_ORDER == __LITTLE_ENDIAN 33 unsigned int flags:4; 34 unsigned int overflow:4; 35 #elif __BYTE_ORDER == __BIG_ENDIAN 36 unsigned int overflow:4; 37 unsigned int flags:4; 38 #else 39 # error "Please fix
" 40 #endif 41 uint32_t data[9]; 42 }; 43 44 struct iphdr 45 { 46 #if __BYTE_ORDER == __LITTLE_ENDIAN 47 unsigned int ihl:4; 48 unsigned int version:4; 49 #elif __BYTE_ORDER == __BIG_ENDIAN 50 unsigned int version:4; 51 unsigned int ihl:4; 52 #else 53 # error "Please fix
" 54 #endif 55 uint8_t tos; 56 uint16_t tot_len; 57 uint16_t id; 58 uint16_t frag_off; 59 uint8_t ttl; 60 uint8_t protocol; 61 uint16_t check; 62 uint32_t saddr; 63 uint32_t daddr; 64 /*The options start here. */ 65 }; 66 67 #ifdef __USE_MISC 68 /* 69 * Copyright (c) 1982, 1986, 1993 70 * The Regents of the University of California. All rights reserved. 71 * 72 * Redistribution and use in source and binary forms, with or without 73 * modification, are permitted provided that the following conditions 74 * are met: 75 * 1. Redistributions of source code must retain the above copyright 76 * notice, this list of conditions and the following disclaimer. 77 * 2. Redistributions in binary form must reproduce the above copyright 78 * notice, this list of conditions and the following disclaimer in the 79 * documentation and/or other materials provided with the distribution. 80 * 4. Neither the name of the University nor the names of its contributors 81 * may be used to endorse or promote products derived from this software 82 * without specific prior written permission. 83 * 84 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 85 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 87 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 90 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 91 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 92 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 94 * SUCH DAMAGE. 95 * 96 * @(#)ip.h 8.1 (Berkeley) 6/10/93 97 */ 98 99 /* 100 * Definitions for internet protocol version 4. 101 * Per RFC 791, September 1981. 102 */ 103 104 /* 105 * Structure of an internet header, naked of options. 106 */ 107 struct ip 108 { 109 #if __BYTE_ORDER == __LITTLE_ENDIAN 110 unsigned int ip_hl:4; /* header length */ 111 unsigned int ip_v:4; /* version */ 112 #endif 113 #if __BYTE_ORDER == __BIG_ENDIAN 114 unsigned int ip_v:4; /* version */ 115 unsigned int ip_hl:4; /* header length */ 116 #endif 117 uint8_t ip_tos; /* type of service */ 118 unsigned short ip_len; /* total length */ 119 unsigned short ip_id; /* identification */ 120 unsigned short ip_off; /* fragment offset field */ 121 #define IP_RF 0x8000 /* reserved fragment flag */ 122 #define IP_DF 0x4000 /* dont fragment flag */ 123 #define IP_MF 0x2000 /* more fragments flag */ 124 #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ 125 uint8_t ip_ttl; /* time to live */ 126 uint8_t ip_p; /* protocol */ 127 unsigned short ip_sum; /* checksum */ 128 struct in_addr ip_src, ip_dst; /* source and dest address */ 129 }; 130 131 /* 132 * Time stamp option structure. 133 */ 134 struct ip_timestamp 135 { 136 uint8_t ipt_code; /* IPOPT_TS */ 137 uint8_t ipt_len; /* size of structure (variable) */ 138 uint8_t ipt_ptr; /* index of current entry */ 139 #if __BYTE_ORDER == __LITTLE_ENDIAN 140 unsigned int ipt_flg:4; /* flags, see below */ 141 unsigned int ipt_oflw:4; /* overflow counter */ 142 #endif 143 #if __BYTE_ORDER == __BIG_ENDIAN 144 unsigned int ipt_oflw:4; /* overflow counter */ 145 unsigned int ipt_flg:4; /* flags, see below */ 146 #endif 147 uint32_t data[9]; 148 }; 149 #endif /* __USE_MISC */ 150 151 #define IPVERSION 4 /* IP version number */ 152 #define IP_MAXPACKET 65535 /* maximum packet size */ 153 154 /* 155 * Definitions for Explicit Congestion Notification (ECN) 156 * 157 * Taken from RFC-3168, Section 5. 158 */ 159 160 #define IPTOS_ECN_MASK 0x03 161 #define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) 162 #define IPTOS_ECN_NOT_ECT 0x00 163 #define IPTOS_ECN_ECT1 0x01 164 #define IPTOS_ECN_ECT0 0x02 165 #define IPTOS_ECN_CE 0x03 166 167 /* 168 * Definitions for IP differentiated services code points (DSCP) 169 * 170 * Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3. 171 */ 172 173 #define IPTOS_DSCP_MASK 0xfc 174 #define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) 175 #define IPTOS_DSCP_AF11 0x28 176 #define IPTOS_DSCP_AF12 0x30 177 #define IPTOS_DSCP_AF13 0x38 178 #define IPTOS_DSCP_AF21 0x48 179 #define IPTOS_DSCP_AF22 0x50 180 #define IPTOS_DSCP_AF23 0x58 181 #define IPTOS_DSCP_AF31 0x68 182 #define IPTOS_DSCP_AF32 0x70 183 #define IPTOS_DSCP_AF33 0x78 184 #define IPTOS_DSCP_AF41 0x88 185 #define IPTOS_DSCP_AF42 0x90 186 #define IPTOS_DSCP_AF43 0x98 187 #define IPTOS_DSCP_EF 0xb8 188 189 /* 190 * Voice-Admit DSCP code point from RFC-5865, Section 4. 191 */ 192 #define IPTOS_DSCP_VA 0xb0 193 194 /* 195 * Lower-Effort Per-Hop Behavior DSCP code point from RFC-8622, Section 12. 196 */ 197 #define IPTOS_DSCP_LE 0x04 198 199 /* 200 * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume 201 * the old ToS Precedence values. 202 */ 203 204 #define IPTOS_CLASS_MASK 0xe0 205 #define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK) 206 #define IPTOS_CLASS_CS0 0x00 207 #define IPTOS_CLASS_CS1 0x20 208 #define IPTOS_CLASS_CS2 0x40 209 #define IPTOS_CLASS_CS3 0x60 210 #define IPTOS_CLASS_CS4 0x80 211 #define IPTOS_CLASS_CS5 0xa0 212 #define IPTOS_CLASS_CS6 0xc0 213 #define IPTOS_CLASS_CS7 0xe0 214 215 #define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0 216 217 /* 218 * Definitions for IP type of service (ip_tos) [deprecated; use DSCP 219 * and CS definitions above instead.] 220 */ 221 #define IPTOS_TOS_MASK 0x1E 222 #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) 223 #define IPTOS_LOWDELAY 0x10 224 #define IPTOS_THROUGHPUT 0x08 225 #define IPTOS_RELIABILITY 0x04 226 #define IPTOS_LOWCOST 0x02 227 #define IPTOS_MINCOST IPTOS_LOWCOST 228 229 /* 230 * Definitions for IP precedence (also in ip_tos) [also deprecated.] 231 */ 232 #define IPTOS_PREC_MASK IPTOS_CLASS_MASK 233 #define IPTOS_PREC(tos) IPTOS_CLASS(tos) 234 #define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7 235 #define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6 236 #define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5 237 #define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4 238 #define IPTOS_PREC_FLASH IPTOS_CLASS_CS3 239 #define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2 240 #define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1 241 #define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0 242 243 /* 244 * Definitions for options. 245 */ 246 #define IPOPT_COPY 0x80 247 #define IPOPT_CLASS_MASK 0x60 248 #define IPOPT_NUMBER_MASK 0x1f 249 250 #define IPOPT_COPIED(o) ((o) & IPOPT_COPY) 251 #define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK) 252 #define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK) 253 254 #define IPOPT_CONTROL 0x00 255 #define IPOPT_RESERVED1 0x20 256 #define IPOPT_DEBMEAS 0x40 257 #define IPOPT_MEASUREMENT IPOPT_DEBMEAS 258 #define IPOPT_RESERVED2 0x60 259 260 #define IPOPT_EOL 0 /* end of option list */ 261 #define IPOPT_END IPOPT_EOL 262 #define IPOPT_NOP 1 /* no operation */ 263 #define IPOPT_NOOP IPOPT_NOP 264 265 #define IPOPT_RR 7 /* record packet route */ 266 #define IPOPT_TS 68 /* timestamp */ 267 #define IPOPT_TIMESTAMP IPOPT_TS 268 #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ 269 #define IPOPT_SEC IPOPT_SECURITY 270 #define IPOPT_LSRR 131 /* loose source route */ 271 #define IPOPT_SATID 136 /* satnet id */ 272 #define IPOPT_SID IPOPT_SATID 273 #define IPOPT_SSRR 137 /* strict source route */ 274 #define IPOPT_RA 148 /* router alert */ 275 276 /* 277 * Offsets to fields in options other than EOL and NOP. 278 */ 279 #define IPOPT_OPTVAL 0 /* option ID */ 280 #define IPOPT_OLEN 1 /* option length */ 281 #define IPOPT_OFFSET 2 /* offset within option */ 282 #define IPOPT_MINOFF 4 /* min value of above */ 283 284 #define MAX_IPOPTLEN 40 285 286 /* flag bits for ipt_flg */ 287 #define IPOPT_TS_TSONLY 0 /* timestamps only */ 288 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 289 #define IPOPT_TS_PRESPEC 3 /* specified modules only */ 290 291 /* bits for security (not byte swapped) */ 292 #define IPOPT_SECUR_UNCLASS 0x0000 293 #define IPOPT_SECUR_CONFID 0xf135 294 #define IPOPT_SECUR_EFTO 0x789a 295 #define IPOPT_SECUR_MMMM 0xbc4d 296 #define IPOPT_SECUR_RESTR 0xaf13 297 #define IPOPT_SECUR_SECRET 0xd788 298 #define IPOPT_SECUR_TOPSECRET 0x6bc5 299 300 /* 301 * Internet implementation parameters. 302 */ 303 #define MAXTTL 255 /* maximum time to live (seconds) */ 304 #define IPDEFTTL 64 /* default ttl, from RFC 1340 */ 305 #define IPFRAGTTL 60 /* time to live for frags, slowhz */ 306 #define IPTTLDEC 1 /* subtracted when forwarding */ 307 308 #define IP_MSS 576 /* default maximum segment size */ 309 310 __END_DECLS 311 312 #endif /* netinet/ip.h */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™