ROHC compression/decompression library
Data Structures | Macros | Typedefs | Enumerations | Functions
rohc_list.h File Reference

Define list compression with its function. More...

#include "protocols/ipv6.h"
#include "protocols/ip_numbers.h"
#include <stdlib.h>
Include dependency graph for rohc_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rohc_list
 Define a list for compression. More...
 
struct  rohc_list_item
 A list item. More...
 

Macros

#define ROHC_LIST_MAX_ITEM   16U
 
#define ROHC_LIST_GEN_ID_MAX   0xffU
 
#define ROHC_LIST_GEN_ID_ANON   (ROHC_LIST_GEN_ID_MAX + 1)
 
#define ROHC_LIST_GEN_ID_NONE   (ROHC_LIST_GEN_ID_MAX + 2)
 
#define ROHC_LIST_ITEMS_MAX   15U
 
#define ROHC_LIST_ITEM_DATA_MAX   2048U
 The maximum length (in bytes) of item data. More...
 

Typedefs

typedef bool(* rohc_list_item_cmp) (const struct rohc_list_item *const item, const uint8_t ext_type, const uint8_t *const ext_data, const size_t ext_len)
 

Enumerations

enum  ext_header_version { HBH = ROHC_IPPROTO_HOPOPTS, RTHDR = ROHC_IPPROTO_ROUTING, AH = ROHC_IPPROTO_AH, DEST = ROHC_IPPROTO_DSTOPTS }
 Header version. More...
 

Functions

void rohc_list_reset (struct rohc_list *const list)
 Reset the state of the given compressed list. More...
 
bool rohc_list_equal (const struct rohc_list *const list1, const struct rohc_list *const list2)
 Are the two given lists equal? More...
 
bool rohc_list_supersede (const struct rohc_list *const large, const struct rohc_list *const small)
 Does the first list contains the second list? More...
 
void rohc_list_item_reset (struct rohc_list_item *const list_item)
 Reset the given list item. More...
 
int rohc_list_item_update_if_changed (rohc_list_item_cmp cmp_item, struct rohc_list_item *const list_item, const uint8_t item_type, const uint8_t *const item_data, const size_t item_len)
 Update the content of the given compressed item if it changed. More...
 

Detailed Description

Define list compression with its function.

Author
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Macro Definition Documentation

◆ ROHC_LIST_GEN_ID_ANON

#define ROHC_LIST_GEN_ID_ANON   (ROHC_LIST_GEN_ID_MAX + 1)

◆ ROHC_LIST_GEN_ID_MAX

#define ROHC_LIST_GEN_ID_MAX   0xffU

The largest gen_id value

◆ ROHC_LIST_GEN_ID_NONE

#define ROHC_LIST_GEN_ID_NONE   (ROHC_LIST_GEN_ID_MAX + 2)

◆ ROHC_LIST_ITEM_DATA_MAX

#define ROHC_LIST_ITEM_DATA_MAX   2048U

The maximum length (in bytes) of item data.

Sized for IPv6 extension headers that may reach: (0xff + 1) * 8 = 2048 bytes

◆ ROHC_LIST_ITEMS_MAX

#define ROHC_LIST_ITEMS_MAX   15U

The maximum number of items in a list (required by packet formats)

◆ ROHC_LIST_MAX_ITEM

#define ROHC_LIST_MAX_ITEM   16U

The maximum number of items in compressed lists

Typedef Documentation

◆ rohc_list_item_cmp

typedef bool(* rohc_list_item_cmp) (const struct rohc_list_item *const item, const uint8_t ext_type, const uint8_t *const ext_data, const size_t ext_len)

The handler used to compare two items

Enumeration Type Documentation

◆ ext_header_version

Header version.

Enumerator
HBH 

Hop by hop header

RTHDR 

Routing header

AH 

AH header

DEST 

Destination header

Function Documentation

◆ rohc_list_equal()

bool rohc_list_equal ( const struct rohc_list *const  list1,
const struct rohc_list *const  list2 
)

Are the two given lists equal?

We compare only the list structure, not the list content. Two lists with the same items in the same order, but with different content, are considered equals.

Parameters
list1The first list to compare
list2The other list to compare
Returns
true if the two lists are equal, false if they aren't

◆ rohc_list_item_reset()

void rohc_list_item_reset ( struct rohc_list_item *const  list_item)

Reset the given list item.

Parameters
list_itemThe item to reset

◆ rohc_list_item_update_if_changed()

int rohc_list_item_update_if_changed ( rohc_list_item_cmp  cmp_item,
struct rohc_list_item *const  list_item,
const uint8_t  item_type,
const uint8_t *const  item_data,
const size_t  item_len 
)

Update the content of the given compressed item if it changed.

Parameters
cmp_itemThe callback function to compare two items
list_itemThe item to update
item_typeThe type of the item to update
item_dataThe data to update item with
item_lenThe data length (in bytes)
Returns
0 if the item doesn't need to be updated, 1 if the update was successful, -1 if a problem occurred

◆ rohc_list_reset()

void rohc_list_reset ( struct rohc_list *const  list)

Reset the state of the given compressed list.

Functions prototypes

Parameters
listThe list to reset

◆ rohc_list_supersede()

bool rohc_list_supersede ( const struct rohc_list *const  large,
const struct rohc_list *const  small 
)

Does the first list contains the second list?

We compare only the list structure, not the list content. A list supersedes another list if all the items of the second list are present in the first list in the same order.

Parameters
largeThe large list that should supersedes the small list
smallThe small list that should be superseded by the large list
Returns
true if the large list supersedes the small list