ROHC compression/decompression library
rohc_comp_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,2014 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_comp_rfc3095.h
23  * @brief Generic framework for RFC3095-based compression 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  */
28 
29 #ifndef ROHC_COMP_RFC3095_H
30 #define ROHC_COMP_RFC3095_H
31 
32 #include "rohc_comp_internals.h"
33 #include "rohc_packets.h"
34 #include "schemes/comp_list.h"
35 #include "ip.h"
36 #include "crc.h"
37 
38 #include <stdlib.h>
39 
40 
41 /**
42  * @brief Store information about an IPv4 header between the different
43  * compressions of IP packets.
44  *
45  * Defines an object that contains counters, flags and structures related to an
46  * IPv4 header and that need to be saved between the different compressions of
47  * packets. A compression context owns objects like this for the two first
48  * IPv4 headers.
49  */
51 {
52  /// A window to store the IP-ID
54 
55  /// The previous IP header
56  struct ipv4_hdr old_ip;
57 
58  /// The number of times the DF field was added to the compressed header
59  size_t df_count;
60  /// @brief The number of times the IP-ID is specified as random in the
61  /// compressed header
62  size_t rnd_count;
63  /// @brief The number of times the IP-ID is specified as coded in Network
64  /// Byte Order (NBO) in the compressed header
65  size_t nbo_count;
66  /// @brief The number of times the IP-ID is specified as static in the
67  /// compressed header
68  size_t sid_count;
69 
70  /// Whether the IP-ID is considered as random or not
71  int rnd;
72  /// Whether the IP-ID is considered as coded in NBO or not
73  int nbo;
74  /// Whether the IP-ID is considered as static or not
75  int sid;
76  /// @brief Whether the IP-ID of the previous IP header was considered as
77  /// random or not
78  int old_rnd;
79  /// @brief Whether the IP-ID of the previous IP header was considered as
80  /// coded in NBO or not
81  int old_nbo;
82  /// @brief Whether the IP-ID of the previous IP header was considered as
83  /// static or not
84  int old_sid;
85 
86  /// The delta between the IP-ID and the current Sequence Number (SN)
87  /// (overflow over 16 bits is expected when SN > IP-ID)
88  uint16_t id_delta;
89 };
90 
91 
92 /**
93  * @brief Store information about an IPv6 header between the different
94  * compressions of IP packets.
95  *
96  * Defines an object that contains counters, flags and structures related to an
97  * IPv6 header and that need to be saved between the different compressions of
98  * packets. A compression context owns objects like this for the two first
99  * IPv6 headers.
100  */
102 {
103  /// The previous IPv6 header
104  struct ipv6_hdr old_ip;
105  /// The extension compressor
106  struct list_comp ext_comp;
107 };
108 
109 
110 /**
111  * @brief Store information about an IP (IPv4 or IPv6) header between the
112  * different compressions of IP packets.
113  */
115 {
116  ip_version version; ///< The version of the IP header
118 
119  /// The number of times the TOS/TC field was added to the compressed header
120  size_t tos_count;
121  /// The number of times the TTL/HL field was added to the compressed header
122  size_t ttl_count;
123  /// @brief The number of times the Protocol/Next Header field was added to
124  /// the compressed header
126 
127  /** Whether the old_* members of the struct and in its children are
128  * initialized or not */
130 
131  union
132  {
133  struct ipv4_header_info v4; ///< The IPv4-specific header info
134  struct ipv6_header_info v6; ///< The IPv6-specific header info
135  } info; ///< The version specific header info
136 };
137 
138 
139 /**
140  * @brief Structure that contains variables that are used during one single
141  * compression of packet.
142  *
143  * Structure that contains variables that are temporary, i.e. variables that
144  * will only be used for the compression of the current packet. These variables
145  * must be reinitialized every time a new packet arrive.
146  *
147  * @see c_init_tmp_variables
148  */
150 {
151  /// The number of fields that changed in the outer IP header
152  unsigned short changed_fields;
153  /// The number of fields that changed in the inner IP header
154  unsigned short changed_fields2;
155  /// The number of static fields that changed in the two IP headers
157  /// The number of dynamic fields that changed in the two IP headers
159 
160  /// The number of bits needed to encode the Sequence Number (SN)
162  /// The number of bits needed to encode the Sequence Number (SN)
164 
165  /// The number of bits needed to encode the IP-ID of the outer IP header
167  /// The number of bits needed to encode the IP-ID of the inner IP header
169 
170  /// The type of packet the compressor must send: IR, IR-DYN, UO*
172 };
173 
174 
175 /**
176  * @brief The generic decompression context for RFC3095-based profiles
177  *
178  * The object defines the generic context that manages IP(/nextheader) and
179  * IP/IP(/nextheader) packets. nextheader is managed by the profile-specific
180  * part of the context.
181  */
183 {
184  /// The Sequence Number (SN), may be 16-bit or 32-bit long
185  uint32_t sn;
186  /// A window used to encode the SN
187  struct c_wlsb sn_window;
188 
189  /** The SN of the last packet that updated the context (used to determine
190  * if a positive ACK may cause a transition to a higher compression state) */
192  /** The W-LSB for non-acknowledged MSN */
193  struct c_wlsb msn_non_acked;
194 
195  /** The number of IP headers */
196  size_t ip_hdr_nr;
197  /// Information about the outer IP header
198  struct ip_header_info outer_ip_flags;
199  /// Information about the inner IP header
200  struct ip_header_info inner_ip_flags;
201 
202  /** Whether the cache for the CRC-3 value on CRC-STATIC fields is initialized or not */
204  /** The cache for the CRC-3 value on CRC-STATIC fields */
206  /** Whether the cache for the CRC-7 value on CRC-STATIC fields is initialized or not */
208  /** The cache for the CRC-7 value on CRC-STATIC fields */
210 
211  /// Temporary variables that are used during one single compression of packet
212  struct generic_tmp_vars tmp;
213 
214  /* below are some information and handlers to manage the next header
215  * (if any) located just after the IP headers (1 or 2 IP headers) */
216 
217  /// The protocol number registered by IANA for the next header protocol
218  unsigned int next_header_proto;
219  /// The length of the next header
220  unsigned int next_header_len;
221 
222  /** The handler for encoding profile-specific uncompressed header fields */
223  bool (*encode_uncomp_fields)(struct rohc_comp_ctxt *const context,
224  const struct net_pkt *const uncomp_pkt)
225  __attribute__((warn_unused_result, nonnull(1, 2)));
226 
227  /// @brief The handler used to decide the state that should be used for the
228  /// next packet
229  void (*decide_state)(struct rohc_comp_ctxt *const context);
230  /** @brief The handler used to decide which packet to send in FO state */
231  rohc_packet_t (*decide_FO_packet)(const struct rohc_comp_ctxt *context);
232  /** @brief The handler used to decide which packet to send in SO state */
233  rohc_packet_t (*decide_SO_packet)(const struct rohc_comp_ctxt *context);
234  /** The handler used to decide which extension to send */
235  rohc_ext_t (*decide_extension)(const struct rohc_comp_ctxt *context);
236 
237  /// The handler used to initialize some data just before the IR packet build
238  void (*init_at_IR)(struct rohc_comp_ctxt *const context,
239  const uint8_t *const next_header);
240 
241  /** Determine the next SN value */
242  uint32_t (*get_next_sn)(const struct rohc_comp_ctxt *const context,
243  const struct net_pkt *const uncomp_pkt)
244  __attribute__((warn_unused_result, nonnull(1, 2)));
245 
246  /// @brief The handler used to add the static part of the next header to the
247  /// ROHC packet
248  size_t (*code_static_part)(const struct rohc_comp_ctxt *const context,
249  const uint8_t *const next_header,
250  uint8_t *const dest,
251  const size_t counter)
252  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
253 
254  /// @brief The handler used to add the dynamic part of the next header to the
255  /// ROHC pachet
256  size_t (*code_dynamic_part)(const struct rohc_comp_ctxt *const context,
257  const uint8_t *const next_header,
258  uint8_t *const dest,
259  const size_t counter)
260  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
261 
262  /// @brief The handler used to add the IR/IR-DYN remainder header to the
263  /// ROHC pachet
264  int (*code_ir_remainder)(const struct rohc_comp_ctxt *const context,
265  uint8_t *const dest,
266  const size_t dest_max_len,
267  const size_t counter)
268  __attribute__((warn_unused_result, nonnull(1, 2)));
269 
270  /// @brief The handler used to add an additional header in the head of the
271  /// UO-0, UO-1 and UO-2 packets
272  size_t (*code_UO_packet_head)(const struct rohc_comp_ctxt *const context,
273  const uint8_t *const next_header,
274  uint8_t *const dest,
275  const size_t counter,
276  size_t *const first_position)
277  __attribute__((warn_unused_result, nonnull(1,2, 3, 5)));
278 
279  /// @brief The handler used to add an additional header in the tail of the
280  /// UO-0, UO-1 and UO-2 packets
281  size_t (*code_uo_remainder)(const struct rohc_comp_ctxt *const context,
282  const uint8_t *const next_header,
283  uint8_t *const dest,
284  const size_t counter)
285  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
286 
287  /// @brief The handler used to compute the CRC-STATIC value
288  uint8_t (*compute_crc_static)(const uint8_t *const ip,
289  const uint8_t *const ip2,
290  const uint8_t *const next_header,
291  const rohc_crc_type_t crc_type,
292  const uint8_t init_val,
293  const uint8_t *const crc_table)
294  __attribute__((nonnull(1, 3, 6), warn_unused_result));
295 
296  /// @brief The handler used to compute the CRC-DYNAMIC value
297  uint8_t (*compute_crc_dynamic)(const uint8_t *const ip,
298  const uint8_t *const ip2,
299  const uint8_t *const next_header,
300  const rohc_crc_type_t crc_type,
301  const uint8_t init_val,
302  const uint8_t *const crc_table)
303  __attribute__((nonnull(1, 3, 6), warn_unused_result));
304 
305  /// Profile-specific data
306  void *specific;
307 };
308 
309 
310 /*
311  * Function prototypes.
312  */
313 
314 bool rohc_comp_rfc3095_create(struct rohc_comp_ctxt *const context,
315  const size_t sn_bits_nr,
316  const rohc_lsb_shift_t sn_shift,
317  const struct net_pkt *const packet)
318  __attribute__((warn_unused_result, nonnull(1, 4)));
319 
320 void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
321  __attribute__((nonnull(1)));
322 
323 bool rohc_comp_rfc3095_check_profile(const struct rohc_comp *const comp,
324  const struct net_pkt *const packet)
325  __attribute__((warn_unused_result, nonnull(1, 2)));
326 
327 rohc_ext_t decide_extension(const struct rohc_comp_ctxt *const context)
328  __attribute__((warn_unused_result, nonnull(1)));
329 
330 int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context,
331  const struct net_pkt *const uncomp_pkt,
332  uint8_t *const rohc_pkt,
333  const size_t rohc_pkt_max_len,
334  rohc_packet_t *const packet_type,
335  size_t *const payload_offset)
336  __attribute__((warn_unused_result, nonnull(1, 2, 3, 5, 6)));
337 
338 bool rohc_comp_rfc3095_feedback(struct rohc_comp_ctxt *const context,
339  const enum rohc_feedback_type feedback_type,
340  const uint8_t *const packet,
341  const size_t packet_len,
342  const uint8_t *const feedback_data,
343  const size_t feedback_data_len)
344  __attribute__((warn_unused_result, nonnull(1, 3, 5)));
345 
346 void rohc_comp_rfc3095_decide_state(struct rohc_comp_ctxt *const context)
347  __attribute__((nonnull(1)));
348 
349 void rohc_get_ipid_bits(const struct rohc_comp_ctxt *const context,
350  size_t *const nr_innermost_bits,
351  size_t *const nr_outermost_bits)
352  __attribute__((nonnull(1, 2, 3)));
353 
354 bool rohc_comp_rfc3095_is_sn_possible(const struct rohc_comp_rfc3095_ctxt *const rfc3095_ctxt,
355  const size_t bits_nr,
356  const size_t add_bits_nr)
357  __attribute__((warn_unused_result, nonnull(1), pure));
358 
359 
360 /**
361  * @brief Does the outer IP header require to transmit no non-random IP-ID bit?
362  *
363  * @param ctxt The generic decompression context
364  * @return true if no required outer IP-ID bit shall be transmitted,
365  * false otherwise
366  */
367 static inline bool no_outer_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
368 {
369  return (ctxt->outer_ip_flags.version != IPV4 ||
370  ctxt->outer_ip_flags.info.v4.rnd == 1 ||
371  ctxt->tmp.nr_ip_id_bits == 0);
372 }
373 
374 
375 /**
376  * @brief May the outer IP header transmit the required non-random IP-ID bits?
377  *
378  * @param ctxt The generic decompression context
379  * @param max_ip_id_bits_nr The maximum number of IP-ID bits that may be transmitted
380  * @return true if the required IP-ID bits may be transmitted,
381  * false otherwise
382  */
383 static inline bool is_outer_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt,
384  const size_t max_ip_id_bits_nr)
385 {
386  return (ctxt->outer_ip_flags.version == IPV4 &&
387  ctxt->outer_ip_flags.info.v4.rnd != 1 &&
388  ctxt->tmp.nr_ip_id_bits <= max_ip_id_bits_nr);
389 }
390 
391 
392 /**
393  * @brief Does the inner IP header require to transmit no non-random IP-ID bit?
394  *
395  * @param ctxt The generic decompression context
396  * @return true if no required inner IP-ID bit shall be transmitted,
397  * false otherwise
398  */
399 static inline bool no_inner_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
400 {
401  return (ctxt->inner_ip_flags.version != IPV4 ||
402  ctxt->inner_ip_flags.info.v4.rnd == 1 ||
403  ctxt->tmp.nr_ip_id_bits2 == 0);
404 }
405 
406 
407 /**
408  * @brief May the inner IP header transmit the required non-random IP-ID bits?
409  *
410  * @param ctxt The generic decompression context
411  * @param max_ip_id_bits_nr The maximum number of IP-ID bits that may be transmitted
412  * @return true if the required IP-ID bits may be transmitted,
413  * false otherwise
414  */
415 static inline bool is_inner_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt,
416  const size_t max_ip_id_bits_nr)
417 {
418  return (ctxt->inner_ip_flags.version == IPV4 &&
419  ctxt->inner_ip_flags.info.v4.rnd != 1 &&
420  ctxt->tmp.nr_ip_id_bits2 <= max_ip_id_bits_nr);
421 }
422 
423 
424 /**
425  * @brief How many IP headers are IPv4 headers with non-random IP-IDs ?
426  *
427  * @param ctxt The generic decompression context
428  * @return The number of IPv4 headers with non-random IP-ID fields
429  */
430 static inline size_t get_nr_ipv4_non_rnd(const struct rohc_comp_rfc3095_ctxt *const ctxt)
431 {
432  size_t nr_ipv4_non_rnd = 0;
433 
434  /* outer IP header */
435  if(ctxt->outer_ip_flags.version == IPV4 && ctxt->outer_ip_flags.info.v4.rnd != 1)
436  {
437  nr_ipv4_non_rnd++;
438  }
439 
440  /* optional inner IP header */
441  if(ctxt->ip_hdr_nr >= 1 &&
442  ctxt->inner_ip_flags.version == IPV4 &&
443  ctxt->inner_ip_flags.info.v4.rnd != 1)
444  {
445  nr_ipv4_non_rnd++;
446  }
447 
448  return nr_ipv4_non_rnd;
449 }
450 
451 
452 /**
453  * @brief How many IP headers are IPv4 headers with non-random IP-IDs and some
454  * bits to transmit ?
455  *
456  * @param ctxt The generic decompression context
457  * @return The number of IPv4 headers with non-random IP-ID fields and some
458  * bits to transmit
459  */
460 static inline size_t get_nr_ipv4_non_rnd_with_bits(const struct rohc_comp_rfc3095_ctxt *const ctxt)
461 {
462  size_t nr_ipv4_non_rnd_with_bits = 0;
463 
464  /* outer IP header */
465  if(ctxt->outer_ip_flags.version == IPV4 &&
466  ctxt->outer_ip_flags.info.v4.rnd != 1 &&
467  ctxt->tmp.nr_ip_id_bits > 0)
468  {
469  nr_ipv4_non_rnd_with_bits++;
470  }
471 
472  /* optional inner IP header */
473  if(ctxt->ip_hdr_nr >= 1 &&
474  ctxt->inner_ip_flags.version == IPV4 &&
475  ctxt->inner_ip_flags.info.v4.rnd != 1 &&
476  ctxt->tmp.nr_ip_id_bits2 > 0)
477  {
478  nr_ipv4_non_rnd_with_bits++;
479  }
480 
481  return nr_ipv4_non_rnd_with_bits;
482 }
483 
484 
485 #endif
486 
uint8_t crc_static_7_cached
Definition: rohc_comp_rfc3095.h:209
uint32_t sn
The Sequence Number (SN), may be 16-bit or 32-bit long.
Definition: rohc_comp_rfc3095.h:185
unsigned short changed_fields2
The number of fields that changed in the inner IP header.
Definition: rohc_comp_rfc3095.h:154
rohc_lsb_shift_t
the different values of the shift parameter of the LSB algorithm
Definition: interval.h:47
unsigned int next_header_len
The length of the next header.
Definition: rohc_comp_rfc3095.h:220
bool is_first_header
Definition: rohc_comp_rfc3095.h:129
struct ip_header_info inner_ip_flags
Information about the inner IP header.
Definition: rohc_comp_rfc3095.h:200
size_t tos_count
The number of times the TOS/TC field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:120
size_t sid_count
The number of times the IP-ID is specified as static in the compressed header.
Definition: rohc_comp_rfc3095.h:68
bool rohc_comp_rfc3095_create(struct rohc_comp_ctxt *const context, const size_t sn_bits_nr, const rohc_lsb_shift_t sn_shift, const struct net_pkt *const packet)
Create a new context and initialize it thanks to the given IP packet.
Definition: rohc_comp_rfc3095.c:515
static bool is_outer_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt, const size_t max_ip_id_bits_nr)
May the outer IP header transmit the required non-random IP-ID bits?
Definition: rohc_comp_rfc3095.h:383
int send_dynamic
The number of dynamic fields that changed in the two IP headers.
Definition: rohc_comp_rfc3095.h:158
int rnd
Whether the IP-ID is considered as random or not.
Definition: rohc_comp_rfc3095.h:71
bool rohc_comp_rfc3095_is_sn_possible(const struct rohc_comp_rfc3095_ctxt *const rfc3095_ctxt, const size_t bits_nr, const size_t add_bits_nr)
Are the given SN field sizes possible?
Definition: rohc_comp_rfc3095.c:7351
static size_t get_nr_ipv4_non_rnd(const struct rohc_comp_rfc3095_ctxt *const ctxt)
How many IP headers are IPv4 headers with non-random IP-IDs ?
Definition: rohc_comp_rfc3095.h:430
void * specific
Profile-specific data.
Definition: rohc_comp_rfc3095.h:306
size_t nr_sn_bits_less_equal_than_4
The number of bits needed to encode the Sequence Number (SN)
Definition: rohc_comp_rfc3095.h:161
uint8_t compute_crc_dynamic(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-DYNAMIC part of an IP header.
Definition: crc.c:388
int old_rnd
Whether the IP-ID of the previous IP header was considered as random or not.
Definition: rohc_comp_rfc3095.h:78
The ROHC compressor.
Definition: rohc_comp_internals.h:129
unsigned int next_header_proto
The protocol number registered by IANA for the next header protocol.
Definition: rohc_comp_rfc3095.h:218
static bool no_inner_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
Does the inner IP header require to transmit no non-random IP-ID bit?
Definition: rohc_comp_rfc3095.h:399
ROHC CRC routines.
static bool is_inner_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt, const size_t max_ip_id_bits_nr)
May the inner IP header transmit the required non-random IP-ID bits?
Definition: rohc_comp_rfc3095.h:415
size_t df_count
The number of times the DF field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:59
uint16_t id_delta
Definition: rohc_comp_rfc3095.h:88
rohc_ext_t
The different types of extensions for UO-1-ID and UOR-2* packets.
Definition: rohc_packets.h:133
ROHC generic list compression.
The IPv6 header.
Definition: ipv6.h:88
size_t nr_ip_id_bits
The number of bits needed to encode the IP-ID of the outer IP header.
Definition: rohc_comp_rfc3095.h:166
Store information about an IPv6 header between the different compressions of IP packets.
Definition: rohc_comp_rfc3095.h:101
size_t nr_ip_id_bits2
The number of bits needed to encode the IP-ID of the inner IP header.
Definition: rohc_comp_rfc3095.h:168
One W-LSB encoding object.
Definition: comp_wlsb.h:56
struct ipv4_header_info v4
The IPv4-specific header info.
Definition: rohc_comp_rfc3095.h:133
The IPv4 header.
Definition: ipv4.h:53
Internal structures for ROHC compression.
The ROHC compression context.
Definition: rohc_comp_internals.h:326
Store information about an IPv4 header between the different compressions of IP packets.
Definition: rohc_comp_rfc3095.h:50
size_t protocol_count
The number of times the Protocol/Next Header field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:125
size_t nr_sn_bits_more_than_4
The number of bits needed to encode the Sequence Number (SN)
Definition: rohc_comp_rfc3095.h:163
Structure that contains variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:149
static bool no_outer_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
Does the outer IP header require to transmit no non-random IP-ID bit?
Definition: rohc_comp_rfc3095.h:367
Definition: net_pkt.h:39
struct ipv4_hdr old_ip
The previous IP header.
Definition: rohc_comp_rfc3095.h:56
union ip_header_info::@21 info
The version specific header info.
bool rohc_comp_rfc3095_check_profile(const struct rohc_comp *const comp, const struct net_pkt *const packet)
Check if the given packet corresponds to an IP-based profile.
Definition: rohc_comp_rfc3095.c:668
int sid
Whether the IP-ID is considered as static or not.
Definition: rohc_comp_rfc3095.h:75
rohc_packet_t packet_type
The type of packet the compressor must send: IR, IR-DYN, UO*.
Definition: rohc_comp_rfc3095.h:171
size_t nbo_count
The number of times the IP-ID is specified as coded in Network Byte Order (NBO) in the compressed hea...
Definition: rohc_comp_rfc3095.h:65
static bool encode_uncomp_fields(struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt)
Encode uncompressed fields with the corresponding encoding scheme.
Definition: rohc_comp_rfc3095.c:6736
rohc_ext_t decide_extension(const struct rohc_comp_ctxt *const context)
Decide what extension shall be used in the UO-1-ID/UOR-2 packet.
Definition: rohc_comp_rfc3095.c:6899
struct c_wlsb ip_id_window
A window to store the IP-ID.
Definition: rohc_comp_rfc3095.h:53
Store information about an IP (IPv4 or IPv6) header between the different compressions of IP packets...
Definition: rohc_comp_rfc3095.h:114
struct ip_header_info outer_ip_flags
Information about the outer IP header.
Definition: rohc_comp_rfc3095.h:198
rohc_crc_type_t
Definition: crc.h:58
uint32_t msn_of_last_ctxt_updating_pkt
Definition: rohc_comp_rfc3095.h:191
int send_static
The number of static fields that changed in the two IP headers.
Definition: rohc_comp_rfc3095.h:156
bool static_chain_end
Definition: rohc_comp_rfc3095.h:117
ip_version version
The version of the IP header.
Definition: rohc_comp_rfc3095.h:116
size_t ip_hdr_nr
Definition: rohc_comp_rfc3095.h:196
struct generic_tmp_vars tmp
Temporary variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:212
rohc_packet_t packet_type
Definition: rohc_comp_internals.h:360
unsigned short changed_fields
The number of fields that changed in the outer IP header.
Definition: rohc_comp_rfc3095.h:152
static size_t get_nr_ipv4_non_rnd_with_bits(const struct rohc_comp_rfc3095_ctxt *const ctxt)
How many IP headers are IPv4 headers with non-random IP-IDs and some bits to transmit ...
Definition: rohc_comp_rfc3095.h:460
void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
Destroy the context.
Definition: rohc_comp_rfc3095.c:628
void rohc_get_ipid_bits(const struct rohc_comp_ctxt *const context, size_t *const nr_innermost_bits, size_t *const nr_outermost_bits)
Get the number of non-random outer/inner IP-ID bits.
Definition: rohc_comp_rfc3095.c:7302
Definition of ROHC packets and extensions.
int nbo
Whether the IP-ID is considered as coded in NBO or not.
Definition: rohc_comp_rfc3095.h:73
uint8_t crc_static_3_cached
Definition: rohc_comp_rfc3095.h:205
size_t ttl_count
The number of times the TTL/HL field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:122
int old_nbo
Whether the IP-ID of the previous IP header was considered as coded in NBO or not.
Definition: rohc_comp_rfc3095.h:81
The list compressor.
Definition: comp_list.h:42
ip_version
IP version.
Definition: ip.h:49
IP version 4.
Definition: ip.h:52
bool is_crc_static_7_cached_valid
Definition: rohc_comp_rfc3095.h:207
void rohc_comp_rfc3095_decide_state(struct rohc_comp_ctxt *const context)
Decide the state that should be used for the next packet.
Definition: rohc_comp_rfc3095.c:1383
rohc_feedback_type
Definition: feedback.h:42
int old_sid
Whether the IP-ID of the previous IP header was considered as static or not.
Definition: rohc_comp_rfc3095.h:84
bool is_crc_static_3_cached_valid
Definition: rohc_comp_rfc3095.h:203
size_t rnd_count
The number of times the IP-ID is specified as random in the compressed header.
Definition: rohc_comp_rfc3095.h:62
int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, uint8_t *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type, size_t *const payload_offset)
Encode an IP packet according to a pattern decided by several different factors.
Definition: rohc_comp_rfc3095.c:798
rohc_packet_t
The different types of ROHC packets.
Definition: rohc_packets.h:55
uint8_t compute_crc_static(const uint8_t *const outer_ip, const uint8_t *const inner_ip, const uint8_t *const next_header, const rohc_crc_type_t crc_type, const uint8_t init_val, const uint8_t *const crc_table)
Compute the CRC-STATIC part of an IP header.
Definition: crc.c:295
static int code_uo_remainder(struct rohc_comp_ctxt *const context, const struct net_pkt *const uncomp_pkt, uint8_t *const dest, int counter)
Build the tail of the UO packet.
Definition: rohc_comp_rfc3095.c:2603
bool rohc_comp_rfc3095_feedback(struct rohc_comp_ctxt *const context, const enum rohc_feedback_type feedback_type, const uint8_t *const packet, const size_t packet_len, const uint8_t *const feedback_data, const size_t feedback_data_len)
Update the profile when feedback is received.
Definition: rohc_comp_rfc3095.c:882
The generic decompression context for RFC3095-based profiles.
Definition: rohc_comp_rfc3095.h:182