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  /* packet types for all ROHCv2 profiles (RFC 5225) */
106 #define ROHC_PACKET_CO_COMMON ROHC_PACKET_TCP_CO_COMMON /**< ROHCv2 co_common packet */
107  ROHC_PACKET_CO_REPAIR = 33, /**< ROHCv2 CO-REPAIR packet */
108  ROHC_PACKET_PT_0_CRC3 = 34, /**< ROHCv2 PT-0-CRC3 packet */
109  /* packet types for all non-RTP ROHCv2 profiles (RFC 5225) */
110  ROHC_PACKET_NORTP_PT_0_CRC7 = 35, /**< ROHCv2 PT-0-CRC7 packet (non-RTP) */
111  ROHC_PACKET_NORTP_PT_1_SEQ_ID = 36, /**< ROHCv2 PT-1-SEQ-ID packet (non-RTP) */
112  ROHC_PACKET_NORTP_PT_2_SEQ_ID = 37, /**< ROHCv2 PT-2-SEQ-ID packet (non-RTP) */
113  /* packet types for all RTP ROHCv2 profiles (RFC 5225) */
114  ROHC_PACKET_RTP_PT_0_CRC7 = 38, /**< ROHCv2 PT-0-CRC7 packet (RTP) */
115  ROHC_PACKET_RTP_PT_1_RND = 39, /**< ROHCv2 PT-1-RND packet (RTP) */
116  ROHC_PACKET_RTP_PT_1_SEQ_ID = 40, /**< ROHCv2 PT-1-SEQ-ID packet (RTP) */
117  ROHC_PACKET_RTP_PT_1_SEQ_TS = 41, /**< ROHCv2 PT-1-SEQ-TS packet (RTP) */
118  ROHC_PACKET_RTP_PT_2_RND = 42, /**< ROHCv2 PT-2-RND packet (RTP) */
119  ROHC_PACKET_RTP_PT_2_SEQ_ID = 43, /**< ROHCv2 PT-2-SEQ-ID packet (RTP) */
120  ROHC_PACKET_RTP_PT_2_SEQ_TS = 44, /**< ROHCv2 PT-2-SEQ-TS packet (RTP) */
121  ROHC_PACKET_RTP_PT_2_SEQ_BOTH = 45, /**< ROHCv2 PT-2-SEQ-BOTH packet (RTP) */
122 
123  /* UO-1-ID packet with extensions */
124  ROHC_PACKET_UO_1_ID_EXT0 = 46, /**< ROHC UO-1-ID packet with EXT-0 (RTP profile only) */
125  ROHC_PACKET_UO_1_ID_EXT1 = 47, /**< ROHC UO-1-ID packet with EXT-1 (RTP profile only) */
126  ROHC_PACKET_UO_1_ID_EXT2 = 48, /**< ROHC UO-1-ID packet with EXT-2 (RTP profile only) */
127  ROHC_PACKET_UO_1_ID_EXT3 = 49, /**< ROHC UO-1-ID packet with EXT-3 (RTP profile only) */
128 
129  /* UOR-2 packets with extensions */
130  ROHC_PACKET_UOR_2_EXT0 = 50, /**< ROHC UOR-2 packet with EXT-0 (non-RTP profiles) */
131  ROHC_PACKET_UOR_2_EXT1 = 51, /**< ROHC UOR-2 packet with EXT-1 (non-RTP profiles) */
132  ROHC_PACKET_UOR_2_EXT2 = 52, /**< ROHC UOR-2 packet with EXT-2 (non-RTP profiles) */
133  ROHC_PACKET_UOR_2_EXT3 = 53, /**< ROHC UOR-2 packet with EXT-3 (non-RTP profiles) */
134  ROHC_PACKET_UOR_2_RTP_EXT0 = 54, /**< ROHC UOR-2 packet with EXT-0 (RTP profile only) */
135  ROHC_PACKET_UOR_2_RTP_EXT1 = 55, /**< ROHC UOR-2 packet with EXT-1 (RTP profile only) */
136  ROHC_PACKET_UOR_2_RTP_EXT2 = 56, /**< ROHC UOR-2 packet with EXT-2 (RTP profile only) */
137  ROHC_PACKET_UOR_2_RTP_EXT3 = 57, /**< ROHC UOR-2 packet with EXT-3 (RTP profile only) */
138  ROHC_PACKET_UOR_2_ID_EXT0 = 58, /**< ROHC UOR-2-ID packet with EXT-0 (RTP profile only) */
139  ROHC_PACKET_UOR_2_ID_EXT1 = 59, /**< ROHC UOR-2-ID packet with EXT-1 (RTP profile only) */
140  ROHC_PACKET_UOR_2_ID_EXT2 = 60, /**< ROHC UOR-2-ID packet with EXT-2 (RTP profile only) */
141  ROHC_PACKET_UOR_2_ID_EXT3 = 61, /**< ROHC UOR-2-ID packet with EXT-3 (RTP profile only) */
142  ROHC_PACKET_UOR_2_TS_EXT0 = 62, /**< ROHC UOR-2-TS packet with EXT-0 (RTP profile only) */
143  ROHC_PACKET_UOR_2_TS_EXT1 = 63, /**< ROHC UOR-2-TS packet with EXT-1 (RTP profile only) */
144  ROHC_PACKET_UOR_2_TS_EXT2 = 64, /**< ROHC UOR-2-TS packet with EXT-2 (RTP profile only) */
145  ROHC_PACKET_UOR_2_TS_EXT3 = 65, /**< ROHC UOR-2-TS packet with EXT-3 (RTP profile only) */
146 
147  ROHC_PACKET_MAX /**< The number of packet types */
148 } rohc_packet_t;
149 
150 
151 /**
152  * @brief The different types of extensions for UO-1-ID and UOR-2* packets
153  *
154  * If you add a new extension type, please also add the corresponding textual
155  * description in \ref rohc_get_ext_descr.
156  */
157 typedef enum
158 {
159  ROHC_EXT_0 = 0, /**< The EXT-0 extension for UO-1-ID/UOR-2* packets */
160  ROHC_EXT_1 = 1, /**< The EXT-1 extension for UO-1-ID/UOR-2* packets */
161  ROHC_EXT_2 = 2, /**< The EXT-2 extension for UO-1-ID/UOR-2* packets */
162  ROHC_EXT_3 = 3, /**< The EXT-3 extension for UO-1-ID/UOR-2* packets */
163  ROHC_EXT_NONE = 4, /**< No extension for UO-1-ID/UOR-2* packets */
164  ROHC_EXT_UNKNOWN = 5, /**< Unknown packet extension type */
165 } rohc_ext_t;
166 
167 
168 /*
169  * Prototypes of public functions
170  */
171 
172 const char * ROHC_EXPORT rohc_get_packet_descr(const rohc_packet_t packet_type)
173  __attribute__((warn_unused_result, const));
174 
175 const char * ROHC_EXPORT rohc_get_ext_descr(const rohc_ext_t ext_type)
176  __attribute__((warn_unused_result, const));
177 
178 rohc_packet_t ROHC_EXPORT rohc_get_packet_type(const char *const packet_id)
179  __attribute__((warn_unused_result, nonnull(1)));
180 
181 bool ROHC_EXPORT rohc_packet_is_ir(const rohc_packet_t packet_type)
182  __attribute__((warn_unused_result, const));
183 
185  __attribute__((warn_unused_result, const));
186 
188  __attribute__((warn_unused_result, const));
189 
190 #undef ROHC_EXPORT /* do not pollute outside this header */
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif /* ROHC_PACKETS_H */
197 
Definition: rohc_packets.h:114
Definition: rohc_packets.h:126
Definition: rohc_packets.h:59
Definition: rohc_packets.h:127
Definition: rohc_packets.h:161
Definition: rohc_packets.h:74
Definition: rohc_packets.h:93
Definition: rohc_packets.h:116
Definition: rohc_packets.h:111
Definition: rohc_packets.h:118
Definition: rohc_packets.h:132
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:518
Definition: rohc_packets.h:135
Definition: rohc_packets.h:65
Definition: rohc_packets.h:92
Definition: rohc_packets.h:137
Definition: rohc_packets.h:160
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:246
Definition: rohc_packets.h:86
Definition: rohc_packets.h:124
Definition: rohc_packets.h:120
Definition: rohc_packets.h:164
Definition: rohc_packets.h:130
#define ROHC_EXPORT
Definition: rohc_packets.h:44
Definition: rohc_packets.h:159
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:546
rohc_ext_t
The different types of extensions for UO-1-ID and UOR-2* packets.
Definition: rohc_packets.h:157
Definition: rohc_packets.h:103
Definition: rohc_packets.h:94
Definition: rohc_packets.h:91
Definition: rohc_packets.h:67
Definition: rohc_packets.h:139
Definition: rohc_packets.h:131
Definition: rohc_packets.h:107
Definition: rohc_packets.h:100
Definition: rohc_packets.h:66
Definition: rohc_packets.h:117
Definition: rohc_packets.h:163
Definition: rohc_packets.h:68
Definition: rohc_packets.h:145
bool nonnull(1)))
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:143
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:533
Definition: rohc_packets.h:140
Definition: rohc_packets.h:144
Definition: rohc_packets.h:85
Definition: rohc_packets.h:133
Definition: rohc_packets.h:62
Definition: rohc_packets.h:134
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:217
Definition: rohc_packets.h:84
Definition: rohc_packets.h:142
Definition: rohc_packets.h:89
Definition: rohc_packets.h:162
Definition: rohc_packets.h:96
Definition: rohc_packets.h:138
Definition: rohc_packets.h:87
Definition: rohc_packets.h:125
Definition: rohc_packets.h:121
Definition: rohc_packets.h:58
Definition: rohc_packets.h:141
Definition: rohc_packets.h:79
Definition: rohc_packets.h:147
Definition: rohc_packets.h:81
Definition: rohc_packets.h:112
rohc_packet_t
The different types of ROHC packets.
Definition: rohc_packets.h:55
Definition: rohc_packets.h:119
Definition: rohc_packets.h:110
Definition: rohc_packets.h:108
Definition: rohc_packets.h:136
Definition: rohc_packets.h:95
Definition: rohc_packets.h:115
Definition: rohc_packets.h:72