1#ifndef __NETINET_IP_H 2#define __NETINET_IP_H 1 3 4#include <glibc-bugs.h> 5#include <netinet/in.h> 6 7#include <linux/ip.h> 8 9#ifdef __USE_BSD 10/* 11 * Copyright (c) 1982, 1986, 1993 12 * The Regents of the University of California. All rights reserved. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions 16 * are met: 17 * 1. Redistributions of source code must retain the above copyright 18 * notice, this list of conditions and the following disclaimer. 19 * 2. Redistributions in binary form must reproduce the above copyright 20 * notice, this list of conditions and the following disclaimer in the 21 * documentation and/or other materials provided with the distribution. 22 * 3. All advertising materials mentioning features or use of this software 23 * must display the following acknowledgement: 24 * This product includes software developed by the University of 25 * California, Berkeley and its contributors. 26 * 4. Neither the name of the University nor the names of its contributors 27 * may be used to endorse or promote products derived from this software 28 * without specific prior written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 36 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 40 * SUCH DAMAGE. 41 * 42 * @(#)ip.h 8.1 (Berkeley) 6/10/93 43 */ 44 45/* 46 * Definitions for internet protocol version 4. 47 * Per RFC 791, September 1981. 48 */ 49 50/* 51 * Structure of an internet header, naked of options. 52 */ 53struct ip 54 { 55#if __BYTE_ORDER == __LITTLE_ENDIAN 56 u_int8_t ip_hl:4; /* header length */ 57 u_int8_t ip_v:4; /* version */ 58#endif 59#if __BYTE_ORDER == __BIG_ENDIAN 60 u_int8_t ip_v:4; /* version */ 61 u_int8_t ip_hl:4; /* header length */ 62#endif 63 u_int8_t ip_tos; /* type of service */ 64 u_short ip_len; /* total length */ 65 u_short ip_id; /* identification */ 66 u_short ip_off; /* fragment offset field */ 67#define IP_RF 0x8000 /* reserved fragment flag */ 68#define IP_DF 0x4000 /* dont fragment flag */ 69#define IP_MF 0x2000 /* more fragments flag */ 70#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ 71 u_int8_t ip_ttl; /* time to live */ 72 u_int8_t ip_p; /* protocol */ 73 u_short ip_sum; /* checksum */ 74 struct in_addr ip_src, ip_dst; /* source and dest address */ 75 }; 76 77/* 78 * Time stamp option structure. 79 */ 80struct ip_timestamp 81 { 82 u_int8_t ipt_code; /* IPOPT_TS */ 83 u_int8_t ipt_len; /* size of structure (variable) */ 84 u_int8_t ipt_ptr; /* index of current entry */ 85#if __BYTE_ORDER == __LITTLE_ENDIAN 86 u_int8_t ipt_flg:4; /* flags, see below */ 87 u_int8_t ipt_oflw:4; /* overflow counter */ 88#endif 89#if __BYTE_ORDER == __BIG_ENDIAN 90 u_int8_t ipt_oflw:4; /* overflow counter */ 91 u_int8_t ipt_flg:4; /* flags, see below */ 92#endif 93 u_int32_t data[9]; 94 }; 95#endif /* __USE_BSD */ 96 97 98#endif /* netinet/ip.h */ 99