blob: b3bf27e9ba0cd10377c39373676a78051392d9f7 [file] [log] [blame]
Harald Welte52b1f982008-12-23 20:25:15 +00001/* GSM Network Management messages on the A-bis interface
2 * 3GPP TS 12.21 version 8.0.0 Release 1999 / ETSI TS 100 623 V8.0.0 */
3
Harald Welte4724f992009-01-18 18:01:49 +00004/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
Harald Welte52b1f982008-12-23 20:25:15 +00005 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef _NM_H
24#define _NM_H
25
26#include <sys/types.h>
Harald Weltedfe6c7d2010-02-20 16:24:02 +010027#include <osmocore/tlv.h>
Harald Welte13f52972010-02-20 18:56:00 +010028#include <osmocore/protocol/gsm_12_21.h>
Harald Welte0f255852009-11-12 14:48:42 +010029
Harald Welteb40a38f2009-11-13 11:56:05 +010030struct cell_global_id {
31 u_int16_t mcc;
32 u_int16_t mnc;
33 u_int16_t lac;
34 u_int16_t ci;
35};
36
Harald Welte0f255852009-11-12 14:48:42 +010037/* The BCCH info from an ip.access test, in host byte order
38 * and already parsed... */
39struct ipac_bcch_info {
Harald Welteb40a38f2009-11-13 11:56:05 +010040 struct llist_head list;
41
Harald Welte0f255852009-11-12 14:48:42 +010042 u_int16_t info_type;
43 u_int8_t freq_qual;
44 u_int16_t arfcn;
45 u_int8_t rx_lev;
46 u_int8_t rx_qual;
Harald Welteaff237d2009-11-13 14:41:52 +010047 int16_t freq_err;
Harald Welte0f255852009-11-12 14:48:42 +010048 u_int16_t frame_offset;
49 u_int32_t frame_nr_offset;
50 u_int8_t bsic;
Harald Welteb40a38f2009-11-13 11:56:05 +010051 struct cell_global_id cgi;
Harald Welte0f255852009-11-12 14:48:42 +010052 u_int8_t ba_list_si2[16];
53 u_int8_t ba_list_si2bis[16];
54 u_int8_t ba_list_si2ter[16];
55 u_int8_t ca_list_si1[16];
56};
57
Harald Welte81c9b9c2010-05-31 16:40:40 +020058extern const struct value_string abis_nm_adm_state_names[];
59extern const struct value_string abis_nm_obj_class_names[];
Harald Welte39315c42010-01-10 18:01:52 +010060extern const struct tlv_definition nm_att_tlvdef;
61
Harald Welte52b1f982008-12-23 20:25:15 +000062/* PUBLIC */
63
64struct msgb;
65
66struct abis_nm_cfg {
67 /* callback for unidirectional reports */
68 int (*report_cb)(struct msgb *,
69 struct abis_om_fom_hdr *);
70 /* callback for software activate requests from BTS */
71 int (*sw_act_req)(struct msgb *);
72};
73
Harald Welte8470bf22008-12-25 23:28:35 +000074extern int abis_nm_rcvmsg(struct msgb *msg);
Harald Welte52b1f982008-12-23 20:25:15 +000075
Harald Welte39315c42010-01-10 18:01:52 +010076int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const u_int8_t *buf, int len);
Harald Welte52b1f982008-12-23 20:25:15 +000077int abis_nm_rx(struct msgb *msg);
Harald Welte34a99682009-02-13 02:41:40 +000078int abis_nm_opstart(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0, u_int8_t i1, u_int8_t i2);
79int abis_nm_chg_adm_state(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i0,
Daniel Willmann65f68fa2009-08-10 11:49:36 +020080 u_int8_t i1, u_int8_t i2, enum abis_nm_adm_state adm_state);
Harald Welte52b1f982008-12-23 20:25:15 +000081int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
82 u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot,
83 u_int8_t tei);
84int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx,
85 u_int8_t e1_port, u_int8_t e1_timeslot, u_int8_t e1_subslot);
86int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts,
87 u_int8_t e1_port, u_int8_t e1_timeslot,
88 u_int8_t e1_subslot);
Harald Welte22af0db2009-02-14 15:41:08 +000089int abis_nm_set_bts_attr(struct gsm_bts *bts, u_int8_t *attr, int attr_len);
90int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, u_int8_t *attr, int attr_len);
Harald Welte52b1f982008-12-23 20:25:15 +000091int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, u_int8_t chan_comb);
Harald Welte34a99682009-02-13 02:41:40 +000092int abis_nm_sw_act_req_ack(struct gsm_bts *bts, u_int8_t obj_class, u_int8_t i1,
Harald Welte5c1e4582009-02-15 11:57:29 +000093 u_int8_t i2, u_int8_t i3, int nack, u_int8_t *attr, int att_len);
Harald Welte52b1f982008-12-23 20:25:15 +000094int abis_nm_raw_msg(struct gsm_bts *bts, int len, u_int8_t *msg);
95int abis_nm_event_reports(struct gsm_bts *bts, int on);
96int abis_nm_reset_resource(struct gsm_bts *bts);
Holger Hans Peter Freyther64278ed2010-05-12 23:51:46 +080097int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname,
Harald Welte3ffd1372009-02-01 22:15:49 +000098 u_int8_t win_size, int forced,
99 gsm_cbfn *cbfn, void *cb_data);
100int abis_nm_software_load_status(struct gsm_bts *bts);
Harald Welte5e4d1b32009-02-01 13:36:56 +0000101int abis_nm_software_activate(struct gsm_bts *bts, const char *fname,
102 gsm_cbfn *cbfn, void *cb_data);
Harald Welte47d88ae2009-01-04 12:02:08 +0000103
Harald Welte1989c082009-08-06 17:58:31 +0200104int abis_nm_conn_mdrop_link(struct gsm_bts *bts, u_int8_t e1_port0, u_int8_t ts0,
105 u_int8_t e1_port1, u_int8_t ts1);
106
Harald Weltec7310382009-08-08 00:02:36 +0200107int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
108 u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
109 u_int8_t test_nr, u_int8_t auton_report,
110 u_int8_t *phys_config, u_int16_t phys_config_len);
111
Harald Welte21bd3a52009-08-10 12:21:22 +0200112int abis_nm_chcomb4pchan(enum gsm_phys_chan_config pchan);
113
Harald Welte47d88ae2009-01-04 12:02:08 +0000114/* Siemens / BS-11 specific */
Holger Freyther245c5342009-01-27 19:00:44 +0000115int abis_nm_bs11_reset_resource(struct gsm_bts *bts);
Harald Welte05188ee2009-01-18 11:39:08 +0000116int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin);
117int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
Harald Welte1bc09062009-01-18 14:17:52 +0000118 u_int8_t idx, u_int8_t attr_len, const u_int8_t *attr);
Harald Welte05188ee2009-01-18 11:39:08 +0000119int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
120int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx);
Harald Welte78fc0d42009-02-19 02:50:57 +0000121int abis_nm_bs11_delete_object(struct gsm_bts *bts,
122 enum abis_bs11_objtype type, u_int8_t idx);
Daniel Willmann65f68fa2009-08-10 11:49:36 +0200123int abis_nm_bs11_delete_bport(struct gsm_bts *bts, u_int8_t idx);
Harald Welteb6c92ae2009-02-21 20:15:32 +0000124int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, u_int8_t e1_port,
125 u_int8_t e1_timeslot, u_int8_t e1_subslot, u_int8_t tei);
Harald Welte78fc0d42009-02-19 02:50:57 +0000126int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts);
127int abis_nm_bs11_get_serno(struct gsm_bts *bts);
Harald Welte05188ee2009-01-18 11:39:08 +0000128int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level);
Harald Welte78fc0d42009-02-19 02:50:57 +0000129int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx);
Daniel Willmann493db4e2010-01-07 00:43:11 +0100130int abis_nm_bs11_logon(struct gsm_bts *bts, u_int8_t level, const char *name, int on);
Harald Welte1bc09062009-01-18 14:17:52 +0000131int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on);
Daniel Willmann4b054c82010-01-07 00:46:26 +0100132int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on);
Harald Welte1bc09062009-01-18 14:17:52 +0000133int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password);
Harald Weltee69f5fb2009-04-28 16:31:38 +0000134int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked);
Harald Welteef061952009-05-17 12:43:42 +0000135int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts);
Daniel Willmann7b1dd742010-01-07 00:54:01 +0100136int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value);
Harald Welteef061952009-05-17 12:43:42 +0000137int abis_nm_bs11_get_cclk(struct gsm_bts *bts);
Harald Welte1bc09062009-01-18 14:17:52 +0000138int abis_nm_bs11_get_state(struct gsm_bts *bts);
Harald Welte5e4d1b32009-02-01 13:36:56 +0000139int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
Harald Welte3ffd1372009-02-01 22:15:49 +0000140 u_int8_t win_size, int forced, gsm_cbfn *cbfn);
Harald Welte268bb402009-02-01 19:11:56 +0000141int abis_nm_bs11_set_ext_time(struct gsm_bts *bts);
Daniel Willmann65f68fa2009-08-10 11:49:36 +0200142int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, u_int8_t bport, enum abis_bs11_line_cfg line_cfg);
Harald Welte3ffd1372009-02-01 22:15:49 +0000143int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect);
Harald Welte1fa60c82009-02-09 18:13:26 +0000144int abis_nm_bs11_restart(struct gsm_bts *bts);
Harald Welte52b1f982008-12-23 20:25:15 +0000145
Harald Welte5c1e4582009-02-15 11:57:29 +0000146/* ip.access nanoBTS specific commands */
147int abis_nm_ipaccess_msg(struct gsm_bts *bts, u_int8_t msg_type,
148 u_int8_t obj_class, u_int8_t bts_nr,
149 u_int8_t trx_nr, u_int8_t ts_nr,
150 u_int8_t *attr, int attr_len);
Harald Welte2ef156d2010-01-07 20:39:42 +0100151int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, u_int8_t *attr,
Harald Welte193fefc2009-04-30 15:16:27 +0000152 int attr_len);
Holger Hans Peter Freyther52fd4e42010-05-12 23:34:51 +0800153int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx);
Harald Weltedaef5212009-10-24 10:20:41 +0200154int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, u_int8_t obj_class,
155 u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
156 u_int8_t *attr, u_int8_t attr_len);
Harald Welte746d6092009-10-19 22:11:11 +0200157int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
158 u_int32_t ip, u_int16_t port, u_int8_t stream);
Harald Welte97a282b2010-03-14 15:37:43 +0800159void abis_nm_ipaccess_cgi(u_int8_t *buf, struct gsm_bts *bts);
Harald Welte0f255852009-11-12 14:48:42 +0100160int ipac_parse_bcch_info(struct ipac_bcch_info *binf, u_int8_t *buf);
161const char *ipacc_testres_name(u_int8_t res);
Harald Welte5c1e4582009-02-15 11:57:29 +0000162
Harald Weltee0590df2009-02-15 03:34:15 +0000163/* Functions calling into other code parts */
164enum nm_evt {
165 EVT_STATECHG_OPER,
166 EVT_STATECHG_ADM,
167};
168int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
Holger Hans Peter Freytheraa0db802010-05-13 00:37:48 +0800169 struct gsm_nm_state *old_state, struct gsm_nm_state *new_state,
170 struct abis_om_obj_inst *obj_inst);
Harald Weltee0590df2009-02-15 03:34:15 +0000171
Harald Welte4d87f242009-03-10 19:43:44 +0000172const char *nm_opstate_name(u_int8_t os);
173const char *nm_avail_name(u_int8_t avail);
Sylvain Munaut1f6c11f2010-01-02 16:32:17 +0100174int nm_is_running(struct gsm_nm_state *s);
Harald Welte81c9b9c2010-05-31 16:40:40 +0200175
176int abis_nm_vty_init(void);
177
Harald Welte52b1f982008-12-23 20:25:15 +0000178#endif /* _NM_H */