ROHC compression/decompression library
protocols/ip.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Didier Barvaux
3  *
4  * This 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  * This 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 this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /**
20  * @file protocols/ip.h
21  * @brief Defines the common IPv4/v6 header
22  * @author Didier Barvaux <didier@barvaux.org>
23  */
24 
25 #ifndef ROHC_PROTOCOLS_IP_H
26 #define ROHC_PROTOCOLS_IP_H
27 
28 #include <stdint.h>
29 
30 #ifdef __KERNEL__
31 # include <endian.h>
32 #else
33 # include "config.h" /* for WORDS_BIGENDIAN */
34 #endif
35 
36 
37 /** The common IPv4/v6 header */
38 struct ip_hdr
39 {
40 #if WORDS_BIGENDIAN == 1
41  uint8_t version:4; /**< The IP version */
42  uint8_t reserved:4; /**< That field depends on IP version */
43 #else
44  uint8_t reserved:4;
45  uint8_t version:4;
46 #endif
47 } __attribute__((packed));
48 
49 
50 #endif
51 
uint8_t version
Definition: protocols/ip.h:45
uint8_t reserved
Definition: protocols/ip.h:44
Definition: protocols/ip.h:38