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
117 
118  /// The number of times the TOS/TC field was added to the compressed header
119  size_t tos_count;
120  /// The number of times the TTL/HL field was added to the compressed header
121  size_t ttl_count;
122  /// @brief The number of times the Protocol/Next Header field was added to
123  /// the compressed header
125 
126  /** Whether the old_* members of the struct and in its children are
127  * initialized or not */
129 
130  union
131  {
132  struct ipv4_header_info v4; ///< The IPv4-specific header info
133  struct ipv6_header_info v6; ///< The IPv6-specific header info
134  } info; ///< The version specific header info
135 };
136 
137 
138 /**
139  * @brief Structure that contains variables that are used during one single
140  * compression of packet.
141  *
142  * Structure that contains variables that are temporary, i.e. variables that
143  * will only be used for the compression of the current packet. These variables
144  * must be reinitialized every time a new packet arrive.
145  *
146  * @see c_init_tmp_variables
147  */
149 {
150  /// The number of fields that changed in the outer IP header
151  unsigned short changed_fields;
152  /// The number of fields that changed in the inner IP header
153  unsigned short changed_fields2;
154  /// The number of static fields that changed in the two IP headers
156  /// The number of dynamic fields that changed in the two IP headers
158 
159  /// The number of bits needed to encode the Sequence Number (SN)
161  /// The number of bits needed to encode the Sequence Number (SN)
163 
164  /// The number of bits needed to encode the IP-ID of the outer IP header
166  /// The number of bits needed to encode the IP-ID of the inner IP header
168 
169  /// The type of packet the compressor must send: IR, IR-DYN, UO*
171 };
172 
173 
174 /**
175  * @brief The generic decompression context for RFC3095-based profiles
176  *
177  * The object defines the generic context that manages IP(/nextheader) and
178  * IP/IP(/nextheader) packets. nextheader is managed by the profile-specific
179  * part of the context.
180  */
182 {
183  /// The Sequence Number (SN), may be 16-bit or 32-bit long
184  uint32_t sn;
185  /// A window used to encode the SN
186  struct c_wlsb sn_window;
187 
188  /** The SN of the last packet that updated the context (used to determine
189  * if a positive ACK may cause a transition to a higher compression state) */
191  /** The W-LSB for non-acknowledged MSN */
192  struct c_wlsb msn_non_acked;
193 
194  /** The number of IP headers */
195  size_t ip_hdr_nr;
196  /// Information about the outer IP header
197  struct ip_header_info outer_ip_flags;
198  /// Information about the inner IP header
199  struct ip_header_info inner_ip_flags;
200 
201  /** Whether the cache for the CRC-3 value on CRC-STATIC fields is initialized or not */
203  /** The cache for the CRC-3 value on CRC-STATIC fields */
205  /** Whether the cache for the CRC-7 value on CRC-STATIC fields is initialized or not */
207  /** The cache for the CRC-7 value on CRC-STATIC fields */
209 
210  /// Temporary variables that are used during one single compression of packet
211  struct generic_tmp_vars tmp;
212 
213  /* below are some information and handlers to manage the next header
214  * (if any) located just after the IP headers (1 or 2 IP headers) */
215 
216  /// The protocol number registered by IANA for the next header protocol
217  unsigned int next_header_proto;
218  /// The length of the next header
219  unsigned int next_header_len;
220 
221  /** The handler for encoding profile-specific uncompressed header fields */
222  bool (*encode_uncomp_fields)(struct rohc_comp_ctxt *const context,
223  const struct net_pkt *const uncomp_pkt)
224  __attribute__((warn_unused_result, nonnull(1, 2)));
225 
226  /// @brief The handler used to decide the state that should be used for the
227  /// next packet
228  void (*decide_state)(struct rohc_comp_ctxt *const context);
229  /** @brief The handler used to decide which packet to send in FO state */
230  rohc_packet_t (*decide_FO_packet)(const struct rohc_comp_ctxt *context);
231  /** @brief The handler used to decide which packet to send in SO state */
232  rohc_packet_t (*decide_SO_packet)(const struct rohc_comp_ctxt *context);
233  /** The handler used to decide which extension to send */
234  rohc_ext_t (*decide_extension)(const struct rohc_comp_ctxt *context);
235 
236  /// The handler used to initialize some data just before the IR packet build
237  void (*init_at_IR)(struct rohc_comp_ctxt *const context,
238  const uint8_t *const next_header);
239 
240  /** Determine the next SN value */
241  uint32_t (*get_next_sn)(const struct rohc_comp_ctxt *const context,
242  const struct net_pkt *const uncomp_pkt)
243  __attribute__((warn_unused_result, nonnull(1, 2)));
244 
245  /// @brief The handler used to add the static part of the next header to the
246  /// ROHC packet
247  size_t (*code_static_part)(const struct rohc_comp_ctxt *const context,
248  const uint8_t *const next_header,
249  uint8_t *const dest,
250  const size_t counter)
251  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
252 
253  /// @brief The handler used to add the dynamic part of the next header to the
254  /// ROHC pachet
255  size_t (*code_dynamic_part)(const struct rohc_comp_ctxt *const context,
256  const uint8_t *const next_header,
257  uint8_t *const dest,
258  const size_t counter)
259  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
260 
261  /// @brief The handler used to add the IR/IR-DYN remainder header to the
262  /// ROHC pachet
263  int (*code_ir_remainder)(const struct rohc_comp_ctxt *const context,
264  uint8_t *const dest,
265  const size_t dest_max_len,
266  const size_t counter)
267  __attribute__((warn_unused_result, nonnull(1, 2)));
268 
269  /// @brief The handler used to add an additional header in the head of the
270  /// UO-0, UO-1 and UO-2 packets
271  size_t (*code_UO_packet_head)(const struct rohc_comp_ctxt *const context,
272  const uint8_t *const next_header,
273  uint8_t *const dest,
274  const size_t counter,
275  size_t *const first_position)
276  __attribute__((warn_unused_result, nonnull(1,2, 3, 5)));
277 
278  /// @brief The handler used to add an additional header in the tail of the
279  /// UO-0, UO-1 and UO-2 packets
280  size_t (*code_uo_remainder)(const struct rohc_comp_ctxt *const context,
281  const uint8_t *const next_header,
282  uint8_t *const dest,
283  const size_t counter)
284  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
285 
286  /// @brief The handler used to compute the CRC-STATIC value
287  uint8_t (*compute_crc_static)(const uint8_t *const ip,
288  const uint8_t *const ip2,
289  const uint8_t *const next_header,
290  const rohc_crc_type_t crc_type,
291  const uint8_t init_val,
292  const uint8_t *const crc_table)
293  __attribute__((nonnull(1, 3, 6), warn_unused_result));
294 
295  /// @brief The handler used to compute the CRC-DYNAMIC value
296  uint8_t (*compute_crc_dynamic)(const uint8_t *const ip,
297  const uint8_t *const ip2,
298  const uint8_t *const next_header,
299  const rohc_crc_type_t crc_type,
300  const uint8_t init_val,
301  const uint8_t *const crc_table)
302  __attribute__((nonnull(1, 3, 6), warn_unused_result));
303 
304  /// Profile-specific data
305  void *specific;
306 };
307 
308 
309 /*
310  * Function prototypes.
311  */
312 
313 bool rohc_comp_rfc3095_create(struct rohc_comp_ctxt *const context,
314  const size_t sn_bits_nr,
315  const rohc_lsb_shift_t sn_shift,
316  const struct net_pkt *const packet)
317  __attribute__((warn_unused_result, nonnull(1, 4)));
318 
319 void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
320  __attribute__((nonnull(1)));
321 
322 bool rohc_comp_rfc3095_check_profile(const struct rohc_comp *const comp,
323  const struct net_pkt *const packet)
324  __attribute__((warn_unused_result, nonnull(1, 2)));
325 
326 rohc_ext_t decide_extension(const struct rohc_comp_ctxt *const context)
327  __attribute__((warn_unused_result, nonnull(1)));
328 
329 int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context,
330  const struct net_pkt *const uncomp_pkt,
331  uint8_t *const rohc_pkt,
332  const size_t rohc_pkt_max_len,
333  rohc_packet_t *const packet_type,
334  size_t *const payload_offset)
335  __attribute__((warn_unused_result, nonnull(1, 2, 3, 5, 6)));
336 
337 bool rohc_comp_rfc3095_feedback(struct rohc_comp_ctxt *const context,
338  const enum rohc_feedback_type feedback_type,
339  const uint8_t *const packet,
340  const size_t packet_len,
341  const uint8_t *const feedback_data,
342  const size_t feedback_data_len)
343  __attribute__((warn_unused_result, nonnull(1, 3, 5)));
344 
345 void rohc_comp_rfc3095_decide_state(struct rohc_comp_ctxt *const context)
346  __attribute__((nonnull(1)));
347 
348 void rohc_get_ipid_bits(const struct rohc_comp_ctxt *const context,
349  size_t *const nr_innermost_bits,
350  size_t *const nr_outermost_bits)
351  __attribute__((nonnull(1, 2, 3)));
352 
353 bool rohc_comp_rfc3095_is_sn_possible(const struct rohc_comp_rfc3095_ctxt *const rfc3095_ctxt,
354  const size_t bits_nr,
355  const size_t add_bits_nr)
356  __attribute__((warn_unused_result, nonnull(1), pure));
357 
358 
359 /**
360  * @brief Does the outer IP header require to transmit no non-random IP-ID bit?
361  *
362  * @param ctxt The generic decompression context
363  * @return true if no required outer IP-ID bit shall be transmitted,
364  * false otherwise
365  */
366 static inline bool no_outer_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
367 {
368  return (ctxt->outer_ip_flags.version != IPV4 ||
369  ctxt->outer_ip_flags.info.v4.rnd == 1 ||
370  ctxt->tmp.nr_ip_id_bits == 0);
371 }
372 
373 
374 /**
375  * @brief May the outer IP header transmit the required non-random IP-ID bits?
376  *
377  * @param ctxt The generic decompression context
378  * @param max_ip_id_bits_nr The maximum number of IP-ID bits that may be transmitted
379  * @return true if the required IP-ID bits may be transmitted,
380  * false otherwise
381  */
382 static inline bool is_outer_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt,
383  const size_t max_ip_id_bits_nr)
384 {
385  return (ctxt->outer_ip_flags.version == IPV4 &&
386  ctxt->outer_ip_flags.info.v4.rnd != 1 &&
387  ctxt->tmp.nr_ip_id_bits <= max_ip_id_bits_nr);
388 }
389 
390 
391 /**
392  * @brief Does the inner IP header require to transmit no non-random IP-ID bit?
393  *
394  * @param ctxt The generic decompression context
395  * @return true if no required inner IP-ID bit shall be transmitted,
396  * false otherwise
397  */
398 static inline bool no_inner_ip_id_bits_required(const struct rohc_comp_rfc3095_ctxt *const ctxt)
399 {
400  return (ctxt->inner_ip_flags.version != IPV4 ||
401  ctxt->inner_ip_flags.info.v4.rnd == 1 ||
402  ctxt->tmp.nr_ip_id_bits2 == 0);
403 }
404 
405 
406 /**
407  * @brief May the inner IP header transmit the required non-random IP-ID bits?
408  *
409  * @param ctxt The generic decompression context
410  * @param max_ip_id_bits_nr The maximum number of IP-ID bits that may be transmitted
411  * @return true if the required IP-ID bits may be transmitted,
412  * false otherwise
413  */
414 static inline bool is_inner_ip_id_bits_possible(const struct rohc_comp_rfc3095_ctxt *const ctxt,
415  const size_t max_ip_id_bits_nr)
416 {
417  return (ctxt->inner_ip_flags.version == IPV4 &&
418  ctxt->inner_ip_flags.info.v4.rnd != 1 &&
419  ctxt->tmp.nr_ip_id_bits2 <= max_ip_id_bits_nr);
420 }
421 
422 
423 /**
424  * @brief How many IP headers are IPv4 headers with non-random IP-IDs ?
425  *
426  * @param ctxt The generic decompression context
427  * @return The number of IPv4 headers with non-random IP-ID fields
428  */
429 static inline size_t get_nr_ipv4_non_rnd(const struct rohc_comp_rfc3095_ctxt *const ctxt)
430 {
431  size_t nr_ipv4_non_rnd = 0;
432 
433  /* outer IP header */
434  if(ctxt->outer_ip_flags.version == IPV4 && ctxt->outer_ip_flags.info.v4.rnd != 1)
435  {
436  nr_ipv4_non_rnd++;
437  }
438 
439  /* optional inner IP header */
440  if(ctxt->ip_hdr_nr >= 1 &&
441  ctxt->inner_ip_flags.version == IPV4 &&
442  ctxt->inner_ip_flags.info.v4.rnd != 1)
443  {
444  nr_ipv4_non_rnd++;
445  }
446 
447  return nr_ipv4_non_rnd;
448 }
449 
450 
451 /**
452  * @brief How many IP headers are IPv4 headers with non-random IP-IDs and some
453  * bits to transmit ?
454  *
455  * @param ctxt The generic decompression context
456  * @return The number of IPv4 headers with non-random IP-ID fields and some
457  * bits to transmit
458  */
459 static inline size_t get_nr_ipv4_non_rnd_with_bits(const struct rohc_comp_rfc3095_ctxt *const ctxt)
460 {
461  size_t nr_ipv4_non_rnd_with_bits = 0;
462 
463  /* outer IP header */
464  if(ctxt->outer_ip_flags.version == IPV4 &&
465  ctxt->outer_ip_flags.info.v4.rnd != 1 &&
466  ctxt->tmp.nr_ip_id_bits > 0)
467  {
468  nr_ipv4_non_rnd_with_bits++;
469  }
470 
471  /* optional inner IP header */
472  if(ctxt->ip_hdr_nr >= 1 &&
473  ctxt->inner_ip_flags.version == IPV4 &&
474  ctxt->inner_ip_flags.info.v4.rnd != 1 &&
475  ctxt->tmp.nr_ip_id_bits2 > 0)
476  {
477  nr_ipv4_non_rnd_with_bits++;
478  }
479 
480  return nr_ipv4_non_rnd_with_bits;
481 }
482 
483 
484 #endif
485 
uint8_t crc_static_7_cached
Definition: rohc_comp_rfc3095.h:208
uint32_t sn
The Sequence Number (SN), may be 16-bit or 32-bit long.
Definition: rohc_comp_rfc3095.h:184
unsigned short changed_fields2
The number of fields that changed in the inner IP header.
Definition: rohc_comp_rfc3095.h:153
rohc_lsb_shift_t
the different values of the shift parameter of the LSB algorithm
Definition: interval.h:45
unsigned int next_header_len
The length of the next header.
Definition: rohc_comp_rfc3095.h:219
bool is_first_header
Definition: rohc_comp_rfc3095.h:128
struct ip_header_info inner_ip_flags
Information about the inner IP header.
Definition: rohc_comp_rfc3095.h:199
size_t tos_count
The number of times the TOS/TC field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:119
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:519
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:382
int send_dynamic
The number of dynamic fields that changed in the two IP headers.
Definition: rohc_comp_rfc3095.h:157
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:7367
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:429
void * specific
Profile-specific data.
Definition: rohc_comp_rfc3095.h:305
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:160
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:391
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:217
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:398
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:414
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:115
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:165
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:167
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:132
The IPv4 header.
Definition: ipv4.h:53
Internal structures for ROHC compression.
The ROHC compression context.
Definition: rohc_comp_internals.h:329
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:124
size_t nr_sn_bits_more_than_4
The number of bits needed to encode the Sequence Number (SN)
Definition: rohc_comp_rfc3095.h:162
Structure that contains variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:148
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:366
Definition: net_pkt.h:39
struct ipv4_hdr old_ip
The previous IP header.
Definition: rohc_comp_rfc3095.h:56
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:660
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:170
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:6739
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:6907
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:197
rohc_crc_type_t
Definition: crc.h:56
uint32_t msn_of_last_ctxt_updating_pkt
Definition: rohc_comp_rfc3095.h:190
int send_static
The number of static fields that changed in the two IP headers.
Definition: rohc_comp_rfc3095.h:155
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:195
struct generic_tmp_vars tmp
Temporary variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:211
rohc_packet_t packet_type
Definition: rohc_comp_internals.h:363
union ip_header_info::@22 info
The version specific header info.
unsigned short changed_fields
The number of fields that changed in the outer IP header.
Definition: rohc_comp_rfc3095.h:151
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:459
void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
Destroy the context.
Definition: rohc_comp_rfc3095.c:620
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:7318
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:204
size_t ttl_count
The number of times the TTL/HL field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:121
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:206
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:1368
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:202
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:793
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:298
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:2591
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:881
The generic decompression context for RFC3095-based profiles.
Definition: rohc_comp_rfc3095.h:181