ROHC compression/decompression library
comp_list.h
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 2 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * This program is distributed in the hope that it will be useful,
00008  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  * GNU General Public License for more details.
00011  *
00012  * You should have received a copy of the GNU General Public License
00013  * along with this program; if not, write to the Free Software
00014  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  */
00016 
00023 #ifndef COMP_LIST_H
00024 #define COMP_LIST_H
00025 
00026 #include <netinet/ip6.h>
00027 #include "rohc.h"
00028 
00029 
00031 typedef enum
00032 {
00034         HBH = 0,
00036         DEST = 60,
00038         RTHDR = 43,
00040         AH = 51,
00041 /*      /// CSRC
00042         CSRC = 10,*/
00043 } ext_header_version;
00044                                 
00045 
00046 
00050 struct item
00051 {
00053         ext_header_version type;        
00055         union
00056         {
00057                 struct ip6_hbh * hbh;       
00058                 struct ip6_dest * dest;     
00059                 struct ip6_rthdr * rthdr;   
00060                 struct ip6_ahhdr * ahhdr;   
00061         }header;
00063         int length;
00065         unsigned char * data;
00066 };
00067 
00071 struct list_elt
00072 {
00074         struct item * item;
00076         int index_table;
00078         struct list_elt * next_elt;
00080         struct list_elt * prev_elt;
00081 };
00082 
00086 struct c_list
00087 {
00089         int gen_id;
00091         struct list_elt * first_elt;
00092 };
00093 
00097 struct c_translation
00098 {
00101         int known;
00103         struct item * item;
00105         int counter;
00106 };
00107 
00111 struct d_translation
00112 {
00115         int known;
00117         struct item * item;
00118 };                               
00119 
00124 int create_list(struct c_list * list);
00125 int add_elt(struct c_list * list, struct item * item, int index);
00126 int push_back(struct c_list * list, struct item * item, int index);
00127 void delete_elt(struct c_list * list, struct item * item);
00128 struct list_elt * get_elt(struct c_list * list, int index);
00129 int elt_index(struct c_list * list, struct item * item);
00130 int type_is_present(struct c_list * list, struct item * item);
00131 void destroy_list(struct c_list * list);
00132 int insert_elt(struct c_list * list, struct item * item, int index, int index_table);
00133 int size_list(struct c_list * list);
00134 void empty_list(struct c_list * list);
00135 
00136 #endif