ROHC compression/decompression library
Functions
comp_list.c File Reference

Define list compression with its function. More...

#include "comp_list.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
Include dependency graph for comp_list.c:

Functions

static bool rohc_list_item_update (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 the given compressed item.
void rohc_list_reset (struct rohc_list *const list)
 Reset the state of the given compressed list.
bool rohc_list_equal (const struct rohc_list *const list1, const struct rohc_list *const list2)
 Are the two given lists equal?
bool rohc_list_supersede (const struct rohc_list *const large, const struct rohc_list *const small)
 Does the first list contains the second list?
void rohc_list_item_reset (struct rohc_list_item *const list_item)
 Reset the given list item.
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.

Detailed Description

Define list compression with its function.

Author:
Didier Barvaux <didier@barvaux.org>

Function Documentation

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
void rohc_list_item_reset ( struct rohc_list_item *const  list_item)

Reset the given list item.

Parameters:
list_itemThe item to reset
static bool rohc_list_item_update ( struct rohc_list_item *const  list_item,
const uint8_t  item_type,
const uint8_t *const  item_data,
const size_t  item_len 
) [static]

Update the content the given compressed item.

Parameters:
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:
true if the update was successful, false otherwise
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
void rohc_list_reset ( struct rohc_list *const  list)

Reset the state of the given compressed list.

Parameters:
listThe list to reset
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