ROHC compression/decompression library
|
00001 /* 00002 * Copyright 2013 Didier Barvaux 00003 * Copyright 2007,2008 Thales Alenia Space 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 /** 00021 * @file /comp/schemes/list.h 00022 * @brief ROHC generic list compression 00023 * @author Didier Barvaux <didier@barvaux.org> 00024 */ 00025 00026 #ifndef ROHC_COMP_LIST_H 00027 #define ROHC_COMP_LIST_H 00028 00029 #include "ip.h" 00030 #include "comp_list.h" 00031 #include "rohc_traces_internal.h" 00032 00033 /** Print a debug trace for the given compression list */ 00034 #define rc_list_debug(comp_list, format, ...) \ 00035 rohc_debug(comp_list, ROHC_TRACE_COMP, (comp_list)->profile_id, \ 00036 format, ##__VA_ARGS__) 00037 00038 00039 /** 00040 * @brief The list compressor 00041 */ 00042 struct list_comp 00043 { 00044 /** The translation table */ 00045 struct rohc_list_item trans_table[ROHC_LIST_MAX_ITEM]; 00046 00047 /* All the possible named lists, indexed by gen_id */ 00048 struct rohc_list lists[ROHC_LIST_GEN_ID_MAX + 1]; 00049 00050 /** The temporary packet list (not persistent accross packets) */ 00051 struct rohc_list pkt_list; 00052 00053 /** The ID of the reference list */ 00054 unsigned int ref_id; 00055 /** The ID of the current list */ 00056 unsigned int cur_id; /* TODO: should not be overwritten until compression 00057 is fully OK */ 00058 00059 /** The number of uncompressed transmissions for list compression (L) */ 00060 size_t list_trans_nr; 00061 00062 /* Functions for handling the data to compress */ 00063 00064 /// @brief the handler used to get the index of an item 00065 int (*get_index_table)(const uint8_t type) 00066 __attribute__((warn_unused_result, const)); 00067 00068 /// @brief the handler used to get the size of an item 00069 unsigned short (*get_size)(const unsigned char *ext); 00070 00071 /** The handler used to compare two items */ 00072 rohc_list_item_cmp cmp_item; 00073 00074 /* Traces */ 00075 00076 #if !defined(ROHC_ENABLE_DEPRECATED_API) || ROHC_ENABLE_DEPRECATED_API == 1 00077 /** The old callback function used to manage traces */ 00078 rohc_trace_callback_t trace_callback; 00079 #endif 00080 /** The new callback function used to manage traces */ 00081 rohc_trace_callback2_t trace_callback2; 00082 /** The private context of the callback function used to manage traces */ 00083 void *trace_callback_priv; 00084 /** The profile ID the compression list was created for */ 00085 int profile_id; 00086 }; 00087 00088 00089 bool ROHC_EXPORT detect_ipv6_ext_changes(struct list_comp *const comp, 00090 const struct ip_packet *const ip, 00091 bool *const list_struct_changed, 00092 bool *const list_content_changed) 00093 __attribute__((warn_unused_result, nonnull(1, 2, 3, 4))); 00094 00095 int ROHC_EXPORT rohc_list_encode(struct list_comp *const comp, 00096 unsigned char *const dest, 00097 int counter, 00098 const int size) 00099 __attribute__((warn_unused_result, nonnull(1, 2))); 00100 00101 void ROHC_EXPORT rohc_list_update_context(struct list_comp *const comp) 00102 __attribute__((nonnull(1))); 00103 00104 #endif 00105