ROHC compression/decompression library
comp/schemes/ip_ctxt.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012,2013,2014,2015,2016 Didier Barvaux
3  * Copyright 2013,2014,2018 Viveris Technologies
4  * Copyright 2012 WBX
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file src/comp/schemes/ip_ctxt.h
23  * @brief The compression context for IP headers
24  * @author FWX <rohc_team@dialine.fr>
25  * @author Didier Barvaux <didier@barvaux.org>
26  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
27  */
28 
29 #ifndef ROHC_COMP_SCHEMES_IP_CTXT_H
30 #define ROHC_COMP_SCHEMES_IP_CTXT_H
31 
32 #include "protocols/ip.h"
33 #include "protocols/tcp.h"
34 
35 
36 /**
37  * @brief Define the IPv6 generic option context
38  */
39 typedef struct __attribute__((packed)) ipv6_generic_option_context
40 {
41  size_t option_length;
42  uint8_t next_header;
43  uint8_t data[IPV6_OPT_CTXT_LEN_MAX];
44 
46 
47 
48 /**
49  * @brief Define the common IP header context to IPv4 and IPv6
50  */
51 typedef struct __attribute__((packed)) ipvx_context
52 {
53  uint8_t version:4;
54  uint8_t unused:4;
55 
56  union
57  {
58  struct
59  {
60  uint8_t dscp:6;
61  uint8_t ip_ecn_flags:2;
62  };
63  uint8_t tos_tc;
64  };
65 
66  uint8_t next_header;
67 
68  uint8_t ttl_hopl;
69 
70  uint8_t ip_id_behavior;
72 
74 
75 
76 /**
77  * @brief Define the IPv4 header context
78  */
79 typedef struct __attribute__((packed)) ipv4_context
80 {
81  uint8_t version:4;
82  uint8_t df:1;
83  uint8_t unused:3;
84 
85  union
86  {
87  struct
88  {
89  uint8_t dscp:6;
90  uint8_t ip_ecn_flags:2;
91  };
92  uint8_t tos;
93  };
94 
95  uint8_t protocol;
96 
97  uint8_t ttl;
98 
99  uint8_t ip_id_behavior;
101  uint16_t last_ip_id;
102 
103  uint32_t src_addr;
104  uint32_t dst_addr;
105 
107 
108 
109 /** The compression context for one IPv6 extension header */
110 typedef union
111 {
112  ipv6_generic_option_context_t generic; /**< IPv6 generic extension header */
113  /* TODO: GRE not yet supported */
114  /* TODO: MINE not yet supported */
115  /* TODO: AH not yet supported */
117 
118 
119 /**
120  * @brief Define the IPv6 header context
121  */
122 typedef struct __attribute__((packed)) ipv6_context
123 {
124  uint8_t version:4;
125  uint8_t unused:4;
126 
127  union
128  {
129  struct
130  {
131  uint8_t dscp:6;
132  uint8_t ip_ecn_flags:2;
133  };
134  uint8_t tc;
135  };
136 
137  uint8_t next_header;
138 
139  uint8_t hopl;
140 
141  uint8_t ip_id_behavior;
143 
144  uint32_t flow_label:20;
145 
146  uint32_t src_addr[4];
147  uint32_t dest_addr[4];
148 
150 
151 
152 /**
153  * @brief Define union of IP contexts
154  */
155 typedef struct
156 {
158  union
159  {
163  } ctxt;
164 
165  /* Context Replication */
167 
168  size_t opts_nr;
170 
171 } ip_context_t;
172 
173 #endif /* ROHC_COMP_SCHEMES_IP_CTXT_H */
174 
bool cr_ttl_hopl_present
Definition: comp/schemes/ip_ctxt.h:166
struct ipv6_context ipv6_context_t
Define the IPv6 header context.
uint8_t dscp
Definition: comp/schemes/ip_ctxt.h:60
uint8_t tos_tc
Definition: comp/schemes/ip_ctxt.h:63
Define the IPv6 generic option context.
Definition: comp/schemes/ip_ctxt.h:39
uint8_t dscp
Definition: comp/schemes/ip_ctxt.h:131
struct ipv4_context ipv4_context_t
Define the IPv4 header context.
uint8_t version
Definition: comp/schemes/ip_ctxt.h:124
uint8_t tc
Definition: comp/schemes/ip_ctxt.h:134
Define the IPv6 option context for Destination, Hop-by-Hop and Routing option.
Definition: decomp/schemes/ip_ctxt.h:40
uint8_t protocol
Definition: comp/schemes/ip_ctxt.h:95
uint8_t next_header
Definition: comp/schemes/ip_ctxt.h:66
uint8_t version
Definition: comp/schemes/ip_ctxt.h:53
uint8_t ip_ecn_flags
Definition: comp/schemes/ip_ctxt.h:61
uint8_t ip_ecn_flags
Definition: comp/schemes/ip_ctxt.h:132
ipv6_context_t v6
Definition: comp/schemes/ip_ctxt.h:162
Define the common IP header context to IPv4 and IPv6.
Definition: comp/schemes/ip_ctxt.h:51
uint8_t next_header
Definition: comp/schemes/ip_ctxt.h:137
uint8_t version
Definition: comp/schemes/ip_ctxt.h:81
ipvx_context_t vx
Definition: comp/schemes/ip_ctxt.h:160
Definition: comp/schemes/ip_ctxt.h:110
uint8_t ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:141
#define IPV6_OPT_CTXT_LEN_MAX
Definition: ipv6.h:154
ipv4_context_t v4
Definition: comp/schemes/ip_ctxt.h:161
size_t opts_nr
Definition: comp/schemes/ip_ctxt.h:168
Define the IPv6 header context.
Definition: comp/schemes/ip_ctxt.h:122
ip_version version
Definition: comp/schemes/ip_ctxt.h:157
uint8_t df
Definition: comp/schemes/ip_ctxt.h:82
uint8_t ttl
Definition: comp/schemes/ip_ctxt.h:97
uint32_t dst_addr
Definition: comp/schemes/ip_ctxt.h:104
Define the IPv4 header context.
Definition: comp/schemes/ip_ctxt.h:79
uint8_t tos
Definition: comp/schemes/ip_ctxt.h:92
#define ROHC_MAX_IP_EXT_HDRS
The maximum number of IP extension headers supported.
Definition: protocols/ip.h:58
uint8_t next_header
Definition: comp/schemes/ip_ctxt.h:42
uint8_t hopl
Definition: comp/schemes/ip_ctxt.h:139
uint8_t unused
Definition: comp/schemes/ip_ctxt.h:54
uint8_t dscp
Definition: comp/schemes/ip_ctxt.h:89
uint8_t unused
Definition: comp/schemes/ip_ctxt.h:83
struct ipv6_generic_option_context ipv6_generic_option_context_t
Define the IPv6 generic option context.
uint8_t unused
Definition: comp/schemes/ip_ctxt.h:125
uint32_t src_addr
Definition: comp/schemes/ip_ctxt.h:103
ip_version
IP version.
Definition: ip.h:49
uint8_t ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:70
uint8_t ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:99
Define union of IP contexts.
Definition: comp/schemes/ip_ctxt.h:155
uint8_t ttl_hopl
Definition: comp/schemes/ip_ctxt.h:68
Defines the common IPv4/v6 header.
uint8_t ip_ecn_flags
Definition: comp/schemes/ip_ctxt.h:90
uint32_t flow_label
Definition: comp/schemes/ip_ctxt.h:144
uint8_t last_ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:100
uint8_t last_ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:71
TCP header description.
uint8_t last_ip_id_behavior
Definition: comp/schemes/ip_ctxt.h:142
size_t option_length
Definition: comp/schemes/ip_ctxt.h:41
struct ipvx_context ipvx_context_t
Define the common IP header context to IPv4 and IPv6.
uint16_t last_ip_id
Definition: comp/schemes/ip_ctxt.h:101