blob: fbf3cab1fff765fef17619522baabf24cac75fd6 [file] [log] [blame]
Harald Welte4bfdfe72009-06-10 23:11:52 +08001/* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface
2 * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */
3
4/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
5 * (C) 2008, 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
6 *
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef _MNCC_H
26#define _MNCC_H
27
28#include <openbsc/linuxlist.h>
29
30/* One end of a call */
31struct gsm_call {
32 struct llist_head entry;
33
34 /* network handle */
35 void *net;
36
37 /* the 'local' transaction */
38 u_int32_t callref;
39 /* the 'remote' transaction */
40 u_int32_t remote_ref;
41};
42
43#define MNCC_SETUP_REQ 0x0101
44#define MNCC_SETUP_IND 0x0102
45#define MNCC_SETUP_RSP 0x0103
46#define MNCC_SETUP_CNF 0x0104
47#define MNCC_SETUP_COMPL_REQ 0x0105
48#define MNCC_SETUP_COMPL_IND 0x0106
49/* MNCC_REJ_* is perfomed via MNCC_REL_* */
50#define MNCC_CALL_CONF_IND 0x0107
51#define MNCC_CALL_PROC_REQ 0x0108
52#define MNCC_PROGRESS_REQ 0x0109
53#define MNCC_ALERT_REQ 0x010a
54#define MNCC_ALERT_IND 0x010b
55#define MNCC_NOTIFY_REQ 0x010c
56#define MNCC_NOTIFY_IND 0x010d
57#define MNCC_DISC_REQ 0x010e
58#define MNCC_DISC_IND 0x010f
59#define MNCC_REL_REQ 0x0110
60#define MNCC_REL_IND 0x0111
61#define MNCC_REL_CNF 0x0112
62#define MNCC_FACILITY_REQ 0x0113
63#define MNCC_FACILITY_IND 0x0114
64#define MNCC_START_DTMF_IND 0x0115
65#define MNCC_START_DTMF_RSP 0x0116
66#define MNCC_START_DTMF_REJ 0x0117
67#define MNCC_STOP_DTMF_IND 0x0118
68#define MNCC_STOP_DTMF_RSP 0x0119
69#define MNCC_MODIFY_REQ 0x011a
70#define MNCC_MODIFY_IND 0x011b
71#define MNCC_MODIFY_RSP 0x011c
72#define MNCC_MODIFY_CNF 0x011d
73#define MNCC_MODIFY_REJ 0x011e
74#define MNCC_HOLD_IND 0x011f
75#define MNCC_HOLD_CNF 0x0120
76#define MNCC_HOLD_REJ 0x0121
77#define MNCC_RETRIEVE_IND 0x0122
78#define MNCC_RETRIEVE_CNF 0x0123
79#define MNCC_RETRIEVE_REJ 0x0124
80#define MNCC_USERINFO_REQ 0x0125
81#define MNCC_USERINFO_IND 0x0126
82#define MNCC_REJ_REQ 0x0127
83#define MNCC_REJ_IND 0x0128
84
85#define MNCC_BRIDGE 0x0200
86#define MNCC_FRAME_RECV 0x0201
87#define MNCC_FRAME_DROP 0x0202
88#define MNCC_LCHAN_MODIFY 0x0203
89
Harald Welteda7ab742009-12-19 22:23:05 +010090#define GSM_TCHF_FRAME 0x0300
Harald Welteaca8f152009-12-19 23:06:41 +010091#define GSM_TCHF_FRAME_EFR 0x0301
Harald Welte4bfdfe72009-06-10 23:11:52 +080092
93#define GSM_MAX_FACILITY 128
94#define GSM_MAX_SSVERSION 128
95#define GSM_MAX_USERUSER 128
96
97#define MNCC_F_BEARER_CAP 0x0001
98#define MNCC_F_CALLED 0x0002
99#define MNCC_F_CALLING 0x0004
100#define MNCC_F_REDIRECTING 0x0008
101#define MNCC_F_CONNECTED 0x0010
102#define MNCC_F_CAUSE 0x0020
103#define MNCC_F_USERUSER 0x0040
104#define MNCC_F_PROGRESS 0x0080
105#define MNCC_F_EMERGENCY 0x0100
106#define MNCC_F_FACILITY 0x0200
107#define MNCC_F_SSVERSION 0x0400
108#define MNCC_F_CCCAP 0x0800
109#define MNCC_F_KEYPAD 0x1000
110#define MNCC_F_SIGNAL 0x2000
111
Harald Welte16f3b842009-07-29 11:39:02 +0200112/* Expanded fields from GSM TS 04.08, Table 10.5.102 */
Harald Welte4bfdfe72009-06-10 23:11:52 +0800113struct gsm_mncc_bearer_cap {
Harald Welte16f3b842009-07-29 11:39:02 +0200114 int transfer; /* Information Transfer Capability */
115 int mode; /* Transfer Mode */
116 int coding; /* Coding Standard */
117 int radio; /* Radio Channel Requirement */
118 int speech_ctm; /* CTM text telephony indication */
119 int speech_ver[8]; /* Speech version indication */
Harald Welte4bfdfe72009-06-10 23:11:52 +0800120};
121
122struct gsm_mncc_number {
123 int type;
124 int plan;
125 int present;
126 int screen;
127 char number[33];
128};
129
130struct gsm_mncc_cause {
131 int location;
132 int coding;
133 int rec;
134 int rec_val;
135 int value;
136 int diag_len;
137 char diag[32];
138};
139
140struct gsm_mncc_useruser {
141 int proto;
142 char info[GSM_MAX_USERUSER + 1]; /* + termination char */
143};
144
145struct gsm_mncc_progress {
146 int coding;
147 int location;
148 int descr;
149};
150
151struct gsm_mncc_facility {
152 int len;
153 char info[GSM_MAX_FACILITY];
154};
155
156struct gsm_mncc_ssversion {
157 int len;
158 char info[GSM_MAX_SSVERSION];
159};
160
161struct gsm_mncc_cccap {
162 int dtmf;
163 int pcp;
164};
165
Harald Welte09b7e7f2009-12-12 21:36:53 +0100166enum {
167 GSM_MNCC_BCAP_SPEECH = 0,
168 GSM_MNCC_BCAP_UNR_DIG = 1,
169 GSM_MNCC_BCAP_AUDIO = 2,
170 GSM_MNCC_BCAP_FAX_G3 = 3,
171 GSM_MNCC_BCAP_OTHER_ITC = 5,
172 GSM_MNCC_BCAP_RESERVED = 7,
173};
Harald Welte4bfdfe72009-06-10 23:11:52 +0800174
175struct gsm_mncc {
176 /* context based information */
177 u_int32_t msg_type;
178 u_int32_t callref;
179
180 /* which fields are present */
181 u_int32_t fields;
182
183 /* data derived informations (MNCC_F_ based) */
184 struct gsm_mncc_bearer_cap bearer_cap;
185 struct gsm_mncc_number called;
186 struct gsm_mncc_number calling;
187 struct gsm_mncc_number redirecting;
188 struct gsm_mncc_number connected;
189 struct gsm_mncc_cause cause;
190 struct gsm_mncc_progress progress;
191 struct gsm_mncc_useruser useruser;
192 struct gsm_mncc_facility facility;
193 struct gsm_mncc_cccap cccap;
194 struct gsm_mncc_ssversion ssversion;
195 struct {
196 int sup;
197 int inv;
198 } clir;
199 int signal;
200
201 /* data derived information, not MNCC_F based */
202 int keypad;
203 int more;
204 int notify; /* 0..127 */
205 int emergency;
Andreas Eversbergc079be42009-06-15 23:22:09 +0200206 char imsi[16];
Harald Welte4bfdfe72009-06-10 23:11:52 +0800207
208 unsigned char lchan_mode;
209};
210
Harald Welteda7ab742009-12-19 22:23:05 +0100211struct gsm_data_frame {
Harald Welte4bfdfe72009-06-10 23:11:52 +0800212 u_int32_t msg_type;
213 u_int32_t callref;
214 unsigned char data[0];
215};
216
217char *get_mncc_name(int value);
218int mncc_recv(struct gsm_network *net, int msg_type, void *arg);
219void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
220
221#endif