blob: 25e90ede090f5f582e0d5fdd08060e400b09beca [file] [log] [blame]
Harald Welte6be350c2011-05-25 13:10:08 +02001#ifndef _GSM_DATA_SHAREDH
2#define _GSM_DATA_SHAREDH
3
Holger Hans Peter Freyther06c9da62011-06-09 21:48:49 +02004#include <regex.h>
Harald Welte6be350c2011-05-25 13:10:08 +02005#include <stdbool.h>
6#include <stdint.h>
7
8#include <osmocom/core/timer.h>
9#include <osmocom/core/bitvec.h>
10#include <osmocom/core/statistics.h>
11#include <osmocom/core/utils.h>
12#include <osmocom/gsm/gsm_utils.h>
13#include <osmocom/gsm/tlv.h>
14#include <osmocom/gsm/rxlev_stat.h>
15#include <osmocom/gsm/sysinfo.h>
16
17#include <osmocom/gsm/protocol/gsm_08_58.h>
Harald Welte3300c012011-06-05 13:31:33 +020018#include <osmocom/gsm/protocol/gsm_12_21.h>
Harald Welte6be350c2011-05-25 13:10:08 +020019
Harald Welte0eae6132011-08-24 13:52:07 +020020#include <osmocom/abis/e1_input.h>
21
Harald Welte6be350c2011-05-25 13:10:08 +020022struct osmo_msc_data;
23struct osmo_bsc_sccp_con;
24struct gsm_sms_queue;
25
26/* RRLP mode of operation */
27enum rrlp_mode {
28 RRLP_MODE_NONE,
29 RRLP_MODE_MS_BASED,
30 RRLP_MODE_MS_PREF,
31 RRLP_MODE_ASS_PREF,
32};
33
34/* Channel Request reason */
35enum gsm_chreq_reason_t {
36 GSM_CHREQ_REASON_EMERG,
37 GSM_CHREQ_REASON_PAG,
38 GSM_CHREQ_REASON_CALL,
39 GSM_CHREQ_REASON_LOCATION_UPD,
40 GSM_CHREQ_REASON_OTHER,
41};
42
43#define TRX_NR_TS 8
44#define TS_MAX_LCHAN 8
45
46#define HARDCODED_ARFCN 123
47#define HARDCODED_TSC 7
48#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */
49
50/* for multi-drop config */
51#define HARDCODED_BTS0_TS 1
52#define HARDCODED_BTS1_TS 6
53#define HARDCODED_BTS2_TS 11
54
55/* reserved according to GSM 03.03 ยง 2.4 */
56#define GSM_RESERVED_TMSI 0xFFFFFFFF
57
58enum gsm_hooks {
59 GSM_HOOK_NM_SWLOAD,
60 GSM_HOOK_RR_PAGING,
61 GSM_HOOK_RR_SECURITY,
62};
63
64enum gsm_paging_event {
65 GSM_PAGING_SUCCEEDED,
66 GSM_PAGING_EXPIRED,
67 GSM_PAGING_OOM,
68 GSM_PAGING_BUSY,
69};
70
71enum bts_gprs_mode {
72 BTS_GPRS_NONE = 0,
73 BTS_GPRS_GPRS = 1,
74 BTS_GPRS_EGPRS = 2,
75};
76
77struct gsm_lchan;
78struct gsm_subscriber;
79struct gsm_mncc;
Harald Welte135a6bd2011-09-04 13:53:26 +020080struct osmo_rtp_socket;
Harald Welte6be350c2011-05-25 13:10:08 +020081struct rtp_socket;
82struct bsc_api;
83
84/* Network Management State */
85struct gsm_nm_state {
86 uint8_t operational;
87 uint8_t administrative;
88 uint8_t availability;
89};
90
Harald Welted64c0bc2011-05-30 12:07:53 +020091struct gsm_abis_mo {
Harald Welte3300c012011-06-05 13:31:33 +020092 uint8_t obj_class;
93 struct abis_om_obj_inst obj_inst;
Harald Welted64c0bc2011-05-30 12:07:53 +020094 const char *name;
95 struct gsm_nm_state nm_state;
96 struct tlv_parsed *nm_attr;
Harald Welte32bc1162011-06-06 18:58:48 +020097 struct gsm_bts *bts;
Harald Welted64c0bc2011-05-30 12:07:53 +020098};
99
Harald Welte6be350c2011-05-25 13:10:08 +0200100#define MAX_A5_KEY_LEN (128/8)
101#define A38_XOR_MIN_KEY_LEN 12
102#define A38_XOR_MAX_KEY_LEN 16
103#define A38_COMP128_KEY_LEN 16
104#define RSL_ENC_ALG_A5(x) (x+1)
105
106/* is the data link established? who established it? */
107#define LCHAN_SAPI_UNUSED 0
108#define LCHAN_SAPI_MS 1
109#define LCHAN_SAPI_NET 2
110
111/* state of a logical channel */
112enum gsm_lchan_state {
113 LCHAN_S_NONE, /* channel is not active */
114 LCHAN_S_ACT_REQ, /* channel activatin requested */
115 LCHAN_S_ACTIVE, /* channel is active and operational */
116 LCHAN_S_REL_REQ, /* channel release has been requested */
117 LCHAN_S_REL_ERR, /* channel is in an error state */
118 LCHAN_S_INACTIVE, /* channel is set inactive */
119};
120
Harald Weltec7921c92011-06-29 10:38:34 +0200121/* BTS ONLY */
122#define MAX_NUM_UL_MEAS 104
123#define LC_UL_M_F_L1_VALID (1 << 0)
124#define LC_UL_M_F_RES_VALID (1 << 1)
125
126struct bts_ul_meas {
127 /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
128 uint16_t ber10k;
129 /* timing advance offset (in quarter bits) */
130 int16_t ta_offs_qbits;
131 /* C/I ratio in dB */
132 float c_i;
133 /* flags */
134 uint8_t is_sub:1;
135 /* RSSI in dBm * -1 */
136 uint8_t inv_rssi;
137};
Harald Weltef3b59322011-09-06 22:14:43 +0200138
139struct amr_mode {
140 uint8_t mode;
141 uint8_t threshold;
142 uint8_t hysteresis;
143};
144struct amr_multirate_conf {
145 uint8_t gsm48_ie[2];
146 struct amr_mode mode[4];
147 uint8_t num_modes;
148};
Harald Weltec7921c92011-06-29 10:38:34 +0200149/* /BTS ONLY */
150
Harald Welte6be350c2011-05-25 13:10:08 +0200151struct gsm_lchan {
152 /* The TS that we're part of */
153 struct gsm_bts_trx_ts *ts;
154 /* The logical subslot number in the TS */
155 uint8_t nr;
156 /* The logical channel type */
157 enum gsm_chan_t type;
158 /* RSL channel mode */
159 enum rsl_cmod_spd rsl_cmode;
160 /* If TCH, traffic channel mode */
161 enum gsm48_chan_mode tch_mode;
162 /* State */
163 enum gsm_lchan_state state;
164 /* Power levels for MS and BTS */
165 uint8_t bs_power;
166 uint8_t ms_power;
167 /* Encryption information */
168 struct {
169 uint8_t alg_id;
170 uint8_t key_len;
171 uint8_t key[MAX_A5_KEY_LEN];
172 } encr;
173
174 /* AMR bits */
175 struct gsm48_multi_rate_conf mr_conf;
176
177 /* Established data link layer services */
178 uint8_t sapis[8];
179 int sach_deact;
180 int release_reason;
181
182 struct {
183 uint32_t bound_ip;
184 uint32_t connect_ip;
185 uint16_t bound_port;
186 uint16_t connect_port;
187 uint16_t conn_id;
188 uint8_t rtp_payload;
189 uint8_t rtp_payload2;
190 uint8_t speech_mode;
Harald Welte135a6bd2011-09-04 13:53:26 +0200191#ifdef ROLE_BSC
Harald Welte6be350c2011-05-25 13:10:08 +0200192 struct rtp_socket *rtp_socket;
Harald Welte135a6bd2011-09-04 13:53:26 +0200193#else
194 struct osmo_rtp_socket *rtp_socket;
195#endif
Harald Welte6be350c2011-05-25 13:10:08 +0200196 } abis_ip;
197
Harald Welte2c1ae472011-06-26 14:13:37 +0200198 uint8_t rqd_ta;
199
Harald Welte6be350c2011-05-25 13:10:08 +0200200#ifdef ROLE_BSC
201 struct osmo_timer_list T3101;
202 struct osmo_timer_list T3111;
203 struct osmo_timer_list error_timer;
Harald Weltee8bd9e82011-08-10 23:26:33 +0200204 struct osmo_timer_list act_timer;
Harald Welte6be350c2011-05-25 13:10:08 +0200205
206 /* table of neighbor cell measurements */
207 struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS];
208
209 /* cache of last measurement reports on this lchan */
210 struct gsm_meas_rep meas_rep[6];
211 int meas_rep_idx;
212
213 /* GSM Random Access data */
214 struct gsm48_req_ref *rqd_ref;
Harald Welte6be350c2011-05-25 13:10:08 +0200215
216 struct gsm_subscriber_connection *conn;
Harald Weltef6093a42011-06-25 10:02:33 +0200217#else
218 struct lapdm_channel lapdm_ch;
Harald Welte135a6bd2011-09-04 13:53:26 +0200219 struct llist_head dl_tch_queue;
Harald Welte2c1ae472011-06-26 14:13:37 +0200220 struct {
221 /* bitmask of all SI that are present/valid in si_buf */
222 uint32_t valid;
223 uint32_t last;
224 /* buffers where we put the pre-computed SI */
225 sysinfo_buf_t buf[_MAX_SYSINFO_TYPE];
226 } si;
Harald Weltec7921c92011-06-29 10:38:34 +0200227 struct {
228 uint8_t flags;
229 /* RSL measurment result number, 0 at lchan_act */
230 uint8_t res_nr;
231 /* current Tx power level of the BTS */
232 uint8_t bts_tx_pwr;
233 /* number of measurements stored in array below */
234 uint8_t num_ul_meas;
235 struct bts_ul_meas uplink[MAX_NUM_UL_MEAS];
236 /* last L1 header from the MS */
237 uint8_t l1_info[2];
238 struct {
239 uint8_t rxlev_full;
240 uint8_t rxlev_sub;
241 uint8_t rxqual_full;
242 uint8_t rxqual_sub;
243 } res;
244 } meas;
Harald Weltef3b59322011-09-06 22:14:43 +0200245 struct {
246 struct amr_multirate_conf amr_mr;
Harald Welte43290992011-09-07 12:41:38 +0200247 struct {
248 uint8_t buf[16];
249 uint8_t len;
250 } last_sid;
Harald Weltef3b59322011-09-06 22:14:43 +0200251 } tch;
Harald Welte6be350c2011-05-25 13:10:08 +0200252#endif
253};
254
Harald Welte6be350c2011-05-25 13:10:08 +0200255#define TS_F_PDCH_MODE 0x1000
256/* One Timeslot in a TRX */
257struct gsm_bts_trx_ts {
258 struct gsm_bts_trx *trx;
259 /* number of this timeslot at the TRX */
260 uint8_t nr;
261
262 enum gsm_phys_chan_config pchan;
263
264 unsigned int flags;
Harald Welted64c0bc2011-05-30 12:07:53 +0200265 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200266 struct tlv_parsed nm_attr;
267 uint8_t nm_chan_comb;
Harald Welte135a6482011-05-30 12:09:13 +0200268 int tsc; /* -1 == use BTS TSC */
Harald Welte6be350c2011-05-25 13:10:08 +0200269
270 struct {
271 /* Parameters below are configured by VTY */
272 int enabled;
273 uint8_t maio;
274 uint8_t hsn;
275 struct bitvec arfcns;
276 uint8_t arfcns_data[1024/8];
277 /* This is the pre-computed MA for channel assignments */
278 struct bitvec ma;
279 uint8_t ma_len; /* part of ma_data that is used */
280 uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */
281 } hopping;
282
283 /* To which E1 subslot are we connected */
284 struct gsm_e1_subslot e1_link;
285
286 struct gsm_lchan lchan[TS_MAX_LCHAN];
287};
288
289/* One TRX in a BTS */
290struct gsm_bts_trx {
291 /* list header in bts->trx_list */
292 struct llist_head list;
293
294 struct gsm_bts *bts;
295 /* number of this TRX in the BTS */
296 uint8_t nr;
297 /* human readable name / description */
298 char *description;
299 /* how do we talk RSL with this TRX? */
300 struct gsm_e1_subslot rsl_e1_link;
301 uint8_t rsl_tei;
302 struct e1inp_sign_link *rsl_link;
303 /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
304 struct e1inp_sign_link *oml_link;
305
Harald Welted64c0bc2011-05-30 12:07:53 +0200306 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200307 struct tlv_parsed nm_attr;
308 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200309 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200310 } bb_transc;
311
312 uint16_t arfcn;
313 int nominal_power; /* in dBm */
314 unsigned int max_power_red; /* in actual dB */
315
Harald Welted134cc72011-06-07 00:12:53 +0200316 struct {
317 void *l1h;
318 } role_bts;
319
Harald Welte6be350c2011-05-25 13:10:08 +0200320 union {
321 struct {
322 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200323 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200324 } bbsig;
325 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200326 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200327 } pa;
328 } bs11;
329 struct {
330 unsigned int test_state;
331 uint8_t test_nr;
332 struct rxlev_stats rxlev_stat;
333 } ipaccess;
334 };
335 struct gsm_bts_trx_ts ts[TRX_NR_TS];
336};
337
338#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i])
339
340enum gsm_bts_type {
341 GSM_BTS_TYPE_UNKNOWN,
342 GSM_BTS_TYPE_BS11,
343 GSM_BTS_TYPE_NANOBTS,
344 GSM_BTS_TYPE_RBS2000,
345 GSM_BTS_TYPE_HSL_FEMTO,
Dieter Spaar16646022011-07-28 00:01:50 +0200346 GSM_BTS_TYPE_NOKIA_SITE,
Harald Welte6be350c2011-05-25 13:10:08 +0200347};
348
349struct vty;
350
351struct gsm_bts_model {
352 struct llist_head list;
353
354 enum gsm_bts_type type;
355 const char *name;
356
357 bool started;
358 int (*start)(struct gsm_network *net);
359 int (*oml_rcvmsg)(struct msgb *msg);
360
Pablo Neira Ayusoed5cacb2011-08-17 22:44:07 +0200361 void (*e1line_bind_ops)(struct e1inp_line *line);
362
Harald Welte6be350c2011-05-25 13:10:08 +0200363 void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts);
364 void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx);
365 void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts);
366
367 struct tlv_definition nm_att_tlvdef;
368
369 struct bitvec features;
370 uint8_t _features_data[128/8];
371};
372
373enum gsm_bts_features {
374 BTS_FEAT_HSCSD,
375 BTS_FEAT_GPRS,
376 BTS_FEAT_EGPRS,
377 BTS_FEAT_ECSD,
378 BTS_FEAT_HOPPING,
379};
380
381/*
382 * This keeps track of the paging status of one BTS. It
383 * includes a number of pending requests, a back pointer
384 * to the gsm_bts, a timer and some more state.
385 */
386struct gsm_bts_paging_state {
387 /* pending requests */
388 struct llist_head pending_requests;
389 struct gsm_bts *bts;
390
391 struct osmo_timer_list work_timer;
392 struct osmo_timer_list credit_timer;
393
394 /* free chans needed */
395 int free_chans_need;
396
397 /* load */
398 uint16_t available_slots;
399};
400
401struct gsm_envabtse {
Harald Welted64c0bc2011-05-30 12:07:53 +0200402 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200403};
404
405struct gsm_bts_gprs_nsvc {
406 struct gsm_bts *bts;
407 /* data read via VTY config file, to configure the BTS
408 * via OML from BSC */
409 int id;
410 uint16_t nsvci;
411 uint16_t local_port; /* on the BTS */
412 uint16_t remote_port; /* on the SGSN */
413 uint32_t remote_ip; /* on the SGSN */
414
Harald Welted64c0bc2011-05-30 12:07:53 +0200415 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200416};
417
418enum neigh_list_manual_mode {
419 NL_MODE_AUTOMATIC = 0,
420 NL_MODE_MANUAL = 1,
421 NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */
422};
423
424/* One BTS */
425struct gsm_bts {
426 /* list header in net->bts_list */
427 struct llist_head list;
428
429 /* number of ths BTS in network */
430 uint8_t nr;
431 /* human readable name / description */
432 char *description;
433 /* Cell Identity */
434 uint16_t cell_identity;
435 /* location area code of this BTS */
436 uint16_t location_area_code;
437 /* Training Sequence Code */
438 uint8_t tsc;
439 /* Base Station Identification Code (BSIC) */
440 uint8_t bsic;
441 /* type of BTS */
442 enum gsm_bts_type type;
443 struct gsm_bts_model *model;
444 enum gsm_band band;
445 /* maximum Tx power that the MS is permitted to use in this cell */
446 int ms_max_power;
447
448 /* how do we talk OML with this TRX? */
449 struct gsm_e1_subslot oml_e1_link;
450 uint8_t oml_tei;
451 struct e1inp_sign_link *oml_link;
452
453 /* Abis network management O&M handle */
454 struct abis_nm_h *nmh;
Harald Welted64c0bc2011-05-30 12:07:53 +0200455
456 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200457
458 /* number of this BTS on given E1 link */
459 uint8_t bts_nr;
460
461 /* paging state and control */
462 struct gsm_bts_paging_state paging;
463
464 /* CCCH is on C0 */
465 struct gsm_bts_trx *c0;
466
467 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200468 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200469 } site_mgr;
470
471 /* bitmask of all SI that are present/valid in si_buf */
472 uint32_t si_valid;
473 /* buffers where we put the pre-computed SI */
474 sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE];
475
Gus Bourg1c5dd2c2011-12-02 10:18:17 +0100476 /* TimeZone hours, mins, and bts specific */
477 int tzhr;
478 int tzmn;
479 int tz_bts_specific;
480
Harald Welte6be350c2011-05-25 13:10:08 +0200481 /* ip.accesss Unit ID's have Site/BTS/TRX layout */
482 union {
483 struct {
484 uint16_t site_id;
485 uint16_t bts_id;
486 uint32_t flags;
487 } ip_access;
488 struct {
489 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200490 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200491 } cclk;
492 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200493 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200494 } rack;
495 struct gsm_envabtse envabtse[4];
496 } bs11;
497 struct {
498 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200499 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200500 struct llist_head conn_groups;
501 } is;
502 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200503 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200504 struct llist_head conn_groups;
505 } con;
506 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200507 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200508 } dp;
509 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200510 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200511 } tf;
512 } rbs2000;
513 struct {
514 unsigned long serno;
515 } hsl;
Harald Weltec8755af2011-07-28 00:22:17 +0200516 struct {
517 uint8_t bts_type;
518 int configured:1,
Sylvain Munautc9519462011-10-17 14:04:55 +0200519 skip_reset:1,
520 did_reset:1,
Harald Weltec8755af2011-07-28 00:22:17 +0200521 wait_reset:1;
522 struct osmo_timer_list reset_timer;
523 } nokia;
Harald Welte6be350c2011-05-25 13:10:08 +0200524 };
525
526 /* Not entirely sure how ip.access specific this is */
527 struct {
528 enum bts_gprs_mode mode;
529 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200530 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200531 uint16_t nsei;
532 uint8_t timer[7];
533 } nse;
534 struct {
Harald Welted64c0bc2011-05-30 12:07:53 +0200535 struct gsm_abis_mo mo;
Harald Welte6be350c2011-05-25 13:10:08 +0200536 uint16_t bvci;
537 uint8_t timer[11];
538 } cell;
539 struct gsm_bts_gprs_nsvc nsvc[2];
540 uint8_t rac;
541 } gprs;
542
543 /* RACH NM values */
544 int rach_b_thresh;
545 int rach_ldavg_slots;
546
547 /* transceivers */
548 int num_trx;
549 struct llist_head trx_list;
550
551#ifdef ROLE_BSC
552 /* Abis NM queue */
553 struct llist_head abis_queue;
554 int abis_nm_pend;
555
556 struct gsm_network *network;
557
558 /* should the channel allocator allocate channels from high TRX to TRX0,
559 * rather than starting from TRX0 and go upwards? */
560 int chan_alloc_reverse;
561
562 enum neigh_list_manual_mode neigh_list_manual_mode;
563 /* parameters from which we build SYSTEM INFORMATION */
564 struct {
565 struct gsm48_rach_control rach_control;
566 uint8_t ncc_permitted;
567 struct gsm48_cell_sel_par cell_sel_par;
568 struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */
569 struct gsm48_cell_options cell_options;
570 struct gsm48_control_channel_descr chan_desc;
571 struct bitvec neigh_list;
572 struct bitvec cell_alloc;
573 struct bitvec si5_neigh_list;
574 struct {
575 /* bitmask large enough for all possible ARFCN's */
576 uint8_t neigh_list[1024/8];
577 uint8_t cell_alloc[1024/8];
578 /* If the user wants a different neighbor list in SI5 than in SI2 */
579 uint8_t si5_neigh_list[1024/8];
580 } data;
581 } si_common;
582
583 /* do we use static (user-defined) system information messages? (bitmask) */
584 uint32_t si_mode_static;
585#endif /* ROLE_BSC */
Harald Welte978714d2011-06-06 18:31:20 +0200586 void *role;
Harald Welte6be350c2011-05-25 13:10:08 +0200587};
588
589
Harald Welte3300c012011-06-05 13:31:33 +0200590struct gsm_bts *gsm_bts_alloc(void *talloc_ctx);
Harald Welte6be350c2011-05-25 13:10:08 +0200591struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
592
Harald Welte4f8ad532011-09-19 14:21:51 +0200593struct gsm_bts_trx *gsm_bts_trx_num(const struct gsm_bts *bts, int num);
Harald Welte6be350c2011-05-25 13:10:08 +0200594
595const char *gsm_pchan_name(enum gsm_phys_chan_config c);
596enum gsm_phys_chan_config gsm_pchan_parse(const char *name);
597const char *gsm_lchant_name(enum gsm_chan_t c);
598const char *gsm_chreq_name(enum gsm_chreq_reason_t c);
Harald Welte4f8ad532011-09-19 14:21:51 +0200599char *gsm_trx_name(const struct gsm_bts_trx *trx);
600char *gsm_ts_name(const struct gsm_bts_trx_ts *ts);
601char *gsm_lchan_name(const struct gsm_lchan *lchan);
Harald Welte6be350c2011-05-25 13:10:08 +0200602const char *gsm_lchans_name(enum gsm_lchan_state s);
603
Harald Welte6be350c2011-05-25 13:10:08 +0200604
Harald Welteb7849982011-06-29 16:49:03 +0200605void gsm_abis_mo_reset(struct gsm_abis_mo *mo);
606
Harald Welte978714d2011-06-06 18:31:20 +0200607struct gsm_abis_mo *
608gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class,
Harald Welte4f8ad532011-09-19 14:21:51 +0200609 const struct abis_om_obj_inst *obj_inst);
Harald Welte978714d2011-06-06 18:31:20 +0200610
611struct gsm_nm_state *
612gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class,
Harald Welte4f8ad532011-09-19 14:21:51 +0200613 const struct abis_om_obj_inst *obj_inst);
Harald Welte978714d2011-06-06 18:31:20 +0200614void *
615gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class,
Harald Welte4f8ad532011-09-19 14:21:51 +0200616 const struct abis_om_obj_inst *obj_inst);
Harald Welte978714d2011-06-06 18:31:20 +0200617
Harald Welteb7849982011-06-29 16:49:03 +0200618/* reset the state of all MO in the BTS */
619void gsm_bts_mo_reset(struct gsm_bts *bts);
620
Harald Weltef6093a42011-06-25 10:02:33 +0200621uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr);
622uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan);
623
Holger Hans Peter Freyther06c9da62011-06-09 21:48:49 +0200624/*
625 * help with parsing regexps
626 */
627int gsm_parse_reg(void *ctx, regex_t *reg, char **str,
628 int argc, const char **argv) __attribute__ ((warn_unused_result));
629
630
631
Harald Welte6be350c2011-05-25 13:10:08 +0200632#endif