ROHC compression/decompression library
Functions
comp_list.c File Reference

Define list compression with its function. More...

#include "comp_list.h"
#include "rohc_traces.h"
Include dependency graph for comp_list.c:

Functions

int create_list (struct c_list *list)
 Create one compression_list.
int add_elt (struct c_list *list, struct item *item, int index)
 Add an element at the begin of the list.
int push_back (struct c_list *list, struct item *item, int index)
 Add an element at the end of the list.
void delete_elt (struct c_list *list, struct item *item)
 Delete the specified element of the list.
int elt_index (struct c_list *list, struct item *item)
 Get the index of the specified element in the list.
struct list_eltget_elt (struct c_list *list, int index)
 Get the element at the specified index.
int type_is_present (struct c_list *list, struct item *item)
 Indicate if the type of the specified element is present.
void empty_list (struct c_list *list)
 Empty the list.
void destroy_list (struct c_list *list)
 Destroy the list.
int insert_elt (struct c_list *list, struct item *item, int index, int index_table)
 Insert an element at the specified position.
int size_list (struct c_list *list)
 Get the size of the list.

Detailed Description

Define list compression with its function.

Author:
Emmanuelle Pechereau <epechereau@toulouse.viveris.com>

Function Documentation

int add_elt ( struct c_list list,
struct item item,
int  index 
)

Add an element at the begin of the list.

Parameters:
listthe list where the element is added
itemthe item of the new element
indexthe index in based table
Returns:
1 if successful, 0 otherwise

References c_list::first_elt, list_elt::index_table, list_elt::item, list_elt::next_elt, list_elt::prev_elt, and rohc_debugf.

Referenced by insert_elt(), and push_back().

int create_list ( struct c_list list)

Create one compression_list.

Returns:
1 if successfull, 0 otherwise

References c_list::first_elt, c_list::gen_id, and rohc_debugf.

void delete_elt ( struct c_list list,
struct item item 
)

Delete the specified element of the list.

Parameters:
listthe list where the element is destroyed
itemthe element to delete

References c_list::first_elt, list_elt::item, list_elt::next_elt, and list_elt::prev_elt.

Referenced by c_algo_list_compress(), and c_create_current_list().

void destroy_list ( struct c_list list)

Destroy the list.

Parameters:
listthe list to destroy

References c_list::first_elt, list_elt::next_elt, list_elt::prev_elt, and rohc_debugf.

Referenced by c_generic_destroy(), and d_generic_destroy().

int elt_index ( struct c_list list,
struct item item 
)

Get the index of the specified element in the list.

Parameters:
listthe list where is the element
itemthe specified element
Returns:
the index, -1 if the element is not in the list

References c_list::first_elt, list_elt::item, and list_elt::next_elt.

Referenced by c_create_current_list().

void empty_list ( struct c_list list)

Empty the list.

Parameters:
listthe list to empty

References c_list::first_elt, list_elt::next_elt, list_elt::prev_elt, and rohc_debugf.

Referenced by c_algo_list_compress(), decode_type_0(), decode_type_1(), decode_type_2(), and decode_type_3().

struct list_elt* get_elt ( struct c_list list,
int  index 
) [read]

Get the element at the specified index.

Parameters:
listthe list where is the element
indexthe specified index
Returns:
item, NULL if there is no element at this index

References c_list::first_elt, list_elt::next_elt, and size_list().

Referenced by c_algo_list_compress(), c_create_current_list(), d_decode_dynamic_ip6(), decide_type(), decode_type_1(), decode_type_2(), decode_type_3(), encode_ip6_extension(), encode_list(), encode_type_0(), encode_type_1(), encode_type_2(), and encode_type_3().

int insert_elt ( struct c_list list,
struct item item,
int  index,
int  index_table 
)

Insert an element at the specified position.

Parameters:
listThe list in which the element is inserted
itemthe element to insert
indexthe position
index_tablethe index in based_table
Returns:
1 if successfull, 0 else

References add_elt(), c_list::first_elt, list_elt::index_table, list_elt::item, list_elt::next_elt, list_elt::prev_elt, rohc_debugf, and size_list().

Referenced by c_algo_list_compress(), c_create_current_list(), decode_type_0(), decode_type_1(), decode_type_2(), and decode_type_3().

int push_back ( struct c_list list,
struct item item,
int  index 
)

Add an element at the end of the list.

Parameters:
listthe list where the element is added
itemthe item of the new element
indexthe index in based table
Returns:
1 if successful, 0 otherwise

References add_elt(), c_list::first_elt, list_elt::index_table, list_elt::item, list_elt::next_elt, list_elt::prev_elt, and rohc_debugf.

Referenced by c_create_current_list().

int size_list ( struct c_list list)
int type_is_present ( struct c_list list,
struct item item 
)

Indicate if the type of the specified element is present.

Parameters:
listthe list where is the element
itemthe specified element
Returns:
1 if present, 0 else

References c_list::first_elt, list_elt::item, list_elt::next_elt, rohc_debugf, and item::type.

Referenced by decide_type(), encode_type_1(), encode_type_2(), and encode_type_3().