ROHC compression/decompression library
ipv4.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991-1993,1995-2000,2009,2010 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /**
00020  * @file   ipv4.h
00021  * @brief  Defines the IPv4 header
00022  * @author Free Software Foundation, Inc
00023  *
00024  * This file contains a part of netinet/ip.h from the GNU C library. It is
00025  * copied here to be portable on all platforms, even the platforms that miss
00026  * the declarations or got different declarations, such as Microsoft Windows
00027  * or FreeBSD.
00028  */
00029 
00030 #ifndef ROHC_PROTOCOLS_IPV4_H
00031 #define ROHC_PROTOCOLS_IPV4_H
00032 
00033 #include <stdint.h>
00034 
00035 #include "config.h" /* for WORDS_BIGENDIAN */
00036 
00037 
00038 /**
00039  * @brief The IPv4 header
00040  */
00041 struct ipv4_hdr
00042 {
00043 #if WORDS_BIGENDIAN == 1
00044         unsigned int version:4;
00045         unsigned int ihl:4;
00046 #else
00047         unsigned int ihl:4;
00048         unsigned int version:4;
00049 #endif
00050         uint8_t tos;
00051         uint16_t tot_len;
00052         uint16_t id;
00053         uint16_t frag_off;
00054 #define IP_RF 0x8000                    /* reserved fragment flag */
00055 #define IP_DF 0x4000                    /* dont fragment flag */
00056 #define IP_MF 0x2000                    /* more fragments flag */
00057 #define IP_OFFMASK 0x1fff               /* mask for fragmenting bits */
00058         uint8_t ttl;
00059         uint8_t protocol;
00060         uint16_t check;
00061         uint32_t saddr;
00062         uint32_t daddr;
00063         /* The options start here. */
00064 };
00065 
00066 #endif