ROHC compression/decompression library
decomp/schemes/ip_id_offset.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012,2013 Didier Barvaux
3  * Copyright 2007,2009,2010 Viveris Technologies
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 decomp/schemes/ip_id_offset.h
22  * @brief Offset IP-ID decoding
23  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
24  * @author Didier Barvaux <didier@barvaux.org>
25  */
26 
27 #ifndef ROHC_DECOMP_IP_ID_OFFSET_H
28 #define ROHC_DECOMP_IP_ID_OFFSET_H
29 
30 #include "decomp_wlsb.h"
31 
32 #include <stdint.h>
33 #include <stdlib.h>
34 #ifdef __KERNEL__
35 # include <linux/types.h>
36 #else
37 # include <stdbool.h>
38 #endif
39 
40 
41 /* The definition of the Offset IP-ID decoding object is private */
42 struct ip_id_offset_decode;
43 
44 
45 /*
46  * Function prototypes.
47  */
48 
50 
51 void ip_id_offset_free(struct ip_id_offset_decode *const ipid)
52  __attribute__((nonnull(1)));
53 
54 bool ip_id_offset_decode(const struct ip_id_offset_decode *const ipid,
55  const rohc_lsb_ref_t ref_type,
56  const uint16_t m,
57  const size_t k,
58  const uint32_t sn,
59  uint16_t *const decoded)
60  __attribute__((nonnull(1, 6), warn_unused_result));
61 
62 void ip_id_offset_set_ref(struct ip_id_offset_decode *const ipid,
63  const uint16_t id_ref,
64  const uint32_t sn_ref,
65  const bool keep_ref_minus_1)
66  __attribute__((nonnull(1)));
67 
68 #endif
69 
Defines a IP-ID object to help computing the IP-ID value from an IP-ID offset.
Definition: decomp/schemes/ip_id_offset.c:41
void ip_id_offset_set_ref(struct ip_id_offset_decode *const ipid, const uint16_t id_ref, const uint32_t sn_ref, const bool keep_ref_minus_1)
Update the reference values for the IP-ID and the SN.
Definition: decomp/schemes/ip_id_offset.c:143
Window-based Least Significant Bits (W-LSB) decoding.
void ip_id_offset_free(struct ip_id_offset_decode *const ipid)
Destroy a given Offset IP-ID decoding context.
Definition: decomp/schemes/ip_id_offset.c:93
bool ip_id_offset_decode(const struct ip_id_offset_decode *const ipid, const rohc_lsb_ref_t ref_type, const uint16_t m, const size_t k, const uint32_t sn, uint16_t *const decoded)
Decode the given IP-ID offset.
Definition: decomp/schemes/ip_id_offset.c:112
rohc_lsb_ref_t
Definition: decomp_wlsb.h:47
struct ip_id_offset_decode * ip_id_offset_new(void)
Create a new Offset IP-ID decoding context.
Definition: decomp/schemes/ip_id_offset.c:61