FreeCalypso > hg > themwi-interim
comparison include/mncc.h @ 1:b161dbfffdaa
include, libutil: port from old ThemWi
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 08 Jun 2024 23:06:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:214716b13c61 | 1:b161dbfffdaa |
---|---|
1 /* | |
2 * This header file defines the MNCC interface for passing call control | |
3 * into and out of Osmocom GSM network. It has been put together by | |
4 * assembling bits from several different Osmocom header files. | |
5 */ | |
6 | |
7 #ifndef __MNCC_H | |
8 #define __MNCC_H | |
9 | |
10 #define GSM_MAX_FACILITY 128 | |
11 #define GSM_MAX_SSVERSION 128 | |
12 #define GSM_MAX_USERUSER 128 | |
13 | |
14 /* GSM 04.08 Bearer Capability: Information Transfer Capability */ | |
15 enum gsm48_bcap_itcap { | |
16 GSM48_BCAP_ITCAP_SPEECH = 0, | |
17 GSM48_BCAP_ITCAP_UNR_DIG_INF = 1, | |
18 GSM48_BCAP_ITCAP_3k1_AUDIO = 2, | |
19 GSM48_BCAP_ITCAP_FAX_G3 = 3, | |
20 GSM48_BCAP_ITCAP_OTHER = 5, | |
21 GSM48_BCAP_ITCAP_RESERVED = 7, | |
22 }; | |
23 | |
24 /* GSM 04.08 Bearer Capability: Transfer Mode */ | |
25 enum gsm48_bcap_tmod { | |
26 GSM48_BCAP_TMOD_CIRCUIT = 0, | |
27 GSM48_BCAP_TMOD_PACKET = 1, | |
28 }; | |
29 | |
30 /* GSM 04.08 Bearer Capability: Coding Standard */ | |
31 enum gsm48_bcap_coding { | |
32 GSM48_BCAP_CODING_GSM_STD = 0, | |
33 }; | |
34 | |
35 /* GSM 04.08 Bearer Capability: Radio Channel Requirements */ | |
36 enum gsm48_bcap_rrq { | |
37 GSM48_BCAP_RRQ_FR_ONLY = 1, | |
38 GSM48_BCAP_RRQ_DUAL_HR = 2, | |
39 GSM48_BCAP_RRQ_DUAL_FR = 3, | |
40 }; | |
41 | |
42 /* GSM 04.08 Bearer Capability: Rate Adaption */ | |
43 enum gsm48_bcap_ra { | |
44 GSM48_BCAP_RA_NONE = 0, | |
45 GSM48_BCAP_RA_V110_X30 = 1, | |
46 GSM48_BCAP_RA_X31 = 2, | |
47 GSM48_BCAP_RA_OTHER = 3, | |
48 }; | |
49 | |
50 /* GSM 04.08 Bearer Capability: Signalling access protocol */ | |
51 enum gsm48_bcap_sig_access { | |
52 GSM48_BCAP_SA_I440_I450 = 1, | |
53 GSM48_BCAP_SA_X21 = 2, | |
54 GSM48_BCAP_SA_X28_DP_IN = 3, | |
55 GSM48_BCAP_SA_X28_DP_UN = 4, | |
56 GSM48_BCAP_SA_X28_NDP = 5, | |
57 GSM48_BCAP_SA_X32 = 6, | |
58 }; | |
59 | |
60 /* GSM 04.08 Bearer Capability: User Rate */ | |
61 enum gsm48_bcap_user_rate { | |
62 GSM48_BCAP_UR_300 = 1, | |
63 GSM48_BCAP_UR_1200 = 2, | |
64 GSM48_BCAP_UR_2400 = 3, | |
65 GSM48_BCAP_UR_4800 = 4, | |
66 GSM48_BCAP_UR_9600 = 5, | |
67 GSM48_BCAP_UR_12000 = 6, | |
68 GSM48_BCAP_UR_1200_75 = 7, | |
69 }; | |
70 | |
71 /* GSM 04.08 Bearer Capability: Parity */ | |
72 enum gsm48_bcap_parity { | |
73 GSM48_BCAP_PAR_ODD = 0, | |
74 GSM48_BCAP_PAR_EVEN = 2, | |
75 GSM48_BCAP_PAR_NONE = 3, | |
76 GSM48_BCAP_PAR_ZERO = 4, | |
77 GSM48_BCAP_PAR_ONE = 5, | |
78 }; | |
79 | |
80 /* GSM 04.08 Bearer Capability: Intermediate Rate */ | |
81 enum gsm48_bcap_interm_rate { | |
82 GSM48_BCAP_IR_8k = 2, | |
83 GSM48_BCAP_IR_16k = 3, | |
84 }; | |
85 | |
86 /* GSM 04.08 Bearer Capability: Transparency */ | |
87 enum gsm48_bcap_transp { | |
88 GSM48_BCAP_TR_TRANSP = 0, | |
89 GSM48_BCAP_TR_RLP = 1, | |
90 GSM48_BCAP_TR_TR_PREF = 2, | |
91 GSM48_BCAP_TR_RLP_PREF = 3, | |
92 }; | |
93 | |
94 /* GSM 04.08 Bearer Capability: Modem Type */ | |
95 enum gsm48_bcap_modem_type { | |
96 GSM48_BCAP_MT_NONE = 0, | |
97 GSM48_BCAP_MT_V21 = 1, | |
98 GSM48_BCAP_MT_V22 = 2, | |
99 GSM48_BCAP_MT_V22bis = 3, | |
100 GSM48_BCAP_MT_V23 = 4, | |
101 GSM48_BCAP_MT_V26ter = 5, | |
102 GSM48_BCAP_MT_V32 = 6, | |
103 GSM48_BCAP_MT_UNDEF = 7, | |
104 GSM48_BCAP_MT_AUTO_1 = 8, | |
105 }; | |
106 | |
107 /*! GSM 04.08 Bearer Capability: Speech Version Indication | |
108 * (See also 3GPP TS 24.008, Table 10.5.103) */ | |
109 enum gsm48_bcap_speech_ver { | |
110 GSM48_BCAP_SV_FR = 0, /*!< GSM FR V1 (GSM FR) */ | |
111 GSM48_BCAP_SV_HR = 1, /*!< GSM HR V1 (GSM HR) */ | |
112 GSM48_BCAP_SV_EFR = 2, /*!< GSM FR V2 (GSM EFR) */ | |
113 GSM48_BCAP_SV_AMR_F = 4, /*!< GSM FR V3 (FR AMR) */ | |
114 GSM48_BCAP_SV_AMR_H = 5, /*!< GSM HR V3 (HR_AMR) */ | |
115 GSM48_BCAP_SV_AMR_OFW = 6, /*!< GSM FR V4 (OFR AMR-WB) */ | |
116 GSM48_BCAP_SV_AMR_OHW = 7, /*!< GSM HR V4 (OHR AMR-WB) */ | |
117 GSM48_BCAP_SV_AMR_FW = 8, /*!< GSM FR V5 (FR AMR-WB) */ | |
118 GSM48_BCAP_SV_AMR_OH = 11, /*!< GSM HR V6 (OHR AMR) */ | |
119 }; | |
120 | |
121 /* Expanded fields from GSM TS 04.08, Table 10.5.102 */ | |
122 struct gsm_mncc_bearer_cap { | |
123 int transfer; /* Information Transfer Capability, see enum gsm48_bcap_itcap. */ | |
124 int mode; /* Transfer Mode, see enum gsm48_bcap_tmod. */ | |
125 int coding; /* Coding Standard, see enum gsm48_bcap_coding.*/ | |
126 int radio; /* Radio Channel Requirement, see enum gsm48_bcap_rrq. */ | |
127 int speech_ctm; /* CTM text telephony indication */ | |
128 int speech_ver[8]; /* Speech version indication, see enum gsm48_bcap_speech_ver; -1 marks end */ | |
129 struct { | |
130 enum gsm48_bcap_ra rate_adaption; | |
131 enum gsm48_bcap_sig_access sig_access; | |
132 int async; | |
133 int nr_stop_bits; | |
134 int nr_data_bits; | |
135 enum gsm48_bcap_user_rate user_rate; | |
136 enum gsm48_bcap_parity parity; | |
137 enum gsm48_bcap_interm_rate interm_rate; | |
138 enum gsm48_bcap_transp transp; | |
139 enum gsm48_bcap_modem_type modem_type; | |
140 } data; | |
141 }; | |
142 | |
143 struct gsm_mncc_number { | |
144 int type; | |
145 int plan; | |
146 int present; | |
147 int screen; | |
148 char number[33]; | |
149 }; | |
150 | |
151 struct gsm_mncc_cause { | |
152 int location; | |
153 int coding; | |
154 int rec; | |
155 int rec_val; | |
156 int value; | |
157 int diag_len; | |
158 char diag[32]; | |
159 }; | |
160 | |
161 struct gsm_mncc_useruser { | |
162 int proto; | |
163 char info[GSM_MAX_USERUSER + 1]; /* + termination char */ | |
164 }; | |
165 | |
166 struct gsm_mncc_progress { | |
167 int coding; | |
168 int location; | |
169 int descr; | |
170 }; | |
171 | |
172 struct gsm_mncc_facility { | |
173 int len; | |
174 char info[GSM_MAX_FACILITY]; | |
175 }; | |
176 | |
177 struct gsm_mncc_ssversion { | |
178 int len; | |
179 char info[GSM_MAX_SSVERSION]; | |
180 }; | |
181 | |
182 struct gsm_mncc_cccap { | |
183 int dtmf; | |
184 int pcp; | |
185 }; | |
186 | |
187 #define MNCC_SETUP_REQ 0x0101 | |
188 #define MNCC_SETUP_IND 0x0102 | |
189 #define MNCC_SETUP_RSP 0x0103 | |
190 #define MNCC_SETUP_CNF 0x0104 | |
191 #define MNCC_SETUP_COMPL_REQ 0x0105 | |
192 #define MNCC_SETUP_COMPL_IND 0x0106 | |
193 /* MNCC_REJ_* is performed via MNCC_REL_* */ | |
194 #define MNCC_CALL_CONF_IND 0x0107 | |
195 #define MNCC_CALL_PROC_REQ 0x0108 | |
196 #define MNCC_PROGRESS_REQ 0x0109 | |
197 #define MNCC_ALERT_REQ 0x010a | |
198 #define MNCC_ALERT_IND 0x010b | |
199 #define MNCC_NOTIFY_REQ 0x010c | |
200 #define MNCC_NOTIFY_IND 0x010d | |
201 #define MNCC_DISC_REQ 0x010e | |
202 #define MNCC_DISC_IND 0x010f | |
203 #define MNCC_REL_REQ 0x0110 | |
204 #define MNCC_REL_IND 0x0111 | |
205 #define MNCC_REL_CNF 0x0112 | |
206 #define MNCC_FACILITY_REQ 0x0113 | |
207 #define MNCC_FACILITY_IND 0x0114 | |
208 #define MNCC_START_DTMF_IND 0x0115 | |
209 #define MNCC_START_DTMF_RSP 0x0116 | |
210 #define MNCC_START_DTMF_REJ 0x0117 | |
211 #define MNCC_STOP_DTMF_IND 0x0118 | |
212 #define MNCC_STOP_DTMF_RSP 0x0119 | |
213 #define MNCC_MODIFY_REQ 0x011a | |
214 #define MNCC_MODIFY_IND 0x011b | |
215 #define MNCC_MODIFY_RSP 0x011c | |
216 #define MNCC_MODIFY_CNF 0x011d | |
217 #define MNCC_MODIFY_REJ 0x011e | |
218 #define MNCC_HOLD_IND 0x011f | |
219 #define MNCC_HOLD_CNF 0x0120 | |
220 #define MNCC_HOLD_REJ 0x0121 | |
221 #define MNCC_RETRIEVE_IND 0x0122 | |
222 #define MNCC_RETRIEVE_CNF 0x0123 | |
223 #define MNCC_RETRIEVE_REJ 0x0124 | |
224 #define MNCC_USERINFO_REQ 0x0125 | |
225 #define MNCC_USERINFO_IND 0x0126 | |
226 #define MNCC_REJ_REQ 0x0127 | |
227 #define MNCC_REJ_IND 0x0128 | |
228 | |
229 #define MNCC_BRIDGE 0x0200 | |
230 #define MNCC_FRAME_RECV 0x0201 | |
231 #define MNCC_FRAME_DROP 0x0202 | |
232 #define MNCC_LCHAN_MODIFY 0x0203 | |
233 #define MNCC_RTP_CREATE 0x0204 | |
234 #define MNCC_RTP_CONNECT 0x0205 | |
235 #define MNCC_RTP_FREE 0x0206 | |
236 | |
237 #define GSM_TCHF_FRAME 0x0300 | |
238 #define GSM_TCHF_FRAME_EFR 0x0301 | |
239 #define GSM_TCHH_FRAME 0x0302 | |
240 #define GSM_TCH_FRAME_AMR 0x0303 | |
241 #define GSM_BAD_FRAME 0x03ff | |
242 | |
243 #define MNCC_SOCKET_HELLO 0x0400 | |
244 | |
245 #define MNCC_F_BEARER_CAP 0x0001 | |
246 #define MNCC_F_CALLED 0x0002 | |
247 #define MNCC_F_CALLING 0x0004 | |
248 #define MNCC_F_REDIRECTING 0x0008 | |
249 #define MNCC_F_CONNECTED 0x0010 | |
250 #define MNCC_F_CAUSE 0x0020 | |
251 #define MNCC_F_USERUSER 0x0040 | |
252 #define MNCC_F_PROGRESS 0x0080 | |
253 #define MNCC_F_EMERGENCY 0x0100 | |
254 #define MNCC_F_FACILITY 0x0200 | |
255 #define MNCC_F_SSVERSION 0x0400 | |
256 #define MNCC_F_CCCAP 0x0800 | |
257 #define MNCC_F_KEYPAD 0x1000 | |
258 #define MNCC_F_SIGNAL 0x2000 | |
259 #define MNCC_F_GCR 0x4000 | |
260 | |
261 struct gsm_mncc { | |
262 /* context based information */ | |
263 uint32_t msg_type; | |
264 uint32_t callref; | |
265 | |
266 /* which fields are present */ | |
267 uint32_t fields; | |
268 | |
269 /* data derived information (MNCC_F_ based) */ | |
270 struct gsm_mncc_bearer_cap bearer_cap; | |
271 struct gsm_mncc_number called; | |
272 struct gsm_mncc_number calling; | |
273 struct gsm_mncc_number redirecting; | |
274 struct gsm_mncc_number connected; | |
275 struct gsm_mncc_cause cause; | |
276 struct gsm_mncc_progress progress; | |
277 struct gsm_mncc_useruser useruser; | |
278 struct gsm_mncc_facility facility; | |
279 struct gsm_mncc_cccap cccap; | |
280 struct gsm_mncc_ssversion ssversion; | |
281 struct { | |
282 int sup; | |
283 int inv; | |
284 } clir; | |
285 int signal; | |
286 | |
287 /* data derived information, not MNCC_F based */ | |
288 int keypad; | |
289 int more; | |
290 int notify; /* 0..127 */ | |
291 int emergency; | |
292 char imsi[16]; | |
293 | |
294 unsigned char lchan_type; | |
295 unsigned char lchan_mode; | |
296 | |
297 /* Global Call Reference (encoded as per 3GPP TS 29.205) */ | |
298 uint8_t gcr[16]; | |
299 | |
300 /* A buffer to contain SDP ('\0' terminated) */ | |
301 char sdp[1024]; | |
302 }; | |
303 | |
304 struct gsm_data_frame { | |
305 uint32_t msg_type; | |
306 uint32_t callref; | |
307 unsigned char data[0]; | |
308 }; | |
309 | |
310 #define MNCC_SOCK_VERSION 8 | |
311 struct gsm_mncc_hello { | |
312 uint32_t msg_type; | |
313 uint32_t version; | |
314 | |
315 /* send the sizes of the structs */ | |
316 uint32_t mncc_size; | |
317 uint32_t data_frame_size; | |
318 | |
319 /* send some offsets */ | |
320 uint32_t called_offset; | |
321 uint32_t signal_offset; | |
322 uint32_t emergency_offset; | |
323 uint32_t lchan_type_offset; | |
324 }; | |
325 | |
326 struct gsm_mncc_rtp { | |
327 uint32_t msg_type; | |
328 uint32_t callref; | |
329 struct sockaddr_storage addr; | |
330 uint32_t payload_type; | |
331 uint32_t payload_msg_type; | |
332 char sdp[1024]; | |
333 }; | |
334 | |
335 struct gsm_mncc_bridge { | |
336 uint32_t msg_type; | |
337 uint32_t callref[2]; | |
338 }; | |
339 | |
340 union mncc_msg { | |
341 uint32_t msg_type; | |
342 struct gsm_mncc signal; | |
343 struct gsm_mncc_hello hello; | |
344 struct gsm_data_frame data_frame; | |
345 struct gsm_mncc_rtp rtp; | |
346 struct gsm_mncc_bridge bridge; | |
347 }; | |
348 | |
349 #endif /* include guard */ |