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  ROHC_PACKET_MAX /**< The number of packet types */
124 } rohc_packet_t;
125 
126 
127 /**
128  * @brief The different types of extensions for UO-1-ID and UOR-2* packets
129  *
130  * If you add a new extension type, please also add the corresponding textual
131  * description in \ref rohc_get_ext_descr.
132  */
133 typedef enum
134 {
135  ROHC_EXT_0 = 0, /**< The EXT-0 extension for UO-1-ID/UOR-2* packets */
136  ROHC_EXT_1 = 1, /**< The EXT-1 extension for UO-1-ID/UOR-2* packets */
137  ROHC_EXT_2 = 2, /**< The EXT-2 extension for UO-1-ID/UOR-2* packets */
138  ROHC_EXT_3 = 3, /**< The EXT-3 extension for UO-1-ID/UOR-2* packets */
139  ROHC_EXT_NONE = 4, /**< No extension for UO-1-ID/UOR-2* packets */
140  ROHC_EXT_UNKNOWN = 5, /**< Unknown packet extension type */
141 } rohc_ext_t;
142 
143 
144 /*
145  * Prototypes of public functions
146  */
147 
148 const char * ROHC_EXPORT rohc_get_packet_descr(const rohc_packet_t packet_type)
149  __attribute__((warn_unused_result, const));
150 
151 const char * ROHC_EXPORT rohc_get_ext_descr(const rohc_ext_t ext_type)
152  __attribute__((warn_unused_result, const));
153 
154 rohc_packet_t ROHC_EXPORT rohc_get_packet_type(const char *const packet_id)
155  __attribute__((warn_unused_result, nonnull(1)));
156 
157 bool ROHC_EXPORT rohc_packet_is_ir(const rohc_packet_t packet_type)
158  __attribute__((warn_unused_result, const));
159 
160 bool ROHC_EXPORT rohc_packet_carry_static_info(const rohc_packet_t packet_type)
161  __attribute__((warn_unused_result, const));
162 
163 bool ROHC_EXPORT rohc_packet_carry_crc_7_or_8(const rohc_packet_t packet_type)
164  __attribute__((warn_unused_result, const));
165 
166 #undef ROHC_EXPORT /* do not pollute outside this header */
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* ROHC_PACKETS_H */
173 
Definition: rohc_packets.h:114
Definition: rohc_packets.h:59
Definition: rohc_packets.h:137
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: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:395
Definition: rohc_packets.h:65
Definition: rohc_packets.h:92
Definition: rohc_packets.h:136
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:203
Definition: rohc_packets.h:86
Definition: rohc_packets.h:120
Definition: rohc_packets.h:140
#define ROHC_EXPORT
Definition: rohc_packets.h:44
Definition: rohc_packets.h:135
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:423
rohc_ext_t
The different types of extensions for UO-1-ID and UOR-2* packets.
Definition: rohc_packets.h:133
Definition: rohc_packets.h:103
Definition: rohc_packets.h:94
Definition: rohc_packets.h:91
Definition: rohc_packets.h:67
Definition: rohc_packets.h:107
Definition: rohc_packets.h:100
Definition: rohc_packets.h:66
Definition: rohc_packets.h:117
Definition: rohc_packets.h:139
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:410
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:174
Definition: rohc_packets.h:84
Definition: rohc_packets.h:89
Definition: rohc_packets.h:138
Definition: rohc_packets.h:96
Definition: rohc_packets.h:87
Definition: rohc_packets.h:121
Definition: rohc_packets.h:58
Definition: rohc_packets.h:79
Definition: rohc_packets.h:123
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:95
Definition: rohc_packets.h:115
Definition: rohc_packets.h:72