ROHC compression/decompression library
rohc_decomp_rfc3095.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010,2011,2012,2013,2014 Didier Barvaux
3  * Copyright 2007,2008 Thales Alenia Space
4  * Copyright 2007,2008,2009,2010,2012,2013 Viveris Technologies
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 rohc_decomp_rfc3095.c
23  * @brief Generic framework for RFC3095-based decompression profiles such as
24  * IP-only, UDP, UDP-Lite, ESP, and RTP profiles.
25  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
26  * @author Didier Barvaux <didier@barvaux.org>
27  * @author David Moreau from TAS
28  */
29 
30 #ifndef ROHC_DECOMP_RFC3095_H
31 #define ROHC_DECOMP_RFC3095_H
32 
33 #include "rohc_decomp.h"
34 #include "rohc_decomp_internals.h"
35 #include "rohc_packets.h"
36 #include "rohc_utils.h"
37 #include "schemes/decomp_wlsb.h"
38 #include "schemes/ip_id_offset.h"
39 #include "schemes/decomp_list.h"
40 #include "protocols/udp_lite.h"
41 #include "ip.h"
42 #include "crc.h"
43 
44 #include <stddef.h>
45 #ifdef __KERNEL__
46 # include <linux/types.h>
47 #else
48 # include <stdbool.h>
49 #endif
50 
51 
52 /** The outer or inner IP bits extracted from ROHC headers */
54 {
55  uint8_t version:4; /**< The version bits found in static chain of IR
56  header */
57 
58  uint8_t tos; /**< The TOS/TC bits found in dynamic chain of IR/IR-DYN
59  header or in extension header */
60  size_t tos_nr; /**< The number of TOS/TC bits found */
61 
62  uint16_t id; /**< The IP-ID bits found in dynamic chain of IR/IR-DYN
63  header, in UO* base header, in extension header and
64  in remainder of UO* header */
65  size_t id_nr; /**< The number of IP-ID bits found */
66  bool is_id_enc; /**< Whether value(IP-ID) is encoded or not */
67 
68  uint8_t df:1; /**< The DF bits found in dynamic chain of IR/IR-DYN
69  header or in extension header */
70  size_t df_nr; /**< The number of DF bits found */
71 
72  uint8_t ttl; /**< The TTL/HL bits found in dynamic chain of IR/IR-DYN
73  header or in extension header */
74  size_t ttl_nr; /**< The number of TTL/HL bits found */
75 
76  uint8_t proto; /**< The protocol/next header bits found static chain
77  of IR header or in extension header */
78  size_t proto_nr; /**< The number of protocol/next header bits */
79 
80  uint8_t nbo:1; /**< The NBO bits found in dynamic chain of IR/IR-DYN
81  header or in extension header */
82  size_t nbo_nr; /**< The number of NBO bits found */
83 
84  uint8_t rnd:1; /**< The RND bits found in dynamic chain of IR/IR-DYN
85  header or in extension header */
86  size_t rnd_nr; /**< The number of RND bits found */
87 
88  uint8_t sid:1; /**< The SID bits found in dynamic chain of IR/IR-DYN
89  header or in extension header */
90  size_t sid_nr; /**< The number of SID bits found */
91 
92  uint32_t flowid:20; /**< The IPv6 flow ID bits found in static chain of
93  IR header */
94  size_t flowid_nr; /**< The number of flow label bits */
95 
96  uint8_t saddr[16]; /**< The source address bits found in static chain of
97  IR header */
98  size_t saddr_nr; /**< The number of source address bits */
99 
100  uint8_t daddr[16]; /**< The destination address bits found in static
101  chain of IR header */
102  size_t daddr_nr; /**< The number of source address bits */
103 };
104 
105 
106 /**
107  * @brief The bits extracted from ROHC UO* base headers
108  *
109  * @see parse_uo0
110  * @see parse_uo1
111  * @see parse_uor2
112  */
114 {
115  bool is_context_reused; /**< Whether the context is re-used or not */
116 
117  /* SN */
118  uint32_t sn; /**< The SN bits found in ROHC header */
119  size_t sn_nr; /**< The number of SN bits found in ROHC header */
120  bool is_sn_enc; /**< Whether value(SN) is encoded with W-LSB or not */
121  rohc_lsb_ref_t lsb_ref_type; /**< The reference to use for LSB decoding
122  (used for context repair after CRC failure) */
123  bool sn_ref_offset; /**< Optional offset to add to the reference SN
124  (used for context repair after CRC failure) */
125 
126  /** Whether there are multiple IP headers or only one single IP header */
128 
129  /** bits related to outer IP header */
131 
132  /** bits related to inner IP header */
134 
135  /* X (extension) flag */
136  uint8_t ext_flag:1; /**< X (extension) flag */
137 
138  /* Mode bits */
139  uint8_t mode:2; /**< The Mode bits found in ROHC header */
140  size_t mode_nr; /**< The number of Mode bits found in ROHC header */
141 
142 
143  /* bits below are for UDP-based profiles only
144  @todo TODO should be moved in d_udp.c */
145 
146  uint16_t udp_src; /**< The UDP source port bits found in static chain
147  of IR header */
148  size_t udp_src_nr; /**< The number of UDP source port bits */
149 
150  uint16_t udp_dst; /**< The UDP destination port bits in static chain
151  of IR header */
152  size_t udp_dst_nr; /**< The number of UDP destination port bits */
153 
154  rohc_tristate_t udp_check_present; /**< Whether the UDP checksum field is
155  encoded in the ROHC packet or not */
156  uint16_t udp_check; /**< The UDP checksum bits found in dynamic chain
157  of IR/IR-DYN header or in remainder of UO*
158  header */
159  size_t udp_check_nr; /**< The number of UDP checksum bits */
160 
161 
162  /* bits below are for UDP-Lite-based profiles only
163  @todo TODO should be moved in d_udp_lite.c */
164 
166  rohc_tristate_t cfp; /**< TODO */
167  rohc_tristate_t cfi; /**< TODO */
168  uint16_t udp_lite_cc; /**< The UDP-Lite CC bits found in dynamic
169  chain of IR/IR-DYN header or in remainder
170  of UO* header */
171  size_t udp_lite_cc_nr; /**< The number of UDP-Lite CC bits */
172 
173 
174  /* bits below are for RTP profile only
175  @todo TODO should be moved in d_rtp.c */
176 
177  /* RTP version */
178  uint8_t rtp_version:2; /**< The RTP version bits found in dynamic chain
179  of IR/IR-DYN header */
180  size_t rtp_version_nr; /**< The number of RTP version bits */
181 
182  /* RTP Padding (R-P) flag */
183  uint8_t rtp_p:1; /**< The RTP Padding bits found in dynamic chain
184  of IR/IR-DYN header or in extension header */
185  size_t rtp_p_nr; /**< The number of RTP Padding bits */
186 
187  /* RTP eXtension (R-X) flag */
188  uint8_t rtp_x:1; /**< The RTP eXtension (R-X) bits found in
189  extension header */
190  size_t rtp_x_nr; /**< The number of RTP X bits */
191 
192  /* RTP CSRC Count (CC) */
193  uint8_t rtp_cc:4; /**< The RTP CSRC Count bits found in dynamic
194  chain of IR/IR-DYN header */
195  size_t rtp_cc_nr; /**< The number of the RTP CSRC Count bits */
196 
197  /* RTP Marker (M) flag */
198  uint8_t rtp_m:1; /**< The RTP Marker (M) bits found in dynamic chain
199  of IR/IR-DYN header, UO* base header and
200  extension header */
201  size_t rtp_m_nr; /**< The number of the RTP Marker (M) bits */
202 
203  /* RTP Payload Type (RTP-PT) */
204  uint8_t rtp_pt:7; /**< The RTP Payload Type (PT) bits found in
205  dynamic chain of IR/IR-DYN header or in
206  extension header */
207  size_t rtp_pt_nr; /**< The number of RTP PT bits found in header */
208 
209  /* RTP TimeStamp (TS) */
210  uint32_t ts; /**< The TS bits found in dynamic chain of
211  IR/IR-DYN header, in UO* base header or in
212  extension header */
213  size_t ts_nr; /**< The number of TS bits found in ROHC header */
214  bool is_ts_scaled; /**< Whether TS is transmitted scaled or not */
215 
216  /* RTP Synchronization SouRCe (SSRC) identifier */
217  uint32_t rtp_ssrc; /**< The SSRC bits found in static chain of
218  IR header */
219  size_t rtp_ssrc_nr; /**< The number of SSRC bits found in header */
220 
221 
222  /* bits below are for ESP profile only
223  @todo TODO should be moved in d_esp.c */
224 
225  /* ESP Security Parameters Index (SPI) */
226  uint32_t esp_spi; /**< The SPI bits found in static chain of
227  IR header */
228  size_t esp_spi_nr; /**< The number of SPI bits found in header */
229 };
230 
231 
232 /** The outer or inner IP values decoded from the extracted ROHC bits */
234 {
235  uint8_t version:4; /**< The decoded version field */
236  uint8_t tos; /**< The decoded TOS/TC field */
237  uint16_t id; /**< The decoded IP-ID field (IPv4 only) */
238  uint8_t df:1; /**< The decoded DF field (IPv4 only) */
239  uint8_t ttl; /**< The decoded TTL/HL field */
240  uint8_t proto; /**< The decoded protocol/NH field */
241  uint8_t nbo:1; /**< The decoded NBO field (IPv4 only) */
242  uint8_t rnd:1; /**< The decoded RND field (IPv4 only) */
243  uint8_t sid:1; /**< The decoded SID field (IPv4 only) */
244  uint32_t flowid:20; /**< The decoded flow ID field (IPv6 only) */
245  uint8_t saddr[16]; /**< The decoded source address field */
246  uint8_t daddr[16]; /**< The decoded destination address field */
247 };
248 
249 
250 /**
251  * @brief The values decoded from the bits extracted from ROHC header
252  *
253  * @see decode_values_from_bits
254  * @see rtp_decode_values_from_bits
255  */
257 {
258  bool is_context_reused; /**< Whether the context is re-used or not */
259 
260  uint32_t sn; /**< The decoded SN value */
261 
262  rohc_mode_t mode; /**< The operation mode asked by compressor */
263 
264  /** Whether there are multiple IP headers or only one single IP header */
266  /** The decoded values for the outer IP header */
268  /** The decoded values for the inner IP header */
270 
271  /* bits below are for UDP-based profile only
272  @todo TODO should be moved in d_udp.c */
273  uint16_t udp_src; /**< The decoded UDP source port */
274  uint16_t udp_dst; /**< The decoded UDP destination port bits */
275  uint16_t udp_check; /**< The decoded UDP checksum */
276  rohc_tristate_t udp_check_present; /**< Whether the UDP checksum field is
277  encoded in the ROHC packet or not */
278 
279  /* bits below are for UDP-Lite-based profile only
280  @todo TODO should be moved in d_udp_lite.c */
282  rohc_tristate_t cfp; /**< TODO */
283  rohc_tristate_t cfi; /**< TODO */
284  uint16_t udp_lite_cc; /**< The decoded UDP-Lite CC */
285 
286  /* bits below are for RTP profile only
287  @todo TODO should be moved in d_rtp.c */
288  uint8_t rtp_version:2; /**< The decoded RTP version */
289  uint8_t rtp_p:1; /**< The decoded RTP Padding (R-P) flag */
290  uint8_t rtp_x:1; /**< The decoded RTP eXtension (R-X) flag */
291  uint8_t rtp_cc:4; /**< The decoded RTP CSRC Count */
292  uint8_t rtp_m:1; /**< The decoded RTP Marker (M) flag */
293  uint8_t rtp_pt:7; /**< The decoded RTP Payload Type (RTP-PT) */
294  uint32_t ts; /**< The decoded RTP TimeStamp (TS) value */
295  uint32_t rtp_ssrc; /**< The decoded SSRC value */
296 
297  /* bits below are for ESP profile only
298  @todo TODO should be moved in d_esp.c */
299  uint32_t esp_spi; /**< The decoded ESP SPI */
300 };
301 
302 
303 /**
304  * @brief Store information about an IP header between the different
305  * decompressions of IP packets.
306  *
307  * Defines an object that contains flags and structures related to an IP header
308  * and that need to be saved between the different decompressions of packets. A
309  * decompression context owns objects like this for the two first IP headers.
310  */
312 {
313  /// The IP header
314  struct ip_packet ip;
315 
316  /// Whether the IP-ID is considered as random or not (IPv4 only)
317  int rnd;
318  /// Whether the IP-ID is considered as coded in NBO or not (IPv4 only)
319  int nbo;
320  /// Whether the IP-ID is considered as static or not (IPv4 only)
321  int sid;
322 
323  /// The next header located after the IP header(s)
324  void *next_header;
325  /// The length of the next header
326  unsigned int next_header_len;
327 };
328 
329 
330 /**
331  * @brief The generic decompression context for RFC3095-based profiles
332  *
333  * The object defines the generic context that manages IP(/nextheader) and
334  * IP/IP(/nextheader) packets. nextheader is managed by the profile-specific
335  * part of the context.
336  */
338 {
339  /// Information about the outer IP header
341  /// Information about the inner IP header
343 
344  /** The LSB shift parameter for the Sequence Number (SN) */
346  /// The LSB decoding context for the Sequence Number (SN)
348  /// The IP-ID of the outer IP header
350  /// The IP-ID of the inner IP header
352 
353  /// The list decompressor of the outer IP header
355  /// The list decompressor of the inner IP header
357 
358  /// Whether the decompressed packet contains a 2nd IP header
360 
361  /* below are some information and handlers to manage the next header
362  * (if any) located just after the IP headers (1 or 2 IP headers) */
363 
364  /// The IP protocol ID of the protocol the context is able to decompress
365  unsigned short next_header_proto;
366 
367  /// The length of the next header
368  unsigned int next_header_len;
369 
370  /// @brief The handler used to parse the static part of the next header
371  /// in the ROHC packet
372  int (*parse_static_next_hdr)(const struct rohc_decomp_ctxt *const context,
373  const uint8_t *packet,
374  size_t length,
375  struct rohc_extr_bits *const bits);
376 
377  /// @brief The handler used to parse the dynamic part of the next header
378  /// in the ROHC packet
379  int (*parse_dyn_next_hdr)(const struct rohc_decomp_ctxt *const context,
380  const uint8_t *packet,
381  const size_t length,
382  struct rohc_extr_bits *const bits);
383 
384  /**
385  * @brief The handler used to parse the extension 3 of the UO* ROHC packet
386  *
387  * @param context The decompression context
388  * @param rohc_data The ROHC data to parse
389  * @param rohc_data_len The length of the ROHC data to parse
390  * @param packet_type The type of ROHC packet to parse
391  * @param bits IN: the bits already found in base header
392  * OUT: the bits found in the extension header 3
393  * @return The data length read from the ROHC packet,
394  * -2 in case packet must be reparsed,
395  * -1 in case of error
396  */
397  int (*parse_ext3)(const struct rohc_decomp_ctxt *const context,
398  const uint8_t *const rohc_data,
399  const size_t rohc_data_len,
401  struct rohc_extr_bits *const bits)
402  __attribute__((warn_unused_result, nonnull(1, 2, 5)));
403 
404  /// The handler used to parse the tail of the UO* ROHC packet
405  int (*parse_uo_remainder)(const struct rohc_decomp_ctxt *const context,
406  const uint8_t *packet,
407  unsigned int length,
408  struct rohc_extr_bits *const bits);
409 
410  /** The handler used to decode extracted for next header */
411  bool (*decode_values_from_bits)(const struct rohc_decomp_ctxt *context,
412  const struct rohc_extr_bits *const bits,
413  struct rohc_decoded_values *const decoded)
414  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
415 
416  /** The handler used to build the uncompressed next header */
417  int (*build_next_header)(const struct rohc_decomp_ctxt *const context,
418  const struct rohc_decoded_values *const decoded,
419  uint8_t *const dest,
420  const unsigned int payload_len);
421 
422  /// @brief The handler used to compute the CRC-STATIC value
423  uint8_t (*compute_crc_static)(const uint8_t *const ip,
424  const uint8_t *const ip2,
425  const uint8_t *const next_header,
426  const rohc_crc_type_t crc_type,
427  const uint8_t init_val,
428  const uint8_t *const crc_table);
429 
430  /// @brief The handler used to compute the CRC-DYNAMIC value
431  uint8_t (*compute_crc_dynamic)(const uint8_t *const ip,
432  const uint8_t *const ip2,
433  const uint8_t *const next_header,
434  const rohc_crc_type_t crc_type,
435  const uint8_t init_val,
436  const uint8_t *const crc_table);
437 
438  /** The handler used to update context with decoded next header fields */
439  void (*update_context)(struct rohc_decomp_ctxt *const context,
440  const struct rohc_decoded_values *const decoded)
441  __attribute__((nonnull(1, 2)));
442 
443  /// Profile-specific data
444  void *specific;
445 };
446 
447 
448 /*
449  * Public function prototypes.
450  */
451 
452 bool rohc_decomp_rfc3095_create(const struct rohc_decomp_ctxt *const context,
453  struct rohc_decomp_rfc3095_ctxt **const persist_ctxt,
454  struct rohc_decomp_volat_ctxt *const volat_ctxt,
455  rohc_trace_callback2_t trace_cb,
456  void *const trace_cb_priv,
457  const int profile_id)
458  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
459 
460 void rohc_decomp_rfc3095_destroy(struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt,
461  const struct rohc_decomp_volat_ctxt *const volat_ctxt)
462  __attribute__((nonnull(1, 2)));
463 
464 bool rfc3095_decomp_parse_pkt(const struct rohc_decomp_ctxt *const context,
465  const struct rohc_buf rohc_packet,
466  const size_t large_cid_len,
467  rohc_packet_t *const packet_type,
468  struct rohc_decomp_crc *const extr_crc,
469  struct rohc_extr_bits *const bits,
470  size_t *const rohc_hdr_len)
471  __attribute__((warn_unused_result, nonnull(1, 4, 5, 6, 7)));
472 
473 rohc_status_t rfc3095_decomp_build_hdrs(const struct rohc_decomp *const decomp,
474  const struct rohc_decomp_ctxt *const context,
475  const rohc_packet_t packet_type,
476  const struct rohc_decomp_crc *const extr_crc,
477  const struct rohc_decoded_values *const decoded,
478  const size_t payload_len,
479  struct rohc_buf *const uncomp_hdrs,
480  size_t *const uncomp_hdrs_len)
481  __attribute__((warn_unused_result, nonnull(1, 2, 4, 5, 7, 8)));
482 
483 bool rfc3095_decomp_decode_bits(const struct rohc_decomp_ctxt *const context,
484  const struct rohc_extr_bits *const bits,
485  const size_t payload_len __attribute__((unused)),
486  struct rohc_decoded_values *const decoded)
487  __attribute__((warn_unused_result, nonnull(1, 2, 4)));
488 
489 void rfc3095_decomp_update_ctxt(struct rohc_decomp_ctxt *const context,
490  const struct rohc_decoded_values *const decoded,
491  const size_t payload_len,
492  bool *const do_change_mode)
493  __attribute__((nonnull(1, 2, 4)));
494 
495 bool rfc3095_decomp_attempt_repair(const struct rohc_decomp *const decomp,
496  const struct rohc_decomp_ctxt *const context,
497  const struct rohc_ts pkt_arrival_time,
498  struct rohc_decomp_crc_corr_ctxt *const crc_corr,
499  struct rohc_extr_bits *const extr_bits)
500  __attribute__((warn_unused_result, nonnull(1, 2, 4, 5)));
501 
502 uint32_t rohc_decomp_rfc3095_get_sn(const struct rohc_decomp_ctxt *const context)
503  __attribute__((warn_unused_result, nonnull(1)));
504 
505 
506 
507 /*
508  * Helper functions
509  */
510 
511 
512 static inline bool is_ipv4_pkt(const struct rohc_extr_ip_bits *const bits)
513  __attribute__((warn_unused_result, pure, always_inline));
514 
515 static inline bool is_ipv4_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
516  __attribute__((warn_unused_result, pure, always_inline));
517 
518 static inline bool is_ipv4_non_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
519  __attribute__((warn_unused_result, pure, always_inline));
520 
521 
522 /**
523  * @brief Is the given IP header IPV4 wrt packet?
524  *
525  * @param bits The bits extracted from packet
526  * @return true if IPv4, false if IPv6
527  */
528 static inline bool is_ipv4_pkt(const struct rohc_extr_ip_bits *const bits)
529 {
530  return (bits->version == IPV4);
531 }
532 
533 
534 /**
535  * @brief Is the given IP header IPv4 and its IP-ID random wrt packet?
536  *
537  * @param bits The bits extracted from packet
538  * @return true if IPv4 and random, false otherwise
539  */
540 static inline bool is_ipv4_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
541 {
542  return (is_ipv4_pkt(bits) && bits->rnd == 1);
543 }
544 
545 
546 /**
547  * @brief Is the given IP header IPv4 and its IP-ID non-random wrt packet?
548  *
549  * @param bits The bits extracted from packet
550  * @return true if IPv4 and non-random, false otherwise
551  */
552 static inline bool is_ipv4_non_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
553 {
554  return (is_ipv4_pkt(bits) && bits->rnd == 0);
555 }
556 
557 
558 #endif
559 
bool rfc3095_decomp_parse_pkt(const struct rohc_decomp_ctxt *const context, const struct rohc_buf rohc_packet, const size_t large_cid_len, rohc_packet_t *const packet_type, struct rohc_decomp_crc *const extr_crc, struct rohc_extr_bits *const bits, size_t *const rohc_hdr_len)
Parse one IR, IR-DYN, UO-0, UO-1*, or UOR-2* packet.
Definition: rohc_decomp_rfc3095.c:536
rohc_lsb_shift_t
the different values of the shift parameter of the LSB algorithm
Definition: interval.h:42
struct rohc_extr_ip_bits inner_ip
Definition: rohc_decomp_rfc3095.h:133
static bool is_ipv4_pkt(const struct rohc_extr_ip_bits *const bits)
Is the given IP header IPV4 wrt packet?
Definition: rohc_decomp_rfc3095.h:528
uint32_t sn
Definition: rohc_decomp_rfc3095.h:260
uint8_t proto
Definition: rohc_decomp_rfc3095.h:76
uint32_t esp_spi
Definition: rohc_decomp_rfc3095.h:226
The ROHC decompressor.
Definition: rohc_decomp_internals.h:142
size_t udp_dst_nr
Definition: rohc_decomp_rfc3095.h:152
size_t rtp_ssrc_nr
Definition: rohc_decomp_rfc3095.h:219
uint8_t rtp_pt
Definition: rohc_decomp_rfc3095.h:204
rohc_tristate_t cfi
Definition: rohc_decomp_rfc3095.h:283
uint8_t saddr[16]
Definition: rohc_decomp_rfc3095.h:245
int(* parse_static_next_hdr)(const struct rohc_decomp_ctxt *const context, const uint8_t *packet, size_t length, struct rohc_extr_bits *const bits)
The handler used to parse the static part of the next header in the ROHC packet.
Definition: rohc_decomp_rfc3095.h:372
uint16_t udp_lite_cc
Definition: rohc_decomp_rfc3095.h:168
uint32_t sn
Definition: rohc_decomp_rfc3095.h:118
rohc_mode_t
ROHC operation modes.
Definition: rohc.h:111
int(* parse_ext3)(const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_data, const size_t rohc_data_len, const rohc_packet_t packet_type, struct rohc_extr_bits *const bits)
The handler used to parse the extension 3 of the UO* ROHC packet.
Definition: rohc_decomp_rfc3095.h:397
size_t rtp_pt_nr
Definition: rohc_decomp_rfc3095.h:207
static bool is_ipv4_non_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
Is the given IP header IPv4 and its IP-ID non-random wrt packet?
Definition: rohc_decomp_rfc3095.h:552
uint16_t udp_lite_cc
Definition: rohc_decomp_rfc3095.h:284
The generic decompression context for RFC3095-based profiles.
Definition: rohc_decomp_rfc3095.h:337
rohc_tristate_t udp_check_present
Definition: rohc_decomp_rfc3095.h:154
The volatile part of the ROHC decompression context.
Definition: rohc_decomp_internals.h:256
bool rohc_decomp_rfc3095_create(const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt, rohc_trace_callback2_t trace_cb, void *const trace_cb_priv, const int profile_id)
Create the RFC3095 volatile and persistent parts of the context.
Definition: rohc_decomp_rfc3095.c:364
rohc_packet_t packet_type
Definition: rohc_decomp_internals.h:310
uint8_t rnd
Definition: rohc_decomp_rfc3095.h:242
size_t nbo_nr
Definition: rohc_decomp_rfc3095.h:82
uint8_t rtp_cc
Definition: rohc_decomp_rfc3095.h:193
rohc_status_t
The status code of several functions in the library API.
Definition: rohc.h:79
uint8_t version
Definition: rohc_decomp_rfc3095.h:235
size_t tos_nr
Definition: rohc_decomp_rfc3095.h:60
struct rohc_decomp_rfc3095_changes * inner_ip_changes
Information about the inner IP header.
Definition: rohc_decomp_rfc3095.h:342
unsigned int next_header_len
The length of the next header.
Definition: rohc_decomp_rfc3095.h:368
uint8_t sid
Definition: rohc_decomp_rfc3095.h:88
uint16_t udp_src
Definition: rohc_decomp_rfc3095.h:146
The bits extracted from ROHC UO* base headers.
Definition: rohc_decomp_rfc3095.h:113
The context for list decompression.
Definition: decomp_list.h:51
ROHC CRC routines.
struct rohc_decomp_rfc3095_changes * outer_ip_changes
Information about the outer IP header.
Definition: rohc_decomp_rfc3095.h:340
uint8_t rtp_m
Definition: rohc_decomp_rfc3095.h:292
rohc_packet_cce_t cce_pkt
Definition: rohc_decomp_rfc3095.h:165
size_t rtp_x_nr
Definition: rohc_decomp_rfc3095.h:190
size_t rtp_p_nr
Definition: rohc_decomp_rfc3095.h:185
uint32_t ts
Definition: rohc_decomp_rfc3095.h:210
uint8_t(* compute_crc_dynamic)(const uint8_t *const ip, const uint8_t *const ip2, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
The handler used to compute the CRC-DYNAMIC value.
Definition: rohc_decomp_rfc3095.h:431
size_t rtp_m_nr
Definition: rohc_decomp_rfc3095.h:201
Internal structures for ROHC decompression.
bool(* decode_values_from_bits)(const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits *const bits, struct rohc_decoded_values *const decoded)
Definition: rohc_decomp_rfc3095.h:411
struct list_decomp list_decomp1
The list decompressor of the outer IP header.
Definition: rohc_decomp_rfc3095.h:354
rohc_lsb_ref_t lsb_ref_type
Definition: rohc_decomp_rfc3095.h:121
The Least Significant Bits (LSB) decoding object.
Definition: decomp_wlsb.c:45
void(* rohc_trace_callback2_t)(void *const priv_ctxt, const rohc_trace_level_t level, const rohc_trace_entity_t entity, const int profile, const char *const format,...)
The function prototype for the trace callback.
Definition: rohc_traces.h:118
int(* parse_dyn_next_hdr)(const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits)
The handler used to parse the dynamic part of the next header in the ROHC packet. ...
Definition: rohc_decomp_rfc3095.h:379
size_t saddr_nr
Definition: rohc_decomp_rfc3095.h:98
rohc_tristate_t cfi
Definition: rohc_decomp_rfc3095.h:167
rohc_packet_cce_t
Definition: udp_lite.h:32
Miscellaneous utils for ROHC libraries.
rohc_lsb_shift_t sn_lsb_p
Definition: rohc_decomp_rfc3095.h:345
size_t id_nr
Definition: rohc_decomp_rfc3095.h:65
Defines a IP-ID object to help computing the IP-ID value from an IP-ID offset.
Definition: decomp/schemes/ip_id_offset.c:41
uint8_t rtp_p
Definition: rohc_decomp_rfc3095.h:289
uint16_t id
Definition: rohc_decomp_rfc3095.h:237
Define the UDP-Lite protocol.
uint8_t rtp_version
Definition: rohc_decomp_rfc3095.h:288
void rfc3095_decomp_update_ctxt(struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, const size_t payload_len, bool *const do_change_mode)
Update context with decoded values.
Definition: rohc_decomp_rfc3095.c:6110
uint8_t df
Definition: rohc_decomp_rfc3095.h:238
uint16_t udp_check
Definition: rohc_decomp_rfc3095.h:156
uint8_t(* compute_crc_static)(const uint8_t *const ip, const uint8_t *const ip2, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
The handler used to compute the CRC-STATIC value.
Definition: rohc_decomp_rfc3095.h:423
rohc_tristate_t cfp
Definition: rohc_decomp_rfc3095.h:166
void(* update_context)(struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded)
Definition: rohc_decomp_rfc3095.h:439
void * next_header
The next header located after the IP header(s)
Definition: rohc_decomp_rfc3095.h:324
bool is_sn_enc
Definition: rohc_decomp_rfc3095.h:120
rohc_status_t rfc3095_decomp_build_hdrs(const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const rohc_packet_t packet_type, const struct rohc_decomp_crc *const extr_crc, const struct rohc_decoded_values *const decoded, const size_t payload_len, struct rohc_buf *const uncomp_hdrs, size_t *const uncomp_hdrs_len)
Build the uncompressed headers.
Definition: rohc_decomp_rfc3095.c:4961
size_t esp_spi_nr
Definition: rohc_decomp_rfc3095.h:228
size_t rnd_nr
Definition: rohc_decomp_rfc3095.h:86
uint8_t rtp_x
Definition: rohc_decomp_rfc3095.h:188
uint16_t udp_dst
Definition: rohc_decomp_rfc3095.h:274
void * specific
Profile-specific data.
Definition: rohc_decomp_rfc3095.h:444
uint8_t daddr[16]
Definition: rohc_decomp_rfc3095.h:100
uint8_t df
Definition: rohc_decomp_rfc3095.h:68
uint8_t ttl
Definition: rohc_decomp_rfc3095.h:239
uint8_t proto
Definition: rohc_decomp_rfc3095.h:240
uint16_t udp_src
Definition: rohc_decomp_rfc3095.h:273
size_t rtp_version_nr
Definition: rohc_decomp_rfc3095.h:180
uint8_t sid
Definition: rohc_decomp_rfc3095.h:243
uint32_t flowid
Definition: rohc_decomp_rfc3095.h:244
size_t daddr_nr
Definition: rohc_decomp_rfc3095.h:102
uint8_t rnd
Definition: rohc_decomp_rfc3095.h:84
size_t rtp_cc_nr
Definition: rohc_decomp_rfc3095.h:195
bool multiple_ip
Definition: rohc_decomp_rfc3095.h:127
uint16_t id
Definition: rohc_decomp_rfc3095.h:62
struct rohc_extr_ip_bits outer_ip
Definition: rohc_decomp_rfc3095.h:130
unsigned int next_header_len
The length of the next header.
Definition: rohc_decomp_rfc3095.h:326
uint32_t ts
Definition: rohc_decomp_rfc3095.h:294
int(* build_next_header)(const struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, uint8_t *const dest, const unsigned int payload_len)
Definition: rohc_decomp_rfc3095.h:417
Window-based Least Significant Bits (W-LSB) decoding.
size_t udp_check_nr
Definition: rohc_decomp_rfc3095.h:159
size_t udp_src_nr
Definition: rohc_decomp_rfc3095.h:148
size_t proto_nr
Definition: rohc_decomp_rfc3095.h:78
uint32_t rtp_ssrc
Definition: rohc_decomp_rfc3095.h:295
rohc_crc_type_t
Definition: crc.h:56
A network buffer for the ROHC library.
Definition: rohc_buf.h:104
Store information about an IP header between the different decompressions of IP packets.
Definition: rohc_decomp_rfc3095.h:311
struct ip_id_offset_decode * outer_ip_id_offset_ctxt
The IP-ID of the outer IP header.
Definition: rohc_decomp_rfc3095.h:349
uint8_t rtp_cc
Definition: rohc_decomp_rfc3095.h:291
unsigned short next_header_proto
The IP protocol ID of the protocol the context is able to decompress.
Definition: rohc_decomp_rfc3095.h:365
A timestamp for the ROHC library.
Definition: rohc_time.h:51
uint16_t udp_check
Definition: rohc_decomp_rfc3095.h:275
rohc_tristate_t udp_check_present
Definition: rohc_decomp_rfc3095.h:276
uint8_t tos
Definition: rohc_decomp_rfc3095.h:236
struct ip_packet ip
The IP header.
Definition: rohc_decomp_rfc3095.h:314
bool rfc3095_decomp_decode_bits(const struct rohc_decomp_ctxt *const context, const struct rohc_extr_bits *const bits, const size_t payload_len, struct rohc_decoded_values *const decoded)
Decode values from extracted bits.
Definition: rohc_decomp_rfc3095.c:5604
uint8_t rtp_x
Definition: rohc_decomp_rfc3095.h:290
ROHC generic list decompression.
Definition: rohc_decomp_rfc3095.h:233
static bool is_ipv4_rnd_pkt(const struct rohc_extr_ip_bits *const bits)
Is the given IP header IPv4 and its IP-ID random wrt packet?
Definition: rohc_decomp_rfc3095.h:540
size_t mode_nr
Definition: rohc_decomp_rfc3095.h:140
size_t df_nr
Definition: rohc_decomp_rfc3095.h:70
int(* parse_uo_remainder)(const struct rohc_decomp_ctxt *const context, const uint8_t *packet, unsigned int length, struct rohc_extr_bits *const bits)
The handler used to parse the tail of the UO* ROHC packet.
Definition: rohc_decomp_rfc3095.h:405
size_t ttl_nr
Definition: rohc_decomp_rfc3095.h:74
uint32_t rtp_ssrc
Definition: rohc_decomp_rfc3095.h:217
bool is_ts_scaled
Definition: rohc_decomp_rfc3095.h:214
struct rohc_lsb_decode * sn_lsb_ctxt
The LSB decoding context for the Sequence Number (SN)
Definition: rohc_decomp_rfc3095.h:347
int rnd
Whether the IP-ID is considered as random or not (IPv4 only)
Definition: rohc_decomp_rfc3095.h:317
Definition: rohc_decomp_internals.h:241
Definition of ROHC packets and extensions.
uint8_t version
Definition: rohc_decomp_rfc3095.h:55
struct rohc_decoded_ip_values outer_ip
Definition: rohc_decomp_rfc3095.h:267
The ROHC decompression context.
Definition: rohc_decomp_internals.h:274
uint8_t nbo
Definition: rohc_decomp_rfc3095.h:241
uint8_t rtp_m
Definition: rohc_decomp_rfc3095.h:198
rohc_tristate_t cfp
Definition: rohc_decomp_rfc3095.h:282
uint16_t udp_dst
Definition: rohc_decomp_rfc3095.h:150
struct ip_id_offset_decode * inner_ip_id_offset_ctxt
The IP-ID of the inner IP header.
Definition: rohc_decomp_rfc3095.h:351
bool is_context_reused
Definition: rohc_decomp_rfc3095.h:115
Definition: rohc_decomp_internals.h:223
uint8_t rtp_p
Definition: rohc_decomp_rfc3095.h:183
int nbo
Whether the IP-ID is considered as coded in NBO or not (IPv4 only)
Definition: rohc_decomp_rfc3095.h:319
rohc_lsb_ref_t
Definition: decomp_wlsb.h:47
void rohc_decomp_rfc3095_destroy(struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy the context.
Definition: rohc_decomp_rfc3095.c:482
bool multiple_ip
Definition: rohc_decomp_rfc3095.h:265
size_t flowid_nr
Definition: rohc_decomp_rfc3095.h:94
bool sn_ref_offset
Definition: rohc_decomp_rfc3095.h:123
bool is_context_reused
Definition: rohc_decomp_rfc3095.h:258
Defines an IP-agnostic packet that can handle an IPv4 or IPv6 packet.
Definition: ip.h:81
IP version 4.
Definition: ip.h:56
size_t udp_lite_cc_nr
Definition: rohc_decomp_rfc3095.h:171
uint8_t saddr[16]
Definition: rohc_decomp_rfc3095.h:96
struct rohc_decoded_ip_values inner_ip
Definition: rohc_decomp_rfc3095.h:269
uint8_t ext_flag
Definition: rohc_decomp_rfc3095.h:136
size_t sid_nr
Definition: rohc_decomp_rfc3095.h:90
rohc_mode_t mode
Definition: rohc_decomp_rfc3095.h:262
The values decoded from the bits extracted from ROHC header.
Definition: rohc_decomp_rfc3095.h:256
uint32_t rohc_decomp_rfc3095_get_sn(const struct rohc_decomp_ctxt *const context)
Get the reference SN value of the context.
Definition: rohc_decomp_rfc3095.c:1354
uint32_t flowid
Definition: rohc_decomp_rfc3095.h:92
size_t sn_nr
Definition: rohc_decomp_rfc3095.h:119
uint8_t rtp_version
Definition: rohc_decomp_rfc3095.h:178
uint8_t nbo
Definition: rohc_decomp_rfc3095.h:80
uint8_t ttl
Definition: rohc_decomp_rfc3095.h:72
rohc_tristate_t
Definition: rohc_utils.h:33
rohc_packet_cce_t cce_pkt
Definition: rohc_decomp_rfc3095.h:281
uint8_t tos
Definition: rohc_decomp_rfc3095.h:58
ROHC decompression routines.
struct list_decomp list_decomp2
The list decompressor of the inner IP header.
Definition: rohc_decomp_rfc3095.h:356
uint8_t rtp_pt
Definition: rohc_decomp_rfc3095.h:293
Definition: rohc_decomp_rfc3095.h:53
rohc_packet_t
The different types of ROHC packets.
Definition: rohc_packets.h:49
uint8_t daddr[16]
Definition: rohc_decomp_rfc3095.h:246
uint8_t mode
Definition: rohc_decomp_rfc3095.h:139
int sid
Whether the IP-ID is considered as static or not (IPv4 only)
Definition: rohc_decomp_rfc3095.h:321
uint32_t esp_spi
Definition: rohc_decomp_rfc3095.h:299
bool is_id_enc
Definition: rohc_decomp_rfc3095.h:66
int multiple_ip
Whether the decompressed packet contains a 2nd IP header.
Definition: rohc_decomp_rfc3095.h:359
bool rfc3095_decomp_attempt_repair(const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const struct rohc_ts pkt_arrival_time, struct rohc_decomp_crc_corr_ctxt *const crc_corr, struct rohc_extr_bits *const extr_bits)
Attempt a packet/context repair upon CRC failure.
Definition: rohc_decomp_rfc3095.c:5407
size_t ts_nr
Definition: rohc_decomp_rfc3095.h:213