1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
#ifndef _settings_h
#define _settings_h
#include <stdbool.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/gsm23003.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/bb/common/sim.h>
struct osmocom_ms;
struct osmobb_apn;
#define MOB_C7_DEFLT_ANY_TIMEOUT 30
/* CC (Call Control) message handling entity */
enum mncc_handler_t {
/* Built-in mobile's MNCC */
MNCC_HANDLER_INTERNAL,
/* External MNCC application via UNIX-socket */
MNCC_HANDLER_EXTERNAL,
/* No call support */
MNCC_HANDLER_DUMMY,
};
/* TCH I/O handler for voice calls */
enum tch_voice_io_handler {
/* No handler, drop frames */
TCH_VOICE_IOH_NONE = 0,
/* libosmo-gapk based handler */
TCH_VOICE_IOH_GAPK,
/* L1 PHY (e.g. Calypso DSP) */
TCH_VOICE_IOH_L1PHY,
/* External MNCC app (via MNCC socket) */
TCH_VOICE_IOH_MNCC_SOCK,
/* Return to sender */
TCH_VOICE_IOH_LOOPBACK,
};
extern const struct value_string tch_voice_io_handler_names[];
static inline const char *tch_voice_io_handler_name(enum tch_voice_io_handler val)
{ return get_value_string(tch_voice_io_handler_names, val); }
/* TCH I/O handler for data calls */
enum tch_data_io_handler {
/* No handler, drop frames */
TCH_DATA_IOH_NONE = 0,
/* UNIX socket */
TCH_DATA_IOH_UNIX_SOCK,
/* Return to sender */
TCH_DATA_IOH_LOOPBACK,
};
extern const struct value_string tch_data_io_handler_names[];
static inline const char *tch_data_io_handler_name(enum tch_data_io_handler val)
{ return get_value_string(tch_data_io_handler_names, val); }
/* TCH I/O format for voice calls */
enum tch_voice_io_format {
/* RFC3551 for FR/EFR, RFC5993 for HR, RFC4867 for AMR */
TCH_VOICE_IOF_RTP,
/* Texas Instruments format, used by Calypso based phones (e.g. Motorola C1xx) */
TCH_VOICE_IOF_TI,
};
extern const struct value_string tch_voice_io_format_names[];
static inline const char *tch_voice_io_format_name(enum tch_voice_io_format val)
{ return get_value_string(tch_voice_io_format_names, val); }
/* TCH I/O format for data calls */
enum tch_data_io_format {
/* Osmocom format, used by trxcon and virtphy */
TCH_DATA_IOF_OSMO,
/* Texas Instruments format, used by Calypso based phones (e.g. Motorola C1xx) */
TCH_DATA_IOF_TI,
};
extern const struct value_string tch_data_io_format_names[];
static inline const char *tch_data_io_format_name(enum tch_data_io_format val)
{ return get_value_string(tch_data_io_format_names, val); }
struct tch_voice_settings {
enum tch_voice_io_handler io_handler;
enum tch_voice_io_format io_format;
char alsa_output_dev[128];
char alsa_input_dev[128];
};
struct tch_data_settings {
enum tch_data_io_handler io_handler;
enum tch_data_io_format io_format;
char unix_socket_path[128];
};
struct test_sim_settings {
char imsi[OSMO_IMSI_BUF_SIZE];
uint32_t tmsi;
uint8_t ki_type;
uint8_t ki[16]; /* 128 bit max */
bool barr;
bool rplmn_valid;
struct osmo_plmn_id rplmn;
uint16_t lac;
bool imsi_attached;
bool always_search_hplmn;
struct {
bool valid;
uint32_t ptmsi; /* invalid tmsi: GSM_RESERVED_TMSI */
uint32_t ptmsi_sig; /* P-TMSI signature, 3 bytes */
struct gprs_ra_id rai;
enum gsm1111_ef_locigprs_rau_status gu_state; /* GU, TS 24.008 */
bool imsi_attached;
} locigprs;
};
enum data_call_type {
DATA_CALL_TYPE_ISDN,
DATA_CALL_TYPE_ANALOG,
};
enum data_call_rate {
DATA_CALL_RATE_V110_300,
DATA_CALL_RATE_V110_1200,
DATA_CALL_RATE_V110_2400,
DATA_CALL_RATE_V110_4800,
DATA_CALL_RATE_V110_9600,
DATA_CALL_RATE_V110_14400,
};
/* Data (CSD) call parameters */
struct data_call_params {
enum data_call_type type;
enum data_call_rate rate;
enum gsm48_bcap_transp transp;
};
struct gsm_settings {
char layer2_socket_path[128];
char sap_socket_path[128];
char mncc_socket_path[128];
/* MNCC handler */
enum mncc_handler_t mncc_handler;
/* TCH settings */
struct tch_voice_settings tch_voice;
struct tch_data_settings tch_data;
/* IMEI */
char imei[GSM23003_IMEI_NUM_DIGITS + 1];
char imeisv[GSM23003_IMEISV_NUM_DIGITS + 1];
char imei_random;
/* network search */
int plmn_mode; /* PLMN_MODE_* */
/* SIM */
int sim_type; /* enum gsm_subscriber_sim_type,
* selects card on power on */
char emergency_imsi[OSMO_IMSI_BUF_SIZE];
/* SMS */
char sms_sca[22];
bool store_sms;
/* test card simulator settings */
struct test_sim_settings test_sim;
/* call related settings */
uint8_t cw; /* set if call-waiting is allowed */
uint8_t auto_answer;
uint8_t clip, clir;
uint8_t half, half_prefer;
/* changing default behavior */
uint8_t alter_tx_power;
uint8_t alter_tx_power_value;
int8_t alter_delay;
uint8_t stick;
uint16_t stick_arfcn;
uint8_t skip_max_per_band;
uint8_t no_lupd;
uint8_t no_neighbour;
/* supported by configuration */
uint8_t cc_dtmf;
uint8_t sms_ptp;
uint8_t a5_1;
uint8_t a5_2;
uint8_t a5_3;
uint8_t a5_4;
uint8_t a5_5;
uint8_t a5_6;
uint8_t a5_7;
uint8_t p_gsm;
uint8_t e_gsm;
uint8_t r_gsm;
uint8_t dcs;
uint8_t gsm_850;
uint8_t pcs;
uint8_t gsm_480;
uint8_t gsm_450;
uint8_t class_900;
uint8_t class_dcs;
uint8_t class_850;
uint8_t class_pcs;
uint8_t class_400;
uint8_t freq_map[128+38];
uint8_t full_v1;
uint8_t full_v2;
uint8_t full_v3;
uint8_t half_v1;
uint8_t half_v3;
uint8_t ch_cap; /* channel capability */
int8_t min_rxlev_dbm; /* min dBm to access */
/* CSD modes */
bool csd_tch_f144;
bool csd_tch_f96;
bool csd_tch_f48;
bool csd_tch_h48;
bool csd_tch_f24;
bool csd_tch_h24;
/* support for ASCI */
bool vgcs; /* support of VGCS */
bool vbs; /* support of VBS */
/* radio */
uint16_t dsc_max;
uint8_t force_rekey;
/* dialing */
struct llist_head abbrev;
/* EDGE / UMTS / CDMA */
uint8_t edge_ms_sup;
uint8_t edge_psk_sup;
uint8_t edge_psk_uplink;
uint8_t class_900_edge;
uint8_t class_dcs_pcs_edge;
uint8_t umts_fdd;
uint8_t umts_tdd;
uint8_t cdma_2000;
uint8_t dtm;
uint8_t class_dtm;
uint8_t dtm_mac;
uint8_t dtm_egprs;
/* Timeout for GSM 03.22 C7 state */
uint8_t any_timeout;
/* ASCI settings */
bool uplink_release_local;
bool asci_allow_any;
/* call parameters */
struct {
struct data_call_params data;
} call_params;
};
struct gsm_settings_abbrev {
struct llist_head list;
char abbrev[4];
char number[32];
char name[32];
};
int gsm_settings_arfcn(struct osmocom_ms *ms);
int gsm_settings_init(struct osmocom_ms *ms);
int gsm_settings_exit(struct osmocom_ms *ms);
char *gsm_check_imei(const char *imei, const char *sv);
int gsm_random_imei(struct gsm_settings *set);
struct gprs_settings {
struct llist_head apn_list;
/* RFC1144 TCP/IP header compression */
struct {
int active;
int passive;
int s01;
} pcomp_rfc1144;
/* V.42vis data compression */
struct {
int active;
int passive;
int p0;
int p1;
int p2;
} dcomp_v42bis;
};
int gprs_settings_init(struct osmocom_ms *ms);
int gprs_settings_fi(struct osmocom_ms *ms);
struct osmobb_apn *ms_find_apn_by_name(struct osmocom_ms *ms, const char *apn_name);
int ms_dispatch_all_apn(struct osmocom_ms *ms, uint32_t event, void *data);
extern char *layer2_socket_path;
#endif /* _settings_h */
|