blob: 3e00db8a865c707cff7ef4fb0316a9c4b68ac9c2 [file] [log] [blame]
Harald Welte474fd7d2017-12-29 16:01:39 +01001/* This file contains sections copied from
2 * libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h,
3 * libosmocore/include/osmocom/gsm/mncc.h and
4 * openbsc/include/openbsc/mncc.h
5 */
6
7#include <stdint.h>
8
9/* GSM 04.08 Bearer Capability: Rate Adaption */
10enum gsm48_bcap_ra {
11 GSM48_BCAP_RA_NONE = 0,
12 GSM48_BCAP_RA_V110_X30 = 1,
13 GSM48_BCAP_RA_X31 = 2,
14 GSM48_BCAP_RA_OTHER = 3,
15};
16
17/* GSM 04.08 Bearer Capability: Signalling access protocol */
18enum gsm48_bcap_sig_access {
19 GSM48_BCAP_SA_I440_I450 = 1,
20 GSM48_BCAP_SA_X21 = 2,
21 GSM48_BCAP_SA_X28_DP_IN = 3,
22 GSM48_BCAP_SA_X28_DP_UN = 4,
23 GSM48_BCAP_SA_X28_NDP = 5,
24 GSM48_BCAP_SA_X32 = 6,
25};
26
27/* GSM 04.08 Bearer Capability: User Rate */
28enum gsm48_bcap_user_rate {
29 GSM48_BCAP_UR_300 = 1,
30 GSM48_BCAP_UR_1200 = 2,
31 GSM48_BCAP_UR_2400 = 3,
32 GSM48_BCAP_UR_4800 = 4,
33 GSM48_BCAP_UR_9600 = 5,
34 GSM48_BCAP_UR_12000 = 6,
35 GSM48_BCAP_UR_1200_75 = 7,
36};
37
38/* GSM 04.08 Bearer Capability: Parity */
39enum gsm48_bcap_parity {
40 GSM48_BCAP_PAR_ODD = 0,
41 GSM48_BCAP_PAR_EVEN = 2,
42 GSM48_BCAP_PAR_NONE = 3,
43 GSM48_BCAP_PAR_ZERO = 4,
44 GSM48_BCAP_PAR_ONE = 5,
45};
46
47/* GSM 04.08 Bearer Capability: Intermediate Rate */
48enum gsm48_bcap_interm_rate {
49 GSM48_BCAP_IR_8k = 2,
50 GSM48_BCAP_IR_16k = 3,
51};
52
53/* GSM 04.08 Bearer Capability: Transparency */
54enum gsm48_bcap_transp {
55 GSM48_BCAP_TR_TRANSP = 0,
56 GSM48_BCAP_TR_RLP = 1,
57 GSM48_BCAP_TR_TR_PREF = 2,
58 GSM48_BCAP_TR_RLP_PREF = 3,
59};
60
61/* GSM 04.08 Bearer Capability: Modem Type */
62enum gsm48_bcap_modem_type {
63 GSM48_BCAP_MT_NONE = 0,
64 GSM48_BCAP_MT_V21 = 1,
65 GSM48_BCAP_MT_V22 = 2,
66 GSM48_BCAP_MT_V22bis = 3,
67 GSM48_BCAP_MT_V23 = 4,
68 GSM48_BCAP_MT_V26ter = 5,
69 GSM48_BCAP_MT_V32 = 6,
70 GSM48_BCAP_MT_UNDEF = 7,
71 GSM48_BCAP_MT_AUTO_1 = 8,
72};
73
74
75
76#define GSM_MAX_FACILITY 128
77#define GSM_MAX_SSVERSION 128
78#define GSM_MAX_USERUSER 128
79
80/* Expanded fields from GSM TS 04.08, Table 10.5.102 */
81struct gsm_mncc_bearer_cap {
82 int transfer; /* Information Transfer Capability */
83 int mode; /* Transfer Mode */
84 int coding; /* Coding Standard */
85 int radio; /* Radio Channel Requirement */
86 int speech_ctm; /* CTM text telephony indication */
87 int speech_ver[8]; /* Speech version indication */
88 struct {
89 enum gsm48_bcap_ra rate_adaption;
90 enum gsm48_bcap_sig_access sig_access;
91 int async;
92 int nr_stop_bits;
93 int nr_data_bits;
94 enum gsm48_bcap_user_rate user_rate;
95 enum gsm48_bcap_parity parity;
96 enum gsm48_bcap_interm_rate interm_rate;
97 enum gsm48_bcap_transp transp;
98 enum gsm48_bcap_modem_type modem_type;
99 } data;
100};
101
102struct gsm_mncc_number {
103 int type;
104 int plan;
105 int present;
106 int screen;
107 char number[33];
108};
109
110struct gsm_mncc_cause {
111 int location;
112 int coding;
113 int rec;
114 int rec_val;
115 int value;
116 int diag_len;
117 char diag[32];
118};
119
120struct gsm_mncc_useruser {
121 int proto;
122 char info[GSM_MAX_USERUSER + 1]; /* + termination char */
123};
124
125struct gsm_mncc_progress {
126 int coding;
127 int location;
128 int descr;
129};
130
131struct gsm_mncc_facility {
132 int len;
133 char info[GSM_MAX_FACILITY];
134};
135
136struct gsm_mncc_ssversion {
137 int len;
138 char info[GSM_MAX_SSVERSION];
139};
140
141struct gsm_mncc_cccap {
142 int dtmf;
143 int pcp;
144};
145
146enum {
147 GSM_MNCC_BCAP_SPEECH = 0,
148 GSM_MNCC_BCAP_UNR_DIG = 1,
149 GSM_MNCC_BCAP_AUDIO = 2,
150 GSM_MNCC_BCAP_FAX_G3 = 3,
151 GSM_MNCC_BCAP_OTHER_ITC = 5,
152 GSM_MNCC_BCAP_RESERVED = 7,
153};
154
155
156#define MNCC_SETUP_REQ 0x0101
157#define MNCC_SETUP_IND 0x0102
158#define MNCC_SETUP_RSP 0x0103
159#define MNCC_SETUP_CNF 0x0104
160#define MNCC_SETUP_COMPL_REQ 0x0105
161#define MNCC_SETUP_COMPL_IND 0x0106
162/* MNCC_REJ_* is perfomed via MNCC_REL_* */
163#define MNCC_CALL_CONF_IND 0x0107
164#define MNCC_CALL_PROC_REQ 0x0108
165#define MNCC_PROGRESS_REQ 0x0109
166#define MNCC_ALERT_REQ 0x010a
167#define MNCC_ALERT_IND 0x010b
168#define MNCC_NOTIFY_REQ 0x010c
169#define MNCC_NOTIFY_IND 0x010d
170#define MNCC_DISC_REQ 0x010e
171#define MNCC_DISC_IND 0x010f
172#define MNCC_REL_REQ 0x0110
173#define MNCC_REL_IND 0x0111
174#define MNCC_REL_CNF 0x0112
175#define MNCC_FACILITY_REQ 0x0113
176#define MNCC_FACILITY_IND 0x0114
177#define MNCC_START_DTMF_IND 0x0115
178#define MNCC_START_DTMF_RSP 0x0116
179#define MNCC_START_DTMF_REJ 0x0117
180#define MNCC_STOP_DTMF_IND 0x0118
181#define MNCC_STOP_DTMF_RSP 0x0119
182#define MNCC_MODIFY_REQ 0x011a
183#define MNCC_MODIFY_IND 0x011b
184#define MNCC_MODIFY_RSP 0x011c
185#define MNCC_MODIFY_CNF 0x011d
186#define MNCC_MODIFY_REJ 0x011e
187#define MNCC_HOLD_IND 0x011f
188#define MNCC_HOLD_CNF 0x0120
189#define MNCC_HOLD_REJ 0x0121
190#define MNCC_RETRIEVE_IND 0x0122
191#define MNCC_RETRIEVE_CNF 0x0123
192#define MNCC_RETRIEVE_REJ 0x0124
193#define MNCC_USERINFO_REQ 0x0125
194#define MNCC_USERINFO_IND 0x0126
195#define MNCC_REJ_REQ 0x0127
196#define MNCC_REJ_IND 0x0128
197
198#define MNCC_BRIDGE 0x0200
199#define MNCC_FRAME_RECV 0x0201
200#define MNCC_FRAME_DROP 0x0202
201#define MNCC_LCHAN_MODIFY 0x0203
202#define MNCC_RTP_CREATE 0x0204
203#define MNCC_RTP_CONNECT 0x0205
204#define MNCC_RTP_FREE 0x0206
205
206#define GSM_TCHF_FRAME 0x0300
207#define GSM_TCHF_FRAME_EFR 0x0301
208#define GSM_TCHH_FRAME 0x0302
209#define GSM_TCH_FRAME_AMR 0x0303
210#define GSM_BAD_FRAME 0x03ff
211
212#define MNCC_SOCKET_HELLO 0x0400
213
214#define GSM_MAX_FACILITY 128
215#define GSM_MAX_SSVERSION 128
216#define GSM_MAX_USERUSER 128
217
218#define MNCC_F_BEARER_CAP 0x0001
219#define MNCC_F_CALLED 0x0002
220#define MNCC_F_CALLING 0x0004
221#define MNCC_F_REDIRECTING 0x0008
222#define MNCC_F_CONNECTED 0x0010
223#define MNCC_F_CAUSE 0x0020
224#define MNCC_F_USERUSER 0x0040
225#define MNCC_F_PROGRESS 0x0080
226#define MNCC_F_EMERGENCY 0x0100
227#define MNCC_F_FACILITY 0x0200
228#define MNCC_F_SSVERSION 0x0400
229#define MNCC_F_CCCAP 0x0800
230#define MNCC_F_KEYPAD 0x1000
231#define MNCC_F_SIGNAL 0x2000
232
233struct gsm_mncc {
234 /* context based information */
235 uint32_t msg_type;
236 uint32_t callref;
237
238 /* which fields are present */
239 uint32_t fields;
240
241 /* data derived informations (MNCC_F_ based) */
242 struct gsm_mncc_bearer_cap bearer_cap;
243 struct gsm_mncc_number called;
244 struct gsm_mncc_number calling;
245 struct gsm_mncc_number redirecting;
246 struct gsm_mncc_number connected;
247 struct gsm_mncc_cause cause;
248 struct gsm_mncc_progress progress;
249 struct gsm_mncc_useruser useruser;
250 struct gsm_mncc_facility facility;
251 struct gsm_mncc_cccap cccap;
252 struct gsm_mncc_ssversion ssversion;
253 struct {
254 int sup;
255 int inv;
256 } clir;
257 int signal;
258
259 /* data derived information, not MNCC_F based */
260 int keypad;
261 int more;
262 int notify; /* 0..127 */
263 int emergency;
264 char imsi[16];
265
266 unsigned char lchan_type;
267 unsigned char lchan_mode;
268};
269
270struct gsm_data_frame {
271 uint32_t msg_type;
272 uint32_t callref;
273 unsigned char data[0];
274};
275
276#define MNCC_SOCK_VERSION 5
277struct gsm_mncc_hello {
278 uint32_t msg_type;
279 uint32_t version;
280
281 /* send the sizes of the structs */
282 uint32_t mncc_size;
283 uint32_t data_frame_size;
284
285 /* send some offsets */
286 uint32_t called_offset;
287 uint32_t signal_offset;
288 uint32_t emergency_offset;
289 uint32_t lchan_type_offset;
290};
291
292struct gsm_mncc_rtp {
293 uint32_t msg_type;
294 uint32_t callref;
295 uint32_t ip;
296 uint16_t port;
297 uint32_t payload_type;
298 uint32_t payload_msg_type;
299};
300
301struct gsm_mncc_bridge {
302 uint32_t msg_type;
303 uint32_t callref[2];
304};