ROHC compression/decompression library
comp_list.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Didier Barvaux
3  * Copyright 2007,2008 Thales Alenia Space
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 /**
21  * @file schemes/comp_list.h
22  * @brief ROHC generic list compression
23  * @author Didier Barvaux <didier@barvaux.org>
24  */
25 
26 #ifndef ROHC_COMP_LIST_H
27 #define ROHC_COMP_LIST_H
28 
29 #include "ip.h"
30 #include "rohc_list.h"
31 #include "rohc_traces_internal.h"
32 #include "rohc_comp_internals.h"
33 
34 /** Print a debug trace for the given compression list */
35 #define rc_list_debug(comp_list, format, ...) \
36  rohc_debug(comp_list, ROHC_TRACE_COMP, (comp_list)->profile_id, \
37  format, ##__VA_ARGS__)
38 
39 
40 /**
41  * @brief The list compressor
42  */
43 struct list_comp
44 {
45  /** The translation table */
47 
48  /* All the possible named lists, indexed by gen_id */
50 
51  /** The ID of the reference list */
52  unsigned int ref_id;
53  /** The ID of the current list */
54  unsigned int cur_id; /* TODO: should not be overwritten until compression
55  is fully OK */
56 
57  /** The number of uncompressed transmissions for list compression (L) */
59 
60  /* Functions for handling the data to compress */
61 
62  /// @brief the handler used to get the index of an item
63  int (*get_index_table)(const uint8_t type, const size_t occur_nr)
64  __attribute__((warn_unused_result, const));
65 
66  /** The handler used to compare two items */
68 
69  /* Traces */
70 
71  /** The callback function used to manage traces */
73  /** The private context of the callback function used to manage traces */
75  /** The profile ID the compression list was created for */
77 };
78 
79 
80 void detect_ipv6_ext_changes(struct list_comp *const comp,
81  const struct rohc_pkt_ip_hdr *const ip,
82  bool *const list_struct_changed,
83  bool *const list_content_changed)
84  __attribute__((nonnull(1, 2, 3, 4)));
85 
86 int rohc_list_encode(struct list_comp *const comp,
87  uint8_t *const dest,
88  int counter)
89  __attribute__((warn_unused_result, nonnull(1, 2)));
90 
91 void rohc_list_update_context(struct list_comp *const comp)
92  __attribute__((nonnull(1)));
93 
94 #endif
95 
The information collected about one of the packet IP headers.
Definition: uncomp_pkt_hdrs.h:59
void detect_ipv6_ext_changes(struct list_comp *const comp, const struct rohc_pkt_ip_hdr *const ip, bool *const list_struct_changed, bool *const list_content_changed)
Detect changes within the list of IPv6 extension headers.
Definition: comp_list.c:129
uint8_t counter
Definition: rohc_list.h:73
int rohc_list_encode(struct list_comp *const comp, uint8_t *const dest, int counter)
Generic encoding of compressed list.
Definition: comp_list.c:279
int profile_id
Definition: comp_list.h:76
struct rohc_list lists[ROHC_LIST_GEN_ID_MAX+2]
Definition: comp_list.h:49
unsigned int cur_id
Definition: comp_list.h:54
void(* rohc_trace_callback2_t)(void *const priv_ctxt, const rohc_trace_level_t level, const rohc_trace_entity_t entity, const int profile, const char *const format,...)
The function prototype for the trace callback.
Definition: rohc_traces.h:118
rohc_trace_callback2_t trace_callback
Definition: comp_list.h:72
void * trace_callback_priv
Definition: comp_list.h:74
Internal structures for ROHC compression.
bool nonnull(1)))
Define list compression with its function.
int(* get_index_table)(const uint8_t type, const size_t occur_nr)
the handler used to get the index of an item
Definition: comp_list.h:63
bool(* rohc_list_item_cmp)(const struct rohc_list_item *const item, const uint8_t ext_type, const uint8_t *const ext_data, const size_t ext_len)
Definition: rohc_list.h:124
#define ROHC_LIST_GEN_ID_MAX
Definition: rohc_list.h:54
#define ROHC_LIST_MAX_ITEM
Definition: rohc_list.h:36
void rohc_list_update_context(struct list_comp *const comp)
Update the list compression context.
Definition: comp_list.c:343
unsigned int ref_id
Definition: comp_list.h:52
The list compressor.
Definition: comp_list.h:43
A list item.
Definition: rohc_list.h:88
Define a list for compression.
Definition: rohc_list.h:62
rohc_list_item_cmp cmp_item
Definition: comp_list.h:67
struct rohc_list_item trans_table[ROHC_LIST_MAX_ITEM]
Definition: comp_list.h:46
uint8_t oa_repetitions_nr
Definition: comp_list.h:58
Internal ROHC macros and functions for traces.