ROHC compression/decompression library
d_tcp_defines.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012,2013,2014 Didier Barvaux
3  * Copyright 2013,2014 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 d_tcp_defines.h
23  * @brief Main definitions for the TCP decompression profile
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_DECOMP_TCP_DEFINES_H
30 #define ROHC_DECOMP_TCP_DEFINES_H
31 
32 #include "ip.h"
33 #include "interval.h"
34 #include "protocols/ip.h"
35 #include "protocols/tcp.h"
36 #include "protocols/rfc6846.h"
37 #include "schemes/ip_ctxt.h"
38 #include "schemes/decomp_wlsb.h"
39 #include "schemes/tcp_ts.h"
40 #include "schemes/tcp_sack.h"
41 
42 #include <stdint.h>
43 
44 
45 /** The decompression context for one TCP option */
46 struct d_tcp_opt_ctxt /* TODO: doxygen */
47 {
48  union
49  {
50  struct
51  {
52  bool is_static;
53  uint8_t len;
54  } eol;
55  struct
56  {
57  bool is_static;
58  uint16_t value;
59  } mss;
60  struct
61  {
62  bool is_static;
63  uint8_t value;
64  } ws;
65  struct
66  {
67  struct rohc_lsb_field32 req; /**< The context for the TS request field */
68  struct rohc_lsb_field32 rep; /**< The context for the TS reply field */
69  } ts;
70  struct d_tcp_opt_sack sack; /* TODO: ptr inside is not needed */
71  struct
72  {
74  enum
75  {
79  } type;
80  uint8_t load_len;
81  } generic;
82  } data;
83  bool used;
84  uint8_t type;
85 };
86 
87 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
88 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
89  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
90  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
91 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data) % 8) == 0,
92  "data in d_tcp_opt_ctxt should be aligned on 8 bytes");
93 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.eol) % 8) == 0,
94  "data.eol in d_tcp_opt_ctxt should be aligned on 8 bytes");
95 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.mss) % 8) == 0,
96  "data.mss in d_tcp_opt_ctxt should be aligned on 8 bytes");
97 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.ws) % 8) == 0,
98  "data.ws in d_tcp_opt_ctxt should be aligned on 8 bytes");
99 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.ts) % 8) == 0,
100  "data.ts in d_tcp_opt_ctxt should be aligned on 8 bytes");
101 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.sack) % 8) == 0,
102  "data.sack in d_tcp_opt_ctxt should be aligned on 8 bytes");
103 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.generic) % 8) == 0,
104  "data.generic in d_tcp_opt_ctxt should be aligned on 8 bytes");
105 _Static_assert((offsetof(struct d_tcp_opt_ctxt, data.generic.load) % 8) == 0,
106  "data.generic.load in d_tcp_opt_ctxt should be aligned on 8 bytes");
107 _Static_assert((sizeof(struct d_tcp_opt_ctxt) % 8) == 0,
108  "d_tcp_opt_ctxt length should be multiple of 8 bytes");
109 #endif
110 
111 
112 /** The decompression context for TCP options */
114 {
115  /** The structure of the list of TCP options */
116  uint8_t structure[ROHC_TCP_OPTS_MAX];
117 
118  /** The number of options in the list of TCP options */
119  uint8_t nr;
120 
121  /** Whether the TCP options are expected in the dynamic part? */
122  bool expected_dynamic[ROHC_TCP_OPTS_MAX];
123  uint8_t unused2[1]; /**< pad struct up to multiple of 8 bytes, align next fields */
124 
125  /** The TCP options that were found or not */
126  bool found[ROHC_TCP_OPTS_MAX];
127  uint8_t unused3[1]; /**< pad struct up to multiple of 8 bytes, align next fields */
128 
129  /** The bits of TCP options extracted from the dynamic chain, the tail of
130  * co_common/seq_8/rnd_8 packets, or the irregular chain */
132 };
133 
134 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
135 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
136  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
137  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
138 _Static_assert((offsetof(struct d_tcp_opts_ctxt, structure) % 8) == 0,
139  "structure in d_tcp_opts_ctxt should be aligned on 8 bytes");
140 _Static_assert((offsetof(struct d_tcp_opts_ctxt, expected_dynamic) % 8) == 0,
141  "expected_dynamic in d_tcp_opts_ctxt should be aligned on 8 bytes");
142 _Static_assert((offsetof(struct d_tcp_opts_ctxt, found) % 8) == 0,
143  "found in d_tcp_opts_ctxt should be aligned on 8 bytes");
144 _Static_assert((offsetof(struct d_tcp_opts_ctxt, bits) % 8) == 0,
145  "bits in d_tcp_opts_ctxt should be aligned on 8 bytes");
146 _Static_assert((sizeof(struct d_tcp_opts_ctxt) % 8) == 0,
147  "d_tcp_opts_ctxt length should be multiple of 8 bytes");
148 #endif
149 
150 
151 /** Define the TCP part of the decompression profile context */
153 {
154  /** The LSB decoding context of MSN */
155  struct rohc_lsb_decode msn_lsb_ctxt;
156 
157  /** The LSB decoding context of innermost IP-ID */
158  struct rohc_lsb_decode ip_id_lsb_ctxt;
159  /** The LSB decoding context of innermost TTL/HL */
160  struct rohc_lsb_decode ttl_hl_lsb_ctxt;
161 
162  struct rohc_lsb_decode seq_lsb_ctxt;
163  struct rohc_lsb_decode seq_scaled_lsb_ctxt;
164  struct rohc_lsb_decode ack_lsb_ctxt;
165  struct rohc_lsb_decode ack_scaled_lsb_ctxt;
166  /** The LSB decoding context of TCP window */
167  struct rohc_lsb_decode window_lsb_ctxt;
168 
169  uint32_t seq_num_residue;
170  uint32_t ack_stride;
171  uint32_t ack_num_residue;
172 
173  uint16_t tcp_src_port; /**< The TCP source port */
174  uint16_t tcp_dst_port; /**< The TCP dest port */
175 
176  /** The URG pointer */
177  uint16_t urg_ptr;
178 
179  /* TCP flags */
180  uint8_t res_flags:4; /**< The TCP reserved flags */
181  uint8_t ecn_used:1; /**< Whether ECN flag is used */
182  uint8_t ecn_flags:2; /**< The TCP ECN flags */
183  uint8_t urg_flag:1; /**< The TCP URG flag */
184  uint8_t ack_flag:1; /**< The TCP ACK flag */
185  uint8_t rsf_flags:3; /**< The TCP RSF flag */
186  uint8_t unused:4;
187 
188  uint8_t unused2[3];
189 
190  uint8_t ip_contexts_nr;
192 
193  /** The decoded values of TCP options */
194  struct d_tcp_opts_ctxt tcp_opts;
195  /* TCP TS option */
196  struct rohc_lsb_decode opt_ts_req_lsb_ctxt;
197  struct rohc_lsb_decode opt_ts_rep_lsb_ctxt;
198  /* TCP SACK option */
199  struct d_tcp_opt_sack opt_sack_blocks; /**< The TCP SACK blocks */
200 
201 };
202 
203 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
204 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
205  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
206  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
207 _Static_assert((offsetof(struct d_tcp_context, seq_lsb_ctxt) % 8) == 0,
208  "seq_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
209 _Static_assert((offsetof(struct d_tcp_context, seq_scaled_lsb_ctxt) % 8) == 0,
210  "seq_scaled_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
211 _Static_assert((offsetof(struct d_tcp_context, ack_lsb_ctxt) % 8) == 0,
212  "ack_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
213 _Static_assert((offsetof(struct d_tcp_context, ack_scaled_lsb_ctxt) % 8) == 0,
214  "ack_scaled_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
215 _Static_assert((offsetof(struct d_tcp_context, window_lsb_ctxt) % 8) == 0,
216  "window_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
217 _Static_assert((offsetof(struct d_tcp_context, tcp_opts) % 8) == 0,
218  "tcp_opts in d_tcp_context should be aligned on 8 bytes");
219 _Static_assert((offsetof(struct d_tcp_context, opt_ts_req_lsb_ctxt) % 8) == 0,
220  "opt_ts_req_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
221 _Static_assert((offsetof(struct d_tcp_context, opt_ts_rep_lsb_ctxt) % 8) == 0,
222  "opt_ts_rep_lsb_ctxt in d_tcp_context should be aligned on 8 bytes");
223 _Static_assert((offsetof(struct d_tcp_context, opt_sack_blocks) % 8) == 0,
224  "opt_sack_blocks in d_tcp_context should be aligned on 8 bytes");
225 _Static_assert((offsetof(struct d_tcp_context, ip_contexts) % 8) == 0,
226  "ip_contexts in d_tcp_context should be aligned on 8 bytes");
227 _Static_assert((sizeof(struct d_tcp_context) % 8) == 0,
228  "d_tcp_context length should be multiple of 8 bytes");
229 #endif
230 
231 
232 /** The outer or inner IP bits extracted from ROHC headers */
234 {
235  struct rohc_lsb_field16 id; /**< The IP-ID bits */
236  struct rohc_lsb_field8 ttl_hl; /**< The IP TTL/HL bits */
237 
238  uint8_t saddr[16]; /**< The source address bits found in static chain of
239  IR header */
240  uint8_t daddr[16]; /**< The destination address bits found in static
241  chain of IR header */
242 
243  /** The parsed IP extension headers */
245  uint16_t opts_len; /**< The length of the parsed IP extension headers */
246  uint8_t opts_nr; /**< The number of parsed IP extension headers */
247 
248  uint8_t proto; /**< The protocol/next header bits found static chain
249  of IR header or in extension header */
250 
251  uint32_t flowid:20; /**< The IPv6 flow ID bits found in static chain of IR hdr */
252  uint32_t dscp_bits:6; /**< The IP DSCP bits */
253  uint32_t df:1; /**< The DF bits found in dynamic chain of IR/IR-DYN
254  header or in extension header */
255  uint32_t unused:5; /**< padding */
256 
257  uint8_t version:4; /**< The version bits found in static chain of IR hdr */
258  uint8_t ecn_flags_bits:2; /**< The IP ECN flag bits */
259  uint8_t id_behavior:2; /**< The IP-ID behavior bits */
260 
261  bits_nr_t ecn_flags_bits_nr; /**< The number of IP ECN flag bits */
262  bits_nr_t id_behavior_nr; /**< The number of IP-ID behavior bits */
263  bits_nr_t proto_nr; /**< The number of protocol/next header bits */
264  bits_nr_t df_nr; /**< The number of DF bits found */
265  bits_nr_t dscp_bits_nr; /**< The number of IP DSCP bits */
266  bits_nr_t flowid_nr; /**< The number of flow label bits */
267  bits_nr_t saddr_nr; /**< The number of source address bits */
268 
269  bits_nr_t daddr_nr; /**< The number of source address bits */
270  uint8_t unused2[7];
271 };
272 
273 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
274 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
275  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
276  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
277 _Static_assert((offsetof(struct rohc_tcp_extr_ip_bits, id) % 8) == 0,
278  "id in rohc_tcp_extr_ip_bits should be aligned on 8 bytes");
279 _Static_assert((offsetof(struct rohc_tcp_extr_ip_bits, ttl_hl) % 8) == 0,
280  "ttl_hl in rohc_tcp_extr_ip_bits should be aligned on 8 bytes");
281 _Static_assert((offsetof(struct rohc_tcp_extr_ip_bits, saddr) % 8) == 0,
282  "saddr in rohc_tcp_extr_ip_bits should be aligned on 8 bytes");
283 _Static_assert((offsetof(struct rohc_tcp_extr_ip_bits, daddr) % 8) == 0,
284  "daddr in rohc_tcp_extr_ip_bits should be aligned on 8 bytes");
285 _Static_assert((offsetof(struct rohc_tcp_extr_ip_bits, opts) % 8) == 0,
286  "opts in rohc_tcp_extr_ip_bits should be aligned on 8 bytes");
287 _Static_assert((sizeof(struct rohc_tcp_extr_ip_bits) % 8) == 0,
288  "rohc_tcp_extr_ip_bits length should be multiple of 8 bytes");
289 #endif
290 
291 
292 /** The bits extracted from ROHC TCP header */
294 {
295  /** The extracted bits of the Master Sequence Number (MSN) of the packet */
296  struct rohc_lsb_field16 msn;
297 
298  /* TCP header */
299  struct rohc_lsb_field32 seq; /**< The TCP sequence number bits */
300  struct rohc_lsb_field32 seq_scaled; /**< The TCP scaled sequence number bits */
301  struct rohc_lsb_field32 ack; /**< The TCP acknowledgment number bits */
302  struct rohc_lsb_field32 ack_scaled; /**< The TCP scaled ACK number bits */
303  struct rohc_lsb_field16 ack_stride; /**< The TCP ACK stride bits */
304  struct rohc_lsb_field16 window; /**< The TCP window bits */
305  struct rohc_lsb_field16 urg_ptr; /**< The TCP Urgent pointer bits */
306  uint16_t src_port; /**< The TCP source port bits found in static chain */
307  uint16_t dst_port; /**< The TCP destination port bits in static chain */
308  uint16_t tcp_check; /**< The TCP checksum bits found in dynamic chain of
309  IR/IR-DYN header or in irregular chain of CO header */
310  uint16_t res_flags_bits:4; /**< The TCP reserved flag bits */
311  uint16_t ecn_used_bits:1; /**< The TCP ECN used flag bits */
312  uint16_t ecn_flags_bits:2; /**< The TCP ECN flag bits */
313  uint16_t urg_flag_bits:1; /**< The TCP URG flag bits */
314  uint16_t ack_flag_bits:1; /**< The TCP ACK flag bits */
315  uint16_t psh_flag_bits:1; /**< The TCP PSH flag bits */
316  uint16_t rsf_flags_bits:3; /**< The TCP RSF flag bits */
317  uint16_t unused:3;
318 
319  /** The bits of TCP options extracted from the dynamic chain, the tail of
320  * co_common/seq_8/rnd_8 packets, or the irregular chain */
321  struct d_tcp_opts_ctxt tcp_opts;
322 
323  /** The extracted bits related to the IP headers */
325  uint8_t ip_nr; /**< The number of parsed IP headers */
326 
327  bits_nr_t src_port_nr; /**< The number of TCP source port bits */
328  bits_nr_t dst_port_nr; /**< The number of TCP destination port bits */
329  bits_nr_t res_flags_bits_nr; /**< The number of TCP reserved flag bits */
330  bits_nr_t ecn_used_bits_nr; /**< The number of ECN used flag bits */
331  bits_nr_t ecn_flags_bits_nr; /**< The number of TCP ECN flag bits */
332  bits_nr_t urg_flag_bits_nr; /**< The number of TCP URG flag bits */
333  bits_nr_t ack_flag_bits_nr; /**< The number of TCP ACK flag bits */
334 
335  bits_nr_t psh_flag_bits_nr; /**< The number of TCP PSG flag bits */
336  bits_nr_t rsf_flags_bits_nr; /**< The number of TCP RSF flag bits */
337 
338  /** The base context for Context Replication (CR) */
340  /** Whether Context Replication (CR) is used */
342 
343  /** Whether TTL/HL of outer IP headers is included in the dynamic chain */
345  /** Whether TTL/HL of outer IP headers is included in the irregular chain */
347 
348  uint8_t unused2;
349 };
350 
351 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
352 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
353  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
354  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
355 _Static_assert((offsetof(struct rohc_tcp_extr_bits, msn) % 8) == 0,
356  "msn in rohc_tcp_extr_bits should be aligned on 8 bytes");
357 _Static_assert((offsetof(struct rohc_tcp_extr_bits, seq) % 8) == 0,
358  "seq in rohc_tcp_extr_bits should be aligned on 8 bytes");
359 _Static_assert((offsetof(struct rohc_tcp_extr_bits, seq_scaled) % 8) == 0,
360  "seq_scaled in rohc_tcp_extr_bits should be aligned on 8 bytes");
361 _Static_assert((offsetof(struct rohc_tcp_extr_bits, ack) % 8) == 0,
362  "ack in rohc_tcp_extr_bits should be aligned on 8 bytes");
363 _Static_assert((offsetof(struct rohc_tcp_extr_bits, ack_scaled) % 8) == 0,
364  "ack_scaled in rohc_tcp_extr_bits should be aligned on 8 bytes");
365 _Static_assert((offsetof(struct rohc_tcp_extr_bits, tcp_opts) % 8) == 0,
366  "tcp_opts in rohc_tcp_extr_bits should be aligned on 8 bytes");
367 _Static_assert((offsetof(struct rohc_tcp_extr_bits, ip) % 8) == 0,
368  "ip in rohc_tcp_extr_bits should be aligned on 8 bytes");
369 _Static_assert((offsetof(struct rohc_tcp_extr_bits, ip_nr) % 8) == 0,
370  "ip_nr in rohc_tcp_extr_bits should be aligned on 8 bytes");
371 _Static_assert((offsetof(struct rohc_tcp_extr_bits, psh_flag_bits_nr) % 8) == 0,
372  "psh_flag_bits_nr in rohc_tcp_extr_bits should be aligned on 8 bytes");
373 _Static_assert((sizeof(struct rohc_tcp_extr_bits) % 8) == 0,
374  "rohc_tcp_extr_bits length should be multiple of 8 bytes");
375 #endif
376 
377 
378 /** The IP values decoded from the extracted ROHC bits */
380 {
381  uint8_t saddr[16]; /**< The decoded source address field */
382  uint8_t daddr[16]; /**< The decoded destination address field */
383 
384  /** The decoded IP extension headers */
386  uint16_t opts_len; /**< The length of the decoded IP extension headers */
387  uint8_t opts_nr; /**< The number of decoded IP extension headers */
388 
389  uint8_t ttl; /**< The decoded TTL/HL field */
390  uint16_t id; /**< The decoded IP-ID field (IPv4 only) */
391  uint8_t proto; /**< The decoded protocol/NH field */
392 
393  uint8_t df:1; /**< The decoded DF field (IPv4 only) */
394  uint8_t nbo:1; /**< The decoded NBO field (IPv4 only) */
395  uint8_t rnd:1; /**< The decoded RND field (IPv4 only) */
396  uint8_t id_behavior:2; /**< The decoded IP-ID behavior (Ipv4 only) */
397  uint8_t unused:3;
398 
399  uint32_t flowid:20; /**< The decoded flow ID field (IPv6 only) */
400  uint32_t ecn_flags:2; /**< The decoded ECN flags */
401  uint32_t dscp:6; /**< The decoded DSCP field */
402  uint32_t version:4; /**< The decoded version field */
403 
404  uint8_t unused2[4];
405 };
406 
407 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
408 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
409  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
410  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
411 _Static_assert((offsetof(struct rohc_tcp_decoded_ip_values, saddr) % 8) == 0,
412  "saddr in rohc_tcp_decoded_ip_values should be aligned on 8 bytes");
413 _Static_assert((offsetof(struct rohc_tcp_decoded_ip_values, daddr) % 8) == 0,
414  "daddr in rohc_tcp_decoded_ip_values should be aligned on 8 bytes");
415 _Static_assert((offsetof(struct rohc_tcp_decoded_ip_values, opts) % 8) == 0,
416  "opts in rohc_tcp_decoded_ip_values should be aligned on 8 bytes");
417 _Static_assert((offsetof(struct rohc_tcp_decoded_ip_values, opts_len) % 8) == 0,
418  "opts_len in rohc_tcp_decoded_ip_values should be aligned on 8 bytes");
419 _Static_assert((sizeof(struct rohc_tcp_decoded_ip_values) % 8) == 0,
420  "rohc_tcp_decoded_ip_values length should be multiple of 8 bytes");
421 #endif
422 
423 
424 /** The values decoded from the bits extracted from ROHC TCP header */
426 {
427  /* TCP TS option */
428  uint32_t opt_ts_req; /**< The echo request value of the TCP TS option */
429  uint32_t opt_ts_rep; /**< The echo reply value of the TCP TS option */
430 
431  /* TCP sequence & acknowledgment numbers */
432  uint32_t seq_num; /**< The TCP sequence number */
433  uint32_t seq_num_scaled; /**< The scaled TCP sequence number */
434  uint32_t seq_num_residue; /**< The residue of the scaled TCP sequence number */
435  uint32_t ack_num; /**< The TCP acknowledgment number */
436  uint32_t ack_num_scaled; /**< The scaled TCP acknowledgment number */
437  uint16_t ack_num_residue; /**< The residue of the scaled TCP ACK number */
438  uint16_t ack_stride; /**< The ACK stride */
439 
440  /** The Master Sequence Number (MSN) of the packet */
441  uint16_t msn;
442 
443  /* TCP window, checksum and Urgent pointer */
444  uint16_t window; /**< The TCP window */
445  uint16_t tcp_check; /**< The TCP checksum */
446  uint16_t urg_ptr; /**< The TCP Urgent pointer */
447 
448  /* TCP source & destination ports */
449  uint16_t src_port; /**< The TCP source port */
450  uint16_t dst_port; /**< The TCP destination port */
451 
452  /* TCP flags */
453  uint8_t ecn_used:1; /**< Whether the TCP ECN flags are used */
454  uint8_t urg_flag:1; /**< The TCP URG flag */
455  uint8_t ack_flag:1; /**< The TCP ACK flag */
456  uint8_t psh_flag:1; /**< The TCP PSH flag */
457  uint8_t res_flags:4; /**< The TCP reserved flags */
458  uint8_t ecn_flags:2; /**< The TCP ECN flags */
459  uint8_t rsf_flags:3; /**< The TCP RSF flags */
460 
461  /** Whether TTL/HL of outer IP headers is included in the dynamic chain */
463  /** Whether TTL/HL of outer IP headers is included in the irregular chain */
465 
466  /** Whether Context Replication (CR) is used */
468  /** The base context for Context Replication (CR) */
470 
471  /** The decoded values of TCP options */
472  struct d_tcp_opts_ctxt tcp_opts;
473  /* TCP SACK option */
474  struct d_tcp_opt_sack opt_sack_blocks; /**< The TCP SACK blocks */
475 
476  /** The decoded values related to the IP headers */
478  uint8_t ip_nr; /**< The number of the decoded IP headers */
479  uint8_t unused[7];
480 };
481 
482 /* compiler sanity check for C11-compliant compilers and GCC >= 4.6 */
483 #if ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
484  (defined(__GNUC__) && defined(__GNUC_MINOR__) && \
485  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))))
486 _Static_assert((offsetof(struct rohc_tcp_decoded_values, opt_ts_req) % 8) == 0,
487  "opt_ts_req in rohc_tcp_decoded_values should be aligned on 8 bytes");
488 _Static_assert((offsetof(struct rohc_tcp_decoded_values, tcp_opts) % 8) == 0,
489  "tcp_opts in rohc_tcp_decoded_values should be aligned on 8 bytes");
490 _Static_assert((offsetof(struct rohc_tcp_decoded_values, opt_sack_blocks) % 8) == 0,
491  "opt_sack_blocks in rohc_tcp_decoded_values should be aligned on 8 bytes");
492 _Static_assert((offsetof(struct rohc_tcp_decoded_values, ip) % 8) == 0,
493  "ip in rohc_tcp_decoded_values should be aligned on 8 bytes");
494 _Static_assert((sizeof(struct rohc_tcp_decoded_values) % 8) == 0,
495  "rohc_tcp_decoded_values length should be multiple of 8 bytes");
496 #endif
497 
498 
499 #endif /* ROHC_DECOMP_TCP_DEFINES_H */
500 
uint8_t len
Definition: d_tcp_defines.h:53
uint32_t ack_num
Definition: d_tcp_defines.h:435
uint8_t rsf_flags
Definition: d_tcp_defines.h:459
bits_nr_t daddr_nr
Definition: d_tcp_defines.h:269
uint32_t ack_stride
Definition: d_tcp_defines.h:170
rohc_cid_t cr_base_cid
Definition: d_tcp_defines.h:469
bits_nr_t dst_port_nr
Definition: d_tcp_defines.h:328
struct d_tcp_opt_ctxt::@41::@43 mss
#define ROHC_TCP_OPT_MAX_LEN
The maximum length of TCP options supported by the TCP profile.
Definition: rfc6846.h:58
bits_nr_t flowid_nr
Definition: d_tcp_defines.h:266
Definition: d_tcp_defines.h:425
uint16_t tcp_check
Definition: d_tcp_defines.h:445
uint32_t ack_num_residue
Definition: d_tcp_defines.h:171
uint16_t msn
Definition: d_tcp_defines.h:441
uint32_t flowid
Definition: d_tcp_defines.h:251
bool used
Definition: d_tcp_defines.h:83
bits_nr_t ecn_used_bits_nr
Definition: d_tcp_defines.h:330
uint32_t opt_ts_rep
Definition: d_tcp_defines.h:429
uint32_t dscp_bits
Definition: d_tcp_defines.h:252
uint16_t dst_port
Definition: d_tcp_defines.h:450
uint16_t urg_ptr
Definition: d_tcp_defines.h:177
uint8_t proto
Definition: d_tcp_defines.h:248
uint8_t ttl
Definition: d_tcp_defines.h:389
uint16_t tcp_check
Definition: d_tcp_defines.h:308
bool ttl_dyn_chain_flag
Definition: d_tcp_defines.h:344
Definition: decomp_wlsb.h:99
uint8_t proto
Definition: d_tcp_defines.h:391
uint32_t df
Definition: d_tcp_defines.h:253
uint16_t opts_len
Definition: d_tcp_defines.h:245
uint16_t ack_flag_bits
Definition: d_tcp_defines.h:314
uint16_t window
Definition: d_tcp_defines.h:444
uint16_t opts_len
Definition: d_tcp_defines.h:386
Definition: d_tcp_defines.h:233
uint8_t ttl_dyn_chain_flag
Definition: d_tcp_defines.h:462
uint8_t value
Definition: d_tcp_defines.h:63
uint16_t res_flags_bits
Definition: d_tcp_defines.h:310
uint8_t res_flags
Definition: d_tcp_defines.h:457
bool do_ctxt_replication
Definition: d_tcp_defines.h:341
uint8_t ecn_flags
Definition: d_tcp_defines.h:458
bits_nr_t ecn_flags_bits_nr
Definition: d_tcp_defines.h:331
uint16_t dst_port
Definition: d_tcp_defines.h:307
uint8_t ecn_used
Definition: d_tcp_defines.h:181
Definition: decomp/schemes/tcp_sack.h:38
bits_nr_t df_nr
Definition: d_tcp_defines.h:264
bits_nr_t saddr_nr
Definition: d_tcp_defines.h:267
uint8_t ip_nr
Definition: d_tcp_defines.h:478
uint16_t ecn_flags_bits
Definition: d_tcp_defines.h:312
The Least Significant Bits (LSB) decoding object.
Definition: decomp_wlsb.h:59
uint16_t value
Definition: d_tcp_defines.h:58
bits_nr_t id_behavior_nr
Definition: d_tcp_defines.h:262
Definition: d_tcp_defines.h:76
uint16_t src_port
Definition: d_tcp_defines.h:306
Definition: comp/schemes/ip_ctxt.h:64
uint16_t src_port
Definition: d_tcp_defines.h:449
Definition: decomp_wlsb.h:117
uint8_t load[ROHC_TCP_OPT_MAX_LEN]
Definition: d_tcp_defines.h:73
struct d_tcp_opt_ctxt::@41::@42 eol
bits_nr_t src_port_nr
Definition: d_tcp_defines.h:327
uint8_t df
Definition: d_tcp_defines.h:393
uint8_t ip_contexts_nr
Definition: d_tcp_defines.h:190
union d_tcp_opt_ctxt::@41 data
#define MAX_TCP_OPTION_INDEX
The largest index that may be used to identify one TCP option.
Definition: rfc6846.h:67
uint8_t id_behavior
Definition: d_tcp_defines.h:396
struct d_tcp_opt_sack sack
Definition: d_tcp_defines.h:70
uint32_t seq_num_residue
Definition: d_tcp_defines.h:434
bool is_static
Definition: d_tcp_defines.h:52
uint32_t dscp
Definition: d_tcp_defines.h:401
ROHC packets for the ROHCv1 IP/TCP profile defined in RFC6846.
struct d_tcp_opt_ctxt::@41::@46 generic
Definition: d_tcp_defines.h:46
bits_nr_t urg_flag_bits_nr
Definition: d_tcp_defines.h:332
uint8_t ecn_used
Definition: d_tcp_defines.h:453
Window-based Least Significant Bits (W-LSB) decoding.
bits_nr_t proto_nr
Definition: d_tcp_defines.h:263
uint16_t unused
Definition: d_tcp_defines.h:317
Definition: d_tcp_defines.h:152
uint32_t version
Definition: d_tcp_defines.h:402
#define ROHC_MAX_IP_EXT_HDRS
The maximum number of IP extension headers supported.
Definition: protocols/ip.h:69
uint8_t load_len
Definition: d_tcp_defines.h:80
uint16_t ack_num_residue
Definition: d_tcp_defines.h:437
uint8_t ack_flag
Definition: d_tcp_defines.h:455
uint32_t seq_num_scaled
Definition: d_tcp_defines.h:433
uint16_t rsf_flags_bits
Definition: d_tcp_defines.h:316
struct d_tcp_opt_ctxt::@41::@44 ws
uint8_t rsf_flags
Definition: d_tcp_defines.h:185
bits_nr_t dscp_bits_nr
Definition: d_tcp_defines.h:265
uint8_t opts_nr
Definition: d_tcp_defines.h:387
uint8_t ip_nr
Definition: d_tcp_defines.h:325
uint32_t opt_ts_req
Definition: d_tcp_defines.h:428
uint16_t ack_stride
Definition: d_tcp_defines.h:438
uint8_t res_flags
Definition: d_tcp_defines.h:180
uint8_t version
Definition: d_tcp_defines.h:257
uint16_t psh_flag_bits
Definition: d_tcp_defines.h:315
uint16_t ecn_used_bits
Definition: d_tcp_defines.h:311
uint8_t urg_flag
Definition: d_tcp_defines.h:454
Definition: decomp_wlsb.h:81
struct rohc_lsb_field32 req
Definition: d_tcp_defines.h:67
bits_nr_t res_flags_bits_nr
Definition: d_tcp_defines.h:329
Definition: d_tcp_defines.h:379
bits_nr_t ack_flag_bits_nr
Definition: d_tcp_defines.h:333
uint8_t unused
Definition: d_tcp_defines.h:186
uint8_t ecn_flags
Definition: d_tcp_defines.h:182
uint8_t bits_nr_t
A number of bits required or retrieved.
Definition: rohc_internal.h:205
uint16_t rohc_cid_t
Definition: rohc.h:196
uint8_t urg_flag
Definition: d_tcp_defines.h:183
enum d_tcp_opt_ctxt::@41::@46::@47 type
bits_nr_t rsf_flags_bits_nr
Definition: d_tcp_defines.h:336
rohc_cid_t cr_base_cid
Definition: d_tcp_defines.h:339
uint8_t type
Definition: d_tcp_defines.h:84
uint32_t ack_num_scaled
Definition: d_tcp_defines.h:436
uint8_t rnd
Definition: d_tcp_defines.h:395
uint8_t unused[7]
Definition: decomp/schemes/tcp_sack.h:42
struct d_tcp_opt_ctxt::@41::@45 ts
bits_nr_t ecn_flags_bits_nr
Definition: d_tcp_defines.h:261
uint8_t ecn_flags_bits
Definition: d_tcp_defines.h:258
uint8_t unused2
Definition: d_tcp_defines.h:348
The TCP compression context for one IPv4 or IPv6 header.
Definition: comp/schemes/ip_ctxt.h:76
uint32_t ecn_flags
Definition: d_tcp_defines.h:400
uint8_t psh_flag
Definition: d_tcp_defines.h:456
uint8_t id_behavior
Definition: d_tcp_defines.h:259
uint8_t ttl_irreg_chain_flag
Definition: d_tcp_defines.h:464
uint16_t tcp_src_port
Definition: d_tcp_defines.h:173
uint16_t urg_ptr
Definition: d_tcp_defines.h:446
Defines the common IPv4/v6 header.
uint8_t ack_flag
Definition: d_tcp_defines.h:184
#define ROHC_TCP_OPTS_MAX
The maximum of TCP options supported by the TCP profile.
Definition: tcp.h:124
Definition: d_tcp_defines.h:113
Definition: d_tcp_defines.h:78
uint8_t do_ctxt_replication
Definition: d_tcp_defines.h:467
TCP header description.
uint32_t unused
Definition: d_tcp_defines.h:255
uint8_t opts_nr
Definition: d_tcp_defines.h:246
bits_nr_t psh_flag_bits_nr
Definition: d_tcp_defines.h:335
bool ttl_irreg_chain_flag
Definition: d_tcp_defines.h:346
uint8_t nbo
Definition: d_tcp_defines.h:394
uint8_t nr
Definition: d_tcp_defines.h:119
struct rohc_lsb_field32 rep
Definition: d_tcp_defines.h:68
uint16_t id
Definition: d_tcp_defines.h:390
uint32_t seq_num
Definition: d_tcp_defines.h:432
uint8_t unused
Definition: d_tcp_defines.h:397
uint32_t seq_num_residue
Definition: d_tcp_defines.h:169
#define ROHC_MAX_IP_HDRS
The maximum number of IP headers supported.
Definition: protocols/ip.h:46
Definition: d_tcp_defines.h:293
uint32_t flowid
Definition: d_tcp_defines.h:399
uint16_t tcp_dst_port
Definition: d_tcp_defines.h:174
Compute the interpretation interval for LSB and W-LSB encoding.
Definition: d_tcp_defines.h:77
uint16_t urg_flag_bits
Definition: d_tcp_defines.h:313