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"
35 #include "schemes/comp_list.h"
36 #include "ip.h"
37 #include "crc.h"
38 
39 #include <stdlib.h>
40 
41 
42 /**
43  * @brief Store information about an IPv4 header between the different
44  * compressions of IP packets.
45  *
46  * Defines an object that contains counters, flags and structures related to an
47  * IPv4 header and that need to be saved between the different compressions of
48  * packets. A compression context owns objects like this for the two first
49  * IPv4 headers.
50  */
52 {
53  /// A window to store the IP-ID
55 
56  /// The previous IP header
57  struct ipv4_hdr old_ip;
58 
59  /// The number of times the DF field was added to the compressed header
60  uint8_t df_count;
61  /// @brief The number of times the IP-ID is specified as random in the
62  /// compressed header
63  uint8_t rnd_count;
64  /// @brief The number of times the IP-ID is specified as coded in Network
65  /// Byte Order (NBO) in the compressed header
66  uint8_t nbo_count;
67  /// @brief The number of times the IP-ID is specified as static in the
68  /// compressed header
69  uint8_t sid_count;
70 
71  /// Whether the IP-ID is considered as random or not
72  int rnd;
73  /// Whether the IP-ID is considered as coded in NBO or not
74  int nbo;
75  /// Whether the IP-ID is considered as static or not
76  int sid;
77  /// @brief Whether the IP-ID of the previous IP header was considered as
78  /// random or not
79  int old_rnd;
80  /// @brief Whether the IP-ID of the previous IP header was considered as
81  /// coded in NBO or not
82  int old_nbo;
83  /// @brief Whether the IP-ID of the previous IP header was considered as
84  /// static or not
85  int old_sid;
86 
87  /// The delta between the IP-ID and the current Sequence Number (SN)
88  /// (overflow over 16 bits is expected when SN > IP-ID)
89  uint16_t id_delta;
90 };
91 
92 
93 /**
94  * @brief Store information about an IPv6 header between the different
95  * compressions of IP packets.
96  *
97  * Defines an object that contains counters, flags and structures related to an
98  * IPv6 header and that need to be saved between the different compressions of
99  * packets. A compression context owns objects like this for the two first
100  * IPv6 headers.
101  */
103 {
104  /// The previous IPv6 header
105  struct ipv6_hdr old_ip;
106  /// The extension compressor
108 };
109 
110 
111 /**
112  * @brief Store information about an IP (IPv4 or IPv6) header between the
113  * different compressions of IP packets.
114  */
116 {
117  ip_version version; ///< The version of the IP header
119 
120  /// The number of times the TOS/TC field was added to the compressed header
121  size_t tos_count;
122  /// The number of times the TTL/HL field was added to the compressed header
123  size_t ttl_count;
124 
125  /** Whether the old_* members of the struct and in its children are
126  * initialized or not */
128 
129  union
130  {
131  struct ipv4_header_info v4; ///< The IPv4-specific header info
132  struct ipv6_header_info v6; ///< The IPv6-specific header info
133  } info; ///< The version specific header info
134 };
135 
136 
137 /** The changes of one IP header */
139 {
140  uint8_t tos_tc_just_changed:1; /**< Whether IP TOS/TC just changed */
141  uint8_t tos_tc_changed:1; /**< Whether IP TOS/TC changed */
142  uint8_t ttl_hl_just_changed:1; /**< Whether IP TTL/HL just changed */
143  uint8_t ttl_hl_changed:1; /**< Whether IP TTL/HL changed */
144  uint8_t df_just_changed:1; /**< Whether IP DF just changed */
145  uint8_t df_changed:1; /**< Whether IP DF changed */
146  uint8_t nbo_just_changed:1; /**< Whether IP NBO just changed */
147  uint8_t nbo_changed:1; /**< Whether IP NBO changed */
148 
149  uint8_t rnd_just_changed:1; /**< Whether IP RND just changed */
150  uint8_t rnd_changed:1; /**< Whether IP RND changed */
151  uint8_t sid_just_changed:1; /**< Whether IP SID just changed */
152  uint8_t sid_changed:1; /**< Whether IP SID changed */
153  uint8_t ip_id_changed:1; /**< Whether IP-ID of the IP header changed */
154  uint8_t ip_id_3bits_possible:1; /**< Whether IP-ID may be encoded on 3 bits */
155  uint8_t ip_id_5bits_possible:1; /**< Whether IP-ID may be encoded on 5 bits */
156  uint8_t ip_id_6bits_possible:1; /**< Whether IP-ID may be encoded on 6 bits */
157 
158  uint8_t ip_id_8bits_possible:1; /**< Whether IP-ID may be encoded on 8 bits */
159  uint8_t ip_id_11bits_possible:1; /**< Whether IP-ID may be encoded on 11 bits */
160  /** Whether innermost IP extension list just changed of structure */
162  /** Whether innermost IP extension list changed of structure */
164  /** Whether innermost IP extension list just changed of content */
166  /** Whether innermost IP extension list changed of content */
168  uint8_t unused:2;
169 };
170 
171 
172 /**
173  * @brief Structure that contains variables that are used during one single
174  * compression of packet.
175  *
176  * Structure that contains variables that are temporary, i.e. variables that
177  * will only be used for the compression of the current packet. These variables
178  * must be reinitialized every time a new packet arrive.
179  *
180  * @see c_init_tmp_variables
181  */
183 {
184  /** The number of IP headers */
185  size_t ip_hdr_nr;
186  /** The changes of the IP headers */
188 
192 
196 
200 };
201 
202 
203 /**
204  * @brief The generic decompression context for RFC3095-based profiles
205  *
206  * The object defines the generic context that manages IP(/nextheader) and
207  * IP/IP(/nextheader) packets. nextheader is managed by the profile-specific
208  * part of the context.
209  */
211 {
212  /// The Sequence Number (SN), may be 16-bit or 32-bit long
213  uint32_t sn;
214  /// A window used to encode the SN
216 
217  /** The SN of the last packet that updated the context (used to determine
218  * if a positive ACK may cause a transition to a higher compression state) */
220  /** The W-LSB for non-acknowledged MSN */
222 
223  /** The number of IP headers */
224  size_t ip_hdr_nr;
225  /** Information about the IP headers */
227 
228  /** Whether the cache for the CRC-3 value on CRC-STATIC fields is initialized or not */
230  /** The cache for the CRC-3 value on CRC-STATIC fields */
232  /** Whether the cache for the CRC-7 value on CRC-STATIC fields is initialized or not */
234  /** The cache for the CRC-7 value on CRC-STATIC fields */
236 
237  /// Temporary variables that are used during one single compression of packet
239 
240  /* below are some information and handlers to manage the next header
241  * (if any) located just after the IP headers (1 or 2 IP headers) */
242 
243  /// The protocol number registered by IANA for the next header protocol
244  unsigned int next_header_proto;
245  /// The length of the next header
246  unsigned int next_header_len;
247 
248  /** The handler for encoding profile-specific uncompressed header fields */
249  bool (*encode_uncomp_fields)(struct rohc_comp_ctxt *const context,
250  const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
251  __attribute__((warn_unused_result, nonnull(1, 2)));
252 
253  /** @brief The handler used to decide which packet to send in FO state */
254  rohc_packet_t (*decide_FO_packet)(const struct rohc_comp_ctxt *const context)
255  __attribute__((warn_unused_result, nonnull(1)));
256  /** @brief The handler used to decide which packet to send in SO state */
257  rohc_packet_t (*decide_SO_packet)(const struct rohc_comp_ctxt *const context)
258  __attribute__((warn_unused_result, nonnull(1)));
259  /** The handler used to decide which extension to send */
260  rohc_ext_t (*decide_extension)(const struct rohc_comp_ctxt *const context,
262  __attribute__((warn_unused_result, nonnull(1)));
263 
264  /** Determine the next SN value */
265  uint32_t (*get_next_sn)(const struct rohc_comp_ctxt *const context,
266  const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
267  __attribute__((warn_unused_result, nonnull(1, 2)));
268 
269  /// @brief The handler used to add the static part of the next header to the
270  /// ROHC packet
271  size_t (*code_static_part)(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  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
276 
277  /// @brief The handler used to add the dynamic part of the next header to the
278  /// ROHC pachet
279  size_t (*code_dynamic_part)(const struct rohc_comp_ctxt *const context,
280  const uint8_t *const next_header,
281  uint8_t *const dest,
282  const size_t counter)
283  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
284 
285  /// @brief The handler used to add the IR/IR-DYN remainder header to the
286  /// ROHC pachet
287  int (*code_ir_remainder)(const struct rohc_comp_ctxt *const context,
288  uint8_t *const dest,
289  const size_t dest_max_len,
290  const size_t counter)
291  __attribute__((warn_unused_result, nonnull(1, 2)));
292 
293  /// @brief The handler used to add an additional header in the tail of the
294  /// UO-0, UO-1 and UO-2 packets
295  size_t (*code_uo_remainder)(const struct rohc_comp_ctxt *const context,
296  const uint8_t *const next_header,
297  uint8_t *const dest,
298  const size_t counter)
299  __attribute__((warn_unused_result, nonnull(1, 2, 3)));
300 
301  /// @brief The handler used to compute the CRC-STATIC value
302  uint8_t (*compute_crc_static)(const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs,
303  const rohc_crc_type_t crc_type,
304  const uint8_t init_val)
305  __attribute__((nonnull(1), warn_unused_result));
306 
307  /// @brief The handler used to compute the CRC-DYNAMIC value
308  uint8_t (*compute_crc_dynamic)(const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs,
309  const rohc_crc_type_t crc_type,
310  const uint8_t init_val)
311  __attribute__((nonnull(1), warn_unused_result));
312 
313  /// Profile-specific data
314  void *specific;
315 };
316 
317 
318 /*
319  * Function prototypes.
320  */
321 
322 bool rohc_comp_rfc3095_create(struct rohc_comp_ctxt *const context,
323  const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
324  __attribute__((warn_unused_result, nonnull(1, 2)));
325 
326 void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
327  __attribute__((nonnull(1)));
328 
329 rohc_ext_t decide_extension(const struct rohc_comp_ctxt *const context,
330  const rohc_packet_t packet_type)
331  __attribute__((warn_unused_result, nonnull(1)));
332 
333 int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context,
334  const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs,
335  uint8_t *const rohc_pkt,
336  const size_t rohc_pkt_max_len,
337  rohc_packet_t *const packet_type)
338  __attribute__((warn_unused_result, nonnull(1, 2, 3, 5)));
339 
340 bool rohc_comp_rfc3095_feedback(struct rohc_comp_ctxt *const context,
341  const enum rohc_feedback_type feedback_type,
342  const uint8_t *const packet,
343  const size_t packet_len,
344  const uint8_t *const feedback_data,
345  const size_t feedback_data_len)
346  __attribute__((warn_unused_result, nonnull(1, 3, 5)));
347 
348 void rohc_get_ipid_bits(const struct rohc_comp_ctxt *const context,
349  bool *const innermost_ip_id_changed,
350  bool *const innermost_ip_id_3bits_possible,
351  bool *const innermost_ip_id_5bits_possible,
352  bool *const innermost_ip_id_8bits_possible,
353  bool *const innermost_ip_id_11bits_possible,
354  bool *const outermost_ip_id_changed,
355  bool *const outermost_ip_id_11bits_possible)
356  __attribute__((nonnull(1, 2, 3, 4, 5, 6, 7, 8)));
357 
358 
359 /**
360  * @brief How many IP headers are IPv4 headers with non-random IP-IDs ?
361  *
362  * @param ctxt The generic decompression context
363  * @return The number of IPv4 headers with non-random IP-ID fields
364  */
365 static inline size_t get_nr_ipv4_non_rnd(const struct rohc_comp_rfc3095_ctxt *const ctxt)
366 {
367  size_t nr_ipv4_non_rnd = 0;
368  size_t ip_hdr_pos;
369 
370  for(ip_hdr_pos = 0; ip_hdr_pos < ctxt->ip_hdr_nr; ip_hdr_pos++)
371  {
372  const struct ip_header_info *const ip_ctxt = &(ctxt->ip_ctxts[ip_hdr_pos]);
373 
374  if(ip_ctxt->version == IPV4 && ip_ctxt->info.v4.rnd != 1)
375  {
376  nr_ipv4_non_rnd++;
377  }
378  }
379 
380  return nr_ipv4_non_rnd;
381 }
382 
383 
384 /**
385  * @brief How many IP headers are IPv4 headers with non-random IP-IDs and some
386  * bits to transmit ?
387  *
388  * @param ctxt The generic compression context
389  * @return The number of IPv4 headers with non-random IP-ID fields and some
390  * bits to transmit
391  */
392 static inline size_t get_nr_ipv4_non_rnd_with_bits(const struct rohc_comp_rfc3095_ctxt *const ctxt)
393 {
394  size_t nr_ipv4_non_rnd_with_bits = 0;
395  size_t ip_hdr_pos;
396 
397  for(ip_hdr_pos = 0; ip_hdr_pos < ctxt->ip_hdr_nr; ip_hdr_pos++)
398  {
399  const struct ip_header_info *const ip_ctxt = &(ctxt->ip_ctxts[ip_hdr_pos]);
400  const struct rfc3095_ip_hdr_changes *const ip_changes =
401  &(ctxt->tmp.ip_hdr_changes[ip_hdr_pos]);
402 
403  if(ip_ctxt->version == IPV4 &&
404  ip_ctxt->info.v4.rnd != 1 &&
405  ip_changes->ip_id_changed)
406  {
407  nr_ipv4_non_rnd_with_bits++;
408  }
409  }
410 
411  return nr_ipv4_non_rnd_with_bits;
412 }
413 
414 
415 /**
416  * @brief at least one SID flag changed now or in the last few packets?
417  *
418  * @param ctxt The generic compression context
419  * @param oa_repetitions_nr The number of Optimistic Approach repetitions
420  * @return true if at least one SID flag changed now or in
421  * last few packets, false otherwise
422  */
423 static inline bool does_at_least_one_sid_change(const struct rohc_comp_rfc3095_ctxt *const ctxt,
424  const uint8_t oa_repetitions_nr)
425 {
426  bool at_least_one_sid_change = false;
427  size_t ip_hdr_pos;
428 
429  for(ip_hdr_pos = 0; ip_hdr_pos < ctxt->ip_hdr_nr; ip_hdr_pos++)
430  {
431  const struct ip_header_info *const ip_ctxt = &(ctxt->ip_ctxts[ip_hdr_pos]);
432 
433  if(ip_ctxt->version == IPV4 && ip_ctxt->info.v4.sid_count < oa_repetitions_nr)
434  {
435  at_least_one_sid_change = true;
436  }
437  }
438 
439  return at_least_one_sid_change;
440 }
441 
442 
443 /**
444  * @brief at least one RND flag changed now or in the last few packets?
445  *
446  * @param ctxt The generic compression context
447  * @param oa_repetitions_nr The number of Optimistic Approach repetitions
448  * @return true if at least one RND flag changed now or in
449  * last few packets, false otherwise
450  */
451 static inline bool does_at_least_one_rnd_change(const struct rohc_comp_rfc3095_ctxt *const ctxt,
452  const uint8_t oa_repetitions_nr)
453 {
454  bool at_least_one_rnd_change = false;
455  size_t ip_hdr_pos;
456 
457  for(ip_hdr_pos = 0; ip_hdr_pos < ctxt->ip_hdr_nr; ip_hdr_pos++)
458  {
459  const struct ip_header_info *const ip_ctxt = &(ctxt->ip_ctxts[ip_hdr_pos]);
460 
461  if(ip_ctxt->version == IPV4 && ip_ctxt->info.v4.rnd_count < oa_repetitions_nr)
462  {
463  at_least_one_rnd_change = true;
464  }
465  }
466 
467  return at_least_one_rnd_change;
468 }
469 
470 #endif
471 
uint8_t crc_static_7_cached
Definition: rohc_comp_rfc3095.h:235
uint32_t sn
The Sequence Number (SN), may be 16-bit or 32-bit long.
Definition: rohc_comp_rfc3095.h:213
bool sn_6bits_possible
Definition: rohc_comp_rfc3095.h:197
unsigned int next_header_len
The length of the next header.
Definition: rohc_comp_rfc3095.h:246
uint8_t ip_id_6bits_possible
Definition: rohc_comp_rfc3095.h:156
bool is_first_header
Definition: rohc_comp_rfc3095.h:127
size_t tos_count
The number of times the TOS/TC field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:121
uint8_t tos_tc_just_changed
Definition: rohc_comp_rfc3095.h:140
bool sn_13bits_possible
Definition: rohc_comp_rfc3095.h:195
uint8_t ip_id_5bits_possible
Definition: rohc_comp_rfc3095.h:155
size_t(* code_uo_remainder)(const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter)
The handler used to add an additional header in the tail of the UO-0, UO-1 and UO-2 packets...
Definition: rohc_comp_rfc3095.h:295
uint8_t rnd_count
The number of times the IP-ID is specified as random in the compressed header.
Definition: rohc_comp_rfc3095.h:63
static bool does_at_least_one_sid_change(const struct rohc_comp_rfc3095_ctxt *const ctxt, const uint8_t oa_repetitions_nr)
at least one SID flag changed now or in the last few packets?
Definition: rohc_comp_rfc3095.h:423
uint8_t ip_id_changed
Definition: rohc_comp_rfc3095.h:153
Definition: rohc_comp_rfc3095.h:138
int rnd
Whether the IP-ID is considered as random or not.
Definition: rohc_comp_rfc3095.h:72
rohc_ext_t decide_extension(const struct rohc_comp_ctxt *const context, const rohc_packet_t packet_type)
Decide what extension shall be used in the UO-1-ID/UOR-2 packet.
Definition: rohc_comp_rfc3095.c:6337
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:365
uint8_t sid_changed
Definition: rohc_comp_rfc3095.h:152
void * specific
Profile-specific data.
Definition: rohc_comp_rfc3095.h:314
uint8_t ip_id_8bits_possible
Definition: rohc_comp_rfc3095.h:158
uint8_t rnd_just_changed
Definition: rohc_comp_rfc3095.h:149
int old_rnd
Whether the IP-ID of the previous IP header was considered as random or not.
Definition: rohc_comp_rfc3095.h:79
rohc_packet_t(* decide_SO_packet)(const struct rohc_comp_ctxt *const context)
The handler used to decide which packet to send in SO state.
Definition: rohc_comp_rfc3095.h:257
unsigned int next_header_proto
The protocol number registered by IANA for the next header protocol.
Definition: rohc_comp_rfc3095.h:244
uint8_t df_count
The number of times the DF field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:60
struct ipv6_hdr old_ip
The previous IPv6 header.
Definition: rohc_comp_rfc3095.h:105
uint8_t(* compute_crc_static)(const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val)
The handler used to compute the CRC-STATIC value.
Definition: rohc_comp_rfc3095.h:302
uint8_t sid_count
The number of times the IP-ID is specified as static in the compressed header.
Definition: rohc_comp_rfc3095.h:69
ROHC CRC routines.
size_t(* code_dynamic_part)(const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter)
The handler used to add the dynamic part of the next header to the ROHC pachet.
Definition: rohc_comp_rfc3095.h:279
uint16_t id_delta
Definition: rohc_comp_rfc3095.h:89
rohc_ext_t
The different types of extensions for UO-1-ID and UOR-2* packets.
Definition: rohc_packets.h:157
uint8_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:66
ROHC generic list compression.
uint8_t nbo_just_changed
Definition: rohc_comp_rfc3095.h:146
The IPv6 header.
Definition: ipv6.h:82
bool sn_7bits_possible
Definition: rohc_comp_rfc3095.h:190
uint8_t ttl_hl_just_changed
Definition: rohc_comp_rfc3095.h:142
Store information about an IPv6 header between the different compressions of IP packets.
Definition: rohc_comp_rfc3095.h:102
uint8_t tos_tc_changed
Definition: rohc_comp_rfc3095.h:141
One W-LSB encoding object.
Definition: comp_wlsb.h:68
struct ipv4_header_info v4
The IPv4-specific header info.
Definition: rohc_comp_rfc3095.h:131
struct list_comp ext_comp
The extension compressor.
Definition: rohc_comp_rfc3095.h:107
rohc_ext_t(* decide_extension)(const struct rohc_comp_ctxt *const context, const rohc_packet_t packet_type)
Definition: rohc_comp_rfc3095.h:260
uint8_t unused
Definition: rohc_comp_rfc3095.h:168
The IPv4 header.
Definition: ipv4.h:53
Internal structures for ROHC compression.
The ROHC compression context.
Definition: rohc_comp_internals.h:278
bool rohc_comp_rfc3095_create(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Create a new context and initialize it thanks to the given IP packet.
Definition: rohc_comp_rfc3095.c:525
int(* code_ir_remainder)(const struct rohc_comp_ctxt *const context, uint8_t *const dest, const size_t dest_max_len, const size_t counter)
The handler used to add the IR/IR-DYN remainder header to the ROHC pachet.
Definition: rohc_comp_rfc3095.h:287
Store information about an IPv4 header between the different compressions of IP packets.
Definition: rohc_comp_rfc3095.h:51
uint8_t rnd_changed
Definition: rohc_comp_rfc3095.h:150
bool nonnull(1)))
Information about the uncompressed packet headers.
Structure that contains variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:182
uint8_t ttl_hl_changed
Definition: rohc_comp_rfc3095.h:143
struct ipv4_hdr old_ip
The previous IP header.
Definition: rohc_comp_rfc3095.h:57
size_t(* code_static_part)(const struct rohc_comp_ctxt *const context, const uint8_t *const next_header, uint8_t *const dest, const size_t counter)
The handler used to add the static part of the next header to the ROHC packet.
Definition: rohc_comp_rfc3095.h:271
uint8_t ip_id_11bits_possible
Definition: rohc_comp_rfc3095.h:159
uint8_t sid_just_changed
Definition: rohc_comp_rfc3095.h:151
size_t ip_hdr_nr
Definition: rohc_comp_rfc3095.h:185
int sid
Whether the IP-ID is considered as static or not.
Definition: rohc_comp_rfc3095.h:76
uint8_t df_changed
Definition: rohc_comp_rfc3095.h:145
bool sn_12bits_possible
Definition: rohc_comp_rfc3095.h:191
struct c_wlsb ip_id_window
A window to store the IP-ID.
Definition: rohc_comp_rfc3095.h:54
Store information about an IP (IPv4 or IPv6) header between the different compressions of IP packets...
Definition: rohc_comp_rfc3095.h:115
rohc_crc_type_t
Definition: crc.h:56
uint8_t df_just_changed
Definition: rohc_comp_rfc3095.h:144
uint32_t msn_of_last_ctxt_updating_pkt
Definition: rohc_comp_rfc3095.h:219
bool static_chain_end
Definition: rohc_comp_rfc3095.h:118
uint8_t ext_list_content_just_changed
Definition: rohc_comp_rfc3095.h:165
ip_version version
The version of the IP header.
Definition: rohc_comp_rfc3095.h:117
uint8_t ip_id_3bits_possible
Definition: rohc_comp_rfc3095.h:154
size_t ip_hdr_nr
Definition: rohc_comp_rfc3095.h:224
struct generic_tmp_vars tmp
Temporary variables that are used during one single compression of packet.
Definition: rohc_comp_rfc3095.h:238
rohc_packet_t packet_type
Definition: rohc_comp_internals.h:318
bool sn_9bits_possible
Definition: rohc_comp_rfc3095.h:198
The information collected about the packet headers.
Definition: uncomp_pkt_hdrs.h:102
uint8_t ext_list_struct_changed
Definition: rohc_comp_rfc3095.h:163
bool sn_5bits_possible
Definition: rohc_comp_rfc3095.h:193
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:392
void rohc_comp_rfc3095_destroy(struct rohc_comp_ctxt *const context)
Destroy the context.
Definition: rohc_comp_rfc3095.c:649
struct ipv6_header_info v6
The IPv6-specific header info.
Definition: rohc_comp_rfc3095.h:132
uint8_t(* compute_crc_dynamic)(const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, const rohc_crc_type_t crc_type, const uint8_t init_val)
The handler used to compute the CRC-DYNAMIC value.
Definition: rohc_comp_rfc3095.h:308
bool(* encode_uncomp_fields)(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Definition: rohc_comp_rfc3095.h:249
Definition of ROHC packets and extensions.
int rohc_comp_rfc3095_encode(struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs, uint8_t *const rohc_pkt, const size_t rohc_pkt_max_len, rohc_packet_t *const packet_type)
Encode an IP packet according to a pattern decided by several different factors.
Definition: rohc_comp_rfc3095.c:691
struct c_wlsb sn_window
A window used to encode the SN.
Definition: rohc_comp_rfc3095.h:215
int nbo
Whether the IP-ID is considered as coded in NBO or not.
Definition: rohc_comp_rfc3095.h:74
bool sn_8bits_possible
Definition: rohc_comp_rfc3095.h:194
uint8_t crc_static_3_cached
Definition: rohc_comp_rfc3095.h:231
uint8_t ext_list_struct_just_changed
Definition: rohc_comp_rfc3095.h:161
size_t ttl_count
The number of times the TTL/HL field was added to the compressed header.
Definition: rohc_comp_rfc3095.h:123
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:82
struct rfc3095_ip_hdr_changes ip_hdr_changes[ROHC_MAX_IP_HDRS]
Definition: rohc_comp_rfc3095.h:187
The list compressor.
Definition: comp_list.h:43
uint8_t ext_list_content_changed
Definition: rohc_comp_rfc3095.h:167
bool sn_4bits_possible
Definition: rohc_comp_rfc3095.h:189
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:233
rohc_packet_t(* decide_FO_packet)(const struct rohc_comp_ctxt *const context)
The handler used to decide which packet to send in FO state.
Definition: rohc_comp_rfc3095.h:254
uint8_t nbo_changed
Definition: rohc_comp_rfc3095.h:147
rohc_feedback_type
Definition: feedback.h:42
union ip_header_info::@36 info
The version specific header info.
int old_sid
Whether the IP-ID of the previous IP header was considered as static or not.
Definition: rohc_comp_rfc3095.h:85
bool is_crc_static_3_cached_valid
Definition: rohc_comp_rfc3095.h:229
rohc_packet_t
The different types of ROHC packets.
Definition: rohc_packets.h:55
struct c_wlsb msn_non_acked
Definition: rohc_comp_rfc3095.h:221
bool sn_14bits_possible
Definition: rohc_comp_rfc3095.h:199
static bool does_at_least_one_rnd_change(const struct rohc_comp_rfc3095_ctxt *const ctxt, const uint8_t oa_repetitions_nr)
at least one RND flag changed now or in the last few packets?
Definition: rohc_comp_rfc3095.h:451
struct ip_header_info ip_ctxts[ROHC_MAX_IP_HDRS]
Definition: rohc_comp_rfc3095.h:226
uint32_t(* get_next_sn)(const struct rohc_comp_ctxt *const context, const struct rohc_pkt_hdrs *const uncomp_pkt_hdrs)
Definition: rohc_comp_rfc3095.h:265
void rohc_get_ipid_bits(const struct rohc_comp_ctxt *const context, bool *const innermost_ip_id_changed, bool *const innermost_ip_id_3bits_possible, bool *const innermost_ip_id_5bits_possible, bool *const innermost_ip_id_8bits_possible, bool *const innermost_ip_id_11bits_possible, bool *const outermost_ip_id_changed, bool *const outermost_ip_id_11bits_possible)
Get the number of non-random outer/inner IP-ID bits.
Definition: rohc_comp_rfc3095.c:6823
#define ROHC_MAX_IP_HDRS
The maximum number of IP headers supported.
Definition: protocols/ip.h:46
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:756
The generic decompression context for RFC3095-based profiles.
Definition: rohc_comp_rfc3095.h:210