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 <stdlib.h>
Include dependency graph for comp_list.c:

Functions

int list_create (struct c_list *list)
 Create one compression_list.
void list_destroy (struct c_list *list)
 Destroy the list.
int list_add_at_beginning (struct c_list *list, struct rohc_list_item *item, int index)
 Add an element at the beginning of the list.
int list_add_at_end (struct c_list *list, struct rohc_list_item *item, int index)
 Add an element at the end of the list.
int list_add_at_index (struct c_list *list, struct rohc_list_item *item, int index, int index_table)
 Insert an element at the specified position.
struct list_eltlist_get_elt_by_index (struct c_list *list, int index)
 Get the element at the specified index.
int list_get_index_by_elt (struct c_list *list, struct rohc_list_item *item)
 Get the index of the specified element in the list.
void list_remove (struct c_list *list, struct rohc_list_item *item)
 Delete the specified element of the list.
void list_empty (struct c_list *list)
 Empty the list.
int list_type_is_present (struct c_list *list, struct rohc_list_item *item)
 Indicate if the type of the specified element is present.
size_t list_get_size (const struct c_list *const list)
 Get the size of the given list.

Detailed Description

Define list compression with its function.

Author:
Emmanuelle Pechereau <epechereau@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>

Function Documentation

int list_add_at_beginning ( struct c_list list,
struct rohc_list_item item,
int  index 
)

Add an element at the beginning 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 list_add_at_end(), and list_add_at_index().

int list_add_at_end ( struct c_list list,
struct rohc_list_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 c_list::first_elt, list_elt::index_table, list_elt::item, list_add_at_beginning(), list_elt::next_elt, list_elt::prev_elt, and rohc_debugf.

int list_add_at_index ( struct c_list list,
struct rohc_list_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 successful, 0 otherwise

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

int list_create ( struct c_list list)

Create one compression_list.

Returns:
1 if successful, 0 otherwise

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

void list_destroy ( struct c_list list)

Destroy the list.

Parameters:
listthe list to destroy

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

Referenced by c_generic_destroy(), and d_generic_destroy().

void list_empty ( 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.

struct list_elt* list_get_elt_by_index ( 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_get_size(), and list_elt::next_elt.

int list_get_index_by_elt ( struct c_list list,
struct rohc_list_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.

size_t list_get_size ( const struct c_list *const  list)

Get the size of the given list.

Parameters:
listThe list
Returns:
The size of the list

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

Referenced by code_ipv6_dynamic_part(), list_add_at_index(), and list_get_elt_by_index().

void list_remove ( struct c_list list,
struct rohc_list_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.

int list_type_is_present ( struct c_list list,
struct rohc_list_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 rohc_list_item::type.