ROHC generic list compression. More...
#include "schemes/comp_list.h"#include "rohc_comp_internals.h"#include <string.h>
Defines | |
| #define | rohc_comp_list_warn(list_ctxt, format,...) |
Functions | |
| static bool | build_ipv6_ext_pkt_list (struct list_comp *const comp, const struct ip_packet *const ip, struct rohc_list *const pkt_list) |
| Compute the list of extension headers for the current packet. | |
| static unsigned int | rohc_list_get_nearest_list (const struct list_comp *const comp, const struct rohc_list *const pkt_list, bool *const is_new_list) |
| Search the nearest list for the packet list. | |
| static int | rohc_list_decide_type (struct list_comp *const comp) |
| Decide the encoding type for compression list. | |
| static int | rohc_list_encode_type_0 (struct list_comp *const comp, uint8_t *const dest, int counter) |
| Build encoding type 0 for list compression. | |
| static int | rohc_list_encode_type_1 (struct list_comp *const comp, uint8_t *const dest, int counter) |
| Build encoding type 1 for list compression. | |
| static int | rohc_list_encode_type_2 (struct list_comp *const comp, uint8_t *const dest, int counter) |
| Build encoding type 2 for list compression. | |
| static int | rohc_list_encode_type_3 (struct list_comp *const comp, uint8_t *const dest, int counter) |
| Build encoding type 3 for list compression. | |
| static size_t | rohc_list_compute_ins_mask (const struct list_comp *const comp, const struct rohc_list *const ref_list, const struct rohc_list *const cur_list, const uint8_t rem_mask[ROHC_LIST_ITEMS_MAX], uint8_t ins_mask[ROHC_LIST_ITEMS_MAX], uint8_t *const rohc_data, const size_t rohc_max_len) |
| Determine the insertion bit mask. | |
| static size_t | rohc_list_compute_rem_mask (const struct list_comp *const comp, const struct rohc_list *const ref_list, const struct rohc_list *const cur_list, uint8_t rem_mask[ROHC_LIST_ITEMS_MAX], uint8_t *const rohc_data, const size_t rohc_max_len) |
| Determine the removal bit mask. | |
| static uint8_t | rohc_list_compute_ps (const struct list_comp *const comp, const struct rohc_list *const list, const uint8_t mask[ROHC_LIST_ITEMS_MAX], const size_t m) |
| Determine whether we should use 4-bit or 8-bit indexes. | |
| static int | rohc_list_build_XIs (const struct list_comp *const comp, const struct rohc_list *const list, const uint8_t mask[ROHC_LIST_ITEMS_MAX], const size_t ps, uint8_t *const rohc_data, const size_t rohc_max_len, uint8_t *const first_4b_xi) |
| Build the list of indexes (XI). | |
| static int | rohc_list_build_XIs_8 (const struct list_comp *const comp, const struct rohc_list *const list, const uint8_t mask[ROHC_LIST_ITEMS_MAX], uint8_t *const rohc_data, const size_t rohc_max_len) |
| Build the list of 8-bit indexes (XI). | |
| static int | rohc_list_build_XIs_4 (const struct list_comp *const comp, const struct rohc_list *const list, const uint8_t mask[ROHC_LIST_ITEMS_MAX], uint8_t *const rohc_data, const size_t rohc_max_len, uint8_t *const first_4b_xi) |
| Build the list of 4-bit indexes (XI). | |
| bool | detect_ipv6_ext_changes (struct list_comp *const comp, const struct ip_packet *const ip, bool *const list_struct_changed, bool *const list_content_changed) |
| Detect changes within the list of IPv6 extension headers. | |
| int | rohc_list_encode (struct list_comp *const comp, uint8_t *const dest, int counter) |
| Generic encoding of compressed list. | |
| void | rohc_list_update_context (struct list_comp *const comp) |
| Update the list compression context. | |
ROHC generic list compression.
| #define rohc_comp_list_warn | ( | list_ctxt, | |||
| format, | |||||
| ... | ) |
rohc_warning(list_ctxt, ROHC_TRACE_COMP, (list_ctxt)->profile_id, \ format, ##__VA_ARGS__)
Print a warning trace for the given list compression context
| static bool build_ipv6_ext_pkt_list | ( | struct list_comp *const | comp, | |
| const struct ip_packet *const | ip, | |||
| struct rohc_list *const | pkt_list | |||
| ) | [static] |
Compute the list of extension headers for the current packet.
Parse all extension headers:
| comp | The list compressor | |
| ip | The IP packet to compress | |
| [out] | pkt_list | The list of extension headers for the current packet |
| bool detect_ipv6_ext_changes | ( | struct list_comp *const | comp, | |
| const struct ip_packet *const | ip, | |||
| bool *const | list_struct_changed, | |||
| bool *const | list_content_changed | |||
| ) |
Detect changes within the list of IPv6 extension headers.
| comp | The list compressor | |
| ip | The IP packet to compress | |
| [out] | list_struct_changed | Whether the structure of the list changed |
| [out] | list_content_changed | Whether the content of the list changed |
| static int rohc_list_build_XIs | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | list, | |||
| const uint8_t | mask[ROHC_LIST_ITEMS_MAX], | |||
| const size_t | ps, | |||
| uint8_t *const | rohc_data, | |||
| const size_t | rohc_max_len, | |||
| uint8_t *const | first_4b_xi | |||
| ) | [static] |
Build the list of indexes (XI).
| comp | The list compressor | |
| list | The current list to get the indexes size for | |
| mask | The insertion mask for the current list | |
| ps | The size of the indexes: 1 for 8-bit XI, 0 for 4-bit XI | |
| rohc_data | The ROHC packet being built | |
| rohc_max_len | The max remaining length in the ROHC buffer | |
| first_4b_xi | The first 4-bit XI item |
| static int rohc_list_build_XIs_4 | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | list, | |||
| const uint8_t | mask[ROHC_LIST_ITEMS_MAX], | |||
| uint8_t *const | rohc_data, | |||
| const size_t | rohc_max_len, | |||
| uint8_t *const | first_4b_xi | |||
| ) | [static] |
Build the list of 4-bit indexes (XI).
| comp | The list compressor | |
| list | The current list to get the indexes size for | |
| mask | The insertion mask for the current list | |
| rohc_data | The ROHC packet being built | |
| rohc_max_len | The max remaining length in the ROHC buffer | |
| first_4b_xi | The first 4-bit XI item |
| static int rohc_list_build_XIs_8 | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | list, | |||
| const uint8_t | mask[ROHC_LIST_ITEMS_MAX], | |||
| uint8_t *const | rohc_data, | |||
| const size_t | rohc_max_len | |||
| ) | [static] |
Build the list of 8-bit indexes (XI).
| comp | The list compressor | |
| list | The current list to get the indexes size for | |
| mask | The insertion mask for the current list | |
| rohc_data | The ROHC packet being built | |
| rohc_max_len | The max remaining length in the ROHC buffer |
| static size_t rohc_list_compute_ins_mask | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | ref_list, | |||
| const struct rohc_list *const | cur_list, | |||
| const uint8_t | rem_mask[ROHC_LIST_ITEMS_MAX], | |||
| uint8_t | ins_mask[ROHC_LIST_ITEMS_MAX], | |||
| uint8_t *const | rohc_data, | |||
| const size_t | rohc_max_len | |||
| ) | [static] |
Determine the insertion bit mask.
| comp | The list compressor | |
| ref_list | The reference list | |
| cur_list | The current list to create the insertion mask for | |
| rem_mask | The removal mask for the list | |
| [out] | ins_mask | The insertion mask for the list |
| rohc_data | The ROHC packet being built | |
| rohc_max_len | The max remaining length in the ROHC buffer |
| static uint8_t rohc_list_compute_ps | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | list, | |||
| const uint8_t | mask[ROHC_LIST_ITEMS_MAX], | |||
| const size_t | m | |||
| ) | [static] |
Determine whether we should use 4-bit or 8-bit indexes.
| comp | The list compressor | |
| list | The list to get the indexes size for | |
| mask | The insertion mask for the list | |
| m | The number of elements in current list |
| static size_t rohc_list_compute_rem_mask | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | ref_list, | |||
| const struct rohc_list *const | cur_list, | |||
| uint8_t | rem_mask[ROHC_LIST_ITEMS_MAX], | |||
| uint8_t *const | rohc_data, | |||
| const size_t | rohc_max_len | |||
| ) | [static] |
Determine the removal bit mask.
| comp | The list compressor | |
| ref_list | The reference list | |
| cur_list | The current list to create the removal mask for | |
| [out] | rem_mask | The removal mask for the list |
| rohc_data | The ROHC packet being built | |
| rohc_max_len | The max remaining length in the ROHC buffer |
| static int rohc_list_decide_type | ( | struct list_comp *const | comp | ) | [static] |
Decide the encoding type for compression list.
| comp | The list compressor |
| int rohc_list_encode | ( | struct list_comp *const | comp, | |
| uint8_t *const | dest, | |||
| int | counter | |||
| ) |
Generic encoding of compressed list.
| comp | The list compressor | |
| dest | The ROHC packet under build | |
| counter | The current position in the rohc-packet-under-build buffer |
| static int rohc_list_encode_type_0 | ( | struct list_comp *const | comp, | |
| uint8_t *const | dest, | |||
| int | counter | |||
| ) | [static] |
Build encoding type 0 for list compression.
Encoding type 0 (5.8.6.1):
0 1 2 3 4 5 6 7
--- --- --- --- --- --- --- ---
1 | ET = 0| GP| PS| CC = m |
+---+---+---+---+---+---+---+---+
2 : gen_id : 1 octet, if GP = 1
+---+---+---+---+---+---+---+---+
| XI 1, ..., XI m | m octets, or m * 4 bits
3 / --- --- --- --- /
| : Padding : if PS = 0 and m is odd
+---+---+---+---+---+---+---+---+
| |
4 / item 1, ..., item n / variable length
| |
+---+---+---+---+---+---+---+---+
ET: Encoding type is zero.
GP: Indicates presence of gen_id field.
PS: Indicates size of XI fields:
PS = 0 indicates 4-bit XI fields;
PS = 1 indicates 8-bit XI fields.
CC: CSRC counter from original RTP header.
gen_id: Identifier for a sequence of identical lists. It is
present in U/O-mode when the compressor decides that it may use
this list as a future reference list.
XI 1, ..., XI m: m XI items. The format of an XI item is as
follows:
+---+---+---+---+
PS = 0: | X | Index |
+---+---+---+---+
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
PS = 1: | X | Index |
+---+---+---+---+---+---+---+---+
X = 1 indicates that the item corresponding to the Index
is sent in the item 0, ..., item n list.
X = 0 indicates that the item corresponding to the Index is
not sent.
When 4-bit XI items are used and m > 1, the XI items are placed in
octets in the following manner:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| XI k | XI k + 1 |
+---+---+---+---+---+---+---+---+
Padding: A 4-bit padding field is present when PS = 0 and m is
odd. The Padding field is set to zero when sending and ignored
when receiving.
Item 1, ..., item n:
Each item corresponds to an XI with X = 1 in XI 1, ..., XI m.
| comp | The list compressor | |
| dest | The ROHC packet under build | |
| counter | The current position in the rohc-packet-under-build buffer |
| static int rohc_list_encode_type_1 | ( | struct list_comp *const | comp, | |
| uint8_t *const | dest, | |||
| int | counter | |||
| ) | [static] |
Build encoding type 1 for list compression.
Encoding type 1 (5.8.6.2):
0 1 2 3 4 5 6 7
--- --- --- --- --- --- --- ---
1 | ET = 1| GP| PS| XI 1 |
+---+---+---+---+---+---+---+---+
2 : gen_id : 1 octet, if GP = 1
+---+---+---+---+---+---+---+---+
3 | ref_id |
+---+---+---+---+---+---+---+---+
4 / insertion bit mask / 1-2 octets
+---+---+---+---+---+---+---+---+
| XI list | k octets, or (k - 1) * 4 bits
5 / --- --- --- --- /
| : Padding : if PS = 0 and k is even
+---+---+---+---+---+---+---+---+
| |
6 / item 1, ..., item n / variable
| |
+---+---+---+---+---+---+---+---+
ET: Encoding type is one (1).
GP: Indicates presence of gen_id field.
PS: Indicates size of XI fields:
PS = 0 indicates 4-bit XI fields;
PS = 1 indicates 8-bit XI fields.
XI 1: When PS = 0, the first 4-bit XI item is placed here.
When PS = 1, the field is set to zero when sending, and
ignored when receiving.
ref_id: The identifier of the reference CSRC list used when the
list was compressed. It is the 8 least significant bits of
the RTP Sequence Number in R-mode and gen_id (see section
5.8.2) in U/O-mode.
insertion bit mask: Bit mask indicating the positions where new
items are to be inserted. See Insertion Only scheme in
section 5.8.3. The bit mask can have either of the
following two formats:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 7-bit mask | bit 1 is the first bit
+---+---+---+---+---+---+---+---+
+---+---+---+---+---+---+---+---+
| 1 | | bit 1 is the first bit
+---+ 15-bit mask +
| | bit 7 is the last bit
+---+---+---+---+---+---+---+---+
XI list: XI fields for items to be inserted. When the insertion
bit mask has k ones, the total number of XI fields is k. When
PS = 1, all XI fields are in the XI list. When PS = 0, the
first XI field is in the XI 1 field, and the remaining k - 1
XI fields are in the XI list.
Padding: Present when PS = 0 and k is even.
item 1, ..., item n: One item for each XI field with the X bit set.
| comp | The list compressor | |
| dest | The ROHC packet under build | |
| counter | The current position in the rohc-packet-under-build buffer |
| static int rohc_list_encode_type_2 | ( | struct list_comp *const | comp, | |
| uint8_t *const | dest, | |||
| int | counter | |||
| ) | [static] |
Build encoding type 2 for list compression.
Encoding type 2 (5.8.6.3):
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
1 | ET = 2| GP|res| Count |
+---+---+---+---+---+---+---+---+
2 : gen_id : 1 octet, if GP = 1
+---+---+---+---+---+---+---+---+
3 | ref_id |
+---+---+---+---+---+---+---+---+
4 / removal bit mask / 1-2 octets
+---+---+---+---+---+---+---+---+
ET: Encoding type is 2.
GP: Indicates presence of gen_id field.
res: Reserved. Set to zero when sending, ignored when
received.
Count: Number of elements in ref_list.
removal bit mask: Indicates the elements in ref_list to be
removed in order to obtain the current list. See section
5.8.3. The bit mask can have either of the following two
formats:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 7-bit mask | bit 1 is the first bit
+---+---+---+---+---+---+---+---+
+---+---+---+---+---+---+---+---+
| 1 | | bit 1 is the first bit
+---+ 15-bit mask +
| | bit 7 is the last bit
+---+---+---+---+---+---+---+---+
| comp | The list compressor | |
| dest | The ROHC packet under build | |
| counter | The current position in the rohc-packet-under-build buffer |
| static int rohc_list_encode_type_3 | ( | struct list_comp *const | comp, | |
| uint8_t *const | dest, | |||
| int | counter | |||
| ) | [static] |
Build encoding type 3 for list compression.
Encoding type 3 (5.8.6.4):
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
1 | ET=3 |GP |PS | XI 1 |
+---+---+---+---+---+---+---+---+
2 : gen_id : 1 octet, if GP = 1
+---+---+---+---+---+---+---+---+
3 | ref_id |
+---+---+---+---+---+---+---+---+
4 / removal bit mask / 1-2 octets
+---+---+---+---+---+---+---+---+
5 / insertion bit mask / 1-2 octets
+---+---+---+---+---+---+---+---+
| XI list | k octets, or (k - 1) * 4 bits
6 / --- --- --- --- /
| : Padding : if PS = 0 and k is even
+---+---+---+---+---+---+---+---+
| |
7 / item 1, ..., item n / variable
| |
+---+---+---+---+---+---+---+---+
ET: Encoding type is 3.
GP: Indicates presence of gen_id field.
PS: Indicates size of XI fields:
PS = 0 indicates 4-bit XI fields;
PS = 1 indicates 8-bit XI fields.
gen_id: Identifier for a sequence of identical lists. It is
present in U/O-mode when the compressor decides that it may use
this list as a future reference list.
ref_id: The identifier of the reference CSRC list used when the
list was compressed. It is the 8 least significant bits of
the RTP Sequence Number in R-mode and gen_id (see section
5.8.2) in U/O-mode.
removal bit mask: Indicates the elements in ref_list to be
removed in order to obtain the current list. See section
5.8.3. The bit mask can have either of the following two
formats:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 7-bit mask | bit 1 is the first bit
+---+---+---+---+---+---+---+---+
+---+---+---+---+---+---+---+---+
| 1 | | bit 1 is the first bit
+---+ 15-bit mask +
| | bit 7 is the last bit
+---+---+---+---+---+---+---+---+
insertion bit mask: Bit mask indicating the positions where new
items are to be inserted. See Insertion Only scheme in
section 5.8.3. The bit mask can have either of the
following two formats:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 7-bit mask | bit 1 is the first bit
+---+---+---+---+---+---+---+---+
+---+---+---+---+---+---+---+---+
| 1 | | bit 1 is the first bit
+---+ 15-bit mask +
| | bit 7 is the last bit
+---+---+---+---+---+---+---+---+
XI list: XI fields for items to be inserted. When the insertion
bit mask has k ones, the total number of XI fields is k. When
PS = 1, all XI fields are in the XI list. When PS = 0, the
first XI field is in the XI 1 field, and the remaining k - 1
XI fields are in the XI list.
Padding: Present when PS = 0 and k is even.
item 1, ..., item n: One item for each XI field with the X bit set.
| comp | The list compressor | |
| dest | The ROHC packet under build | |
| counter | The current position in the rohc-packet-under-build buffer |
| static unsigned int rohc_list_get_nearest_list | ( | const struct list_comp *const | comp, | |
| const struct rohc_list *const | pkt_list, | |||
| bool *const | is_new_list | |||
| ) | [static] |
Search the nearest list for the packet list.
Search for a context list with the same structure:
| comp | The list compressor | |
| pkt_list | The list of extension headers for the current packet | |
| [out] | is_new_list | Whether the list is new or not |
| void rohc_list_update_context | ( | struct list_comp *const | comp | ) |
Update the list compression context.
Update the counter of the current list. Update the counters of the items of the current list. Update the reference list with the current list if possible.
| comp | The list compressor |
1.6.1