ROHC compression/decompression library
rohc_packets.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010,2012,2013,2014,2016 Didier Barvaux
3  * Copyright 2010,2013 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 rohc_packets.h
22  * @brief Definition of ROHC packets and extensions
23  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
24  */
25 
26 #ifndef ROHC_PACKETS_H
27 #define ROHC_PACKETS_H
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
34 #ifdef __KERNEL__
35 # include <linux/types.h>
36 #else
37 # include <stdbool.h>
38 #endif
39 
40 /** Macro that handles DLL export declarations gracefully */
41 #ifdef DLL_EXPORT /* passed by autotools on command line */
42 # define ROHC_EXPORT __declspec(dllexport)
43 #else
44 # define ROHC_EXPORT
45 #endif
46 
47 
48 
49 /**
50  * @brief The different types of ROHC packets
51  *
52  * If you add a new packet type, please also add the corresponding textual
53  * description in \ref rohc_get_packet_descr.
54  */
55 typedef enum
56 {
57  /* IR and IR-DYN packets */
58  ROHC_PACKET_IR = 0, /**< ROHC IR packet */
59  ROHC_PACKET_IR_DYN = 1, /**< ROHC IR-DYN packet */
60 
61  /* UO-0 packets */
62  ROHC_PACKET_UO_0 = 2, /**< ROHC UO-0 packet */
63 
64  /* UO-1 packets */
65  ROHC_PACKET_UO_1 = 3, /**< ROHC UO-1 packet (for all non-RTP profiles) */
66  ROHC_PACKET_UO_1_ID = 4, /**< ROHC UO-1-ID packet (RTP profile only) */
67  ROHC_PACKET_UO_1_TS = 5, /**< ROHC UO-1-TS packet (RTP profile only) */
68  ROHC_PACKET_UO_1_RTP = 6, /**< ROHC UO-1-RTP packet (RTP profile only) */
69 
70  /* UOR-2 packets */
71  ROHC_PACKET_UOR_2 = 7, /**< ROHC UOR-2 packet (for all non-RTP profiles) */
72  ROHC_PACKET_UOR_2_RTP = 8, /**< ROHC UO-2 packet (RTP profile only) */
73  ROHC_PACKET_UOR_2_ID = 9, /**< ROHC UO-2-ID packet (RTP profile only) */
74  ROHC_PACKET_UOR_2_TS = 10, /**< ROHC UO-2-TS packet (RTP profile only) */
75 
76  /* values 11 and 12 were used by CCE packets of the UDP-Lite profile */
77 
78  /* Normal packet (Uncompressed profile only) */
79  ROHC_PACKET_NORMAL = 13, /**< ROHC Normal packet (Uncompressed profile only) */
80 
81  ROHC_PACKET_UNKNOWN = 14, /**< Unknown packet type */
82 
83  /* packets for TCP profile */
84  ROHC_PACKET_TCP_CO_COMMON = 15, /**< TCP co_common packet */
85  ROHC_PACKET_TCP_RND_1 = 16, /**< TCP rnd_1 packet */
86  ROHC_PACKET_TCP_RND_2 = 17, /**< TCP rnd_2 packet */
87  ROHC_PACKET_TCP_RND_3 = 18, /**< TCP rnd_3 packet */
88  ROHC_PACKET_TCP_RND_4 = 19, /**< TCP rnd_4 packet */
89  ROHC_PACKET_TCP_RND_5 = 20, /**< TCP rnd_5 packet */
90  ROHC_PACKET_TCP_RND_6 = 21, /**< TCP rnd_6 packet */
91  ROHC_PACKET_TCP_RND_7 = 22, /**< TCP rnd_7 packet */
92  ROHC_PACKET_TCP_RND_8 = 23, /**< TCP rnd_8 packet */
93  ROHC_PACKET_TCP_SEQ_1 = 24, /**< TCP seq_1 packet */
94  ROHC_PACKET_TCP_SEQ_2 = 25, /**< TCP seq_2 packet */
95  ROHC_PACKET_TCP_SEQ_3 = 26, /**< TCP seq_3 packet */
96  ROHC_PACKET_TCP_SEQ_4 = 27, /**< TCP seq_4 packet */
97  ROHC_PACKET_TCP_SEQ_5 = 28, /**< TCP seq_5 packet */
98  ROHC_PACKET_TCP_SEQ_6 = 29, /**< TCP seq_6 packet */
99  ROHC_PACKET_TCP_SEQ_7 = 30, /**< TCP seq_7 packet */
100  ROHC_PACKET_TCP_SEQ_8 = 31, /**< TCP seq_8 packet */
101 
102  /* Context Replication (CR) */
103  ROHC_PACKET_IR_CR = 32, /**< ROHC IR-CR packet */
104 
105  ROHC_PACKET_MAX /**< The number of packet types */
106 } rohc_packet_t;
107 
108 
109 /**
110  * @brief The different types of extensions for UO-1-ID and UOR-2* packets
111  *
112  * If you add a new extension type, please also add the corresponding textual
113  * description in \ref rohc_get_ext_descr.
114  */
115 typedef enum
116 {
117  ROHC_EXT_0 = 0, /**< The EXT-0 extension for UO-1-ID/UOR-2* packets */
118  ROHC_EXT_1 = 1, /**< The EXT-1 extension for UO-1-ID/UOR-2* packets */
119  ROHC_EXT_2 = 2, /**< The EXT-2 extension for UO-1-ID/UOR-2* packets */
120  ROHC_EXT_3 = 3, /**< The EXT-3 extension for UO-1-ID/UOR-2* packets */
121  ROHC_EXT_NONE = 4, /**< No extension for UO-1-ID/UOR-2* packets */
122  ROHC_EXT_UNKNOWN = 5, /**< Unknown packet extension type */
123 } rohc_ext_t;
124 
125 
126 /*
127  * Prototypes of public functions
128  */
129 
130 const char * ROHC_EXPORT rohc_get_packet_descr(const rohc_packet_t packet_type)
131  __attribute__((warn_unused_result, const));
132 
133 const char * ROHC_EXPORT rohc_get_ext_descr(const rohc_ext_t ext_type)
134  __attribute__((warn_unused_result, const));
135 
136 rohc_packet_t ROHC_EXPORT rohc_get_packet_type(const char *const packet_id)
137  __attribute__((warn_unused_result, nonnull(1)));
138 
139 bool ROHC_EXPORT rohc_packet_is_ir(const rohc_packet_t packet_type)
140  __attribute__((warn_unused_result, const));
141 
142 bool ROHC_EXPORT rohc_packet_carry_static_info(const rohc_packet_t packet_type)
143  __attribute__((warn_unused_result, const));
144 
145 bool ROHC_EXPORT rohc_packet_carry_crc_7_or_8(const rohc_packet_t packet_type)
146  __attribute__((warn_unused_result, const));
147 
148 #undef ROHC_EXPORT /* do not pollute outside this header */
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* ROHC_PACKETS_H */
155 
Definition: rohc_packets.h:59
Definition: rohc_packets.h:119
Definition: rohc_packets.h:74
Definition: rohc_packets.h:93
Definition: rohc_packets.h:71
bool ROHC_EXPORT rohc_packet_is_ir(const rohc_packet_t packet_type)
Is the packet one IR, IR-DYN or IR-CR packet?
Definition: rohc_packets.c:307
Definition: rohc_packets.h:65
Definition: rohc_packets.h:92
Definition: rohc_packets.h:118
Definition: rohc_packets.h:88
Definition: rohc_packets.h:97
rohc_packet_t ROHC_EXPORT rohc_get_packet_type(const char *const packet_id)
Get the packet type from a packet identifier.
Definition: rohc_packets.c:171
Definition: rohc_packets.h:86
Definition: rohc_packets.h:122
#define ROHC_EXPORT
Definition: rohc_packets.h:44
Definition: rohc_packets.h:117
Definition: rohc_packets.h:90
bool ROHC_EXPORT rohc_packet_carry_crc_7_or_8(const rohc_packet_t packet_type)
Does packet type carry 7- or 8-bit CRC?
Definition: rohc_packets.c:335
rohc_ext_t
The different types of extensions for UO-1-ID and UOR-2* packets.
Definition: rohc_packets.h:115
Definition: rohc_packets.h:103
Definition: rohc_packets.h:94
Definition: rohc_packets.h:91
Definition: rohc_packets.h:67
Definition: rohc_packets.h:100
Definition: rohc_packets.h:66
Definition: rohc_packets.h:121
Definition: rohc_packets.h:68
const char *ROHC_EXPORT rohc_get_packet_descr(const rohc_packet_t packet_type)
Give a description for the given type of ROHC packet.
Definition: rohc_packets.c:46
Definition: rohc_packets.h:99
Definition: rohc_packets.h:98
Definition: rohc_packets.h:73
bool ROHC_EXPORT rohc_packet_carry_static_info(const rohc_packet_t packet_type)
Does packet type carry static information?
Definition: rohc_packets.c:322
Definition: rohc_packets.h:85
Definition: rohc_packets.h:62
const char *ROHC_EXPORT rohc_get_ext_descr(const rohc_ext_t ext_type)
Give a description for the given type of ROHC extension.
Definition: rohc_packets.c:142
Definition: rohc_packets.h:84
Definition: rohc_packets.h:89
Definition: rohc_packets.h:120
Definition: rohc_packets.h:96
Definition: rohc_packets.h:87
Definition: rohc_packets.h:58
Definition: rohc_packets.h:79
Definition: rohc_packets.h:105
Definition: rohc_packets.h:81
rohc_packet_t
The different types of ROHC packets.
Definition: rohc_packets.h:55
Definition: rohc_packets.h:95
Definition: rohc_packets.h:72