Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 1 | /* 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 Welte | 4724f99 | 2009-01-18 18:01:49 +0000 | [diff] [blame] | 4 | /* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 5 | * All Rights Reserved |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 8 | * it under the terms of the GNU Affero General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 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 |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 15 | * GNU Affero General Public License for more details. |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 16 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 17 | * You should have received a copy of the GNU Affero General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef _NM_H |
| 23 | #define _NM_H |
| 24 | |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 25 | #include <osmocom/gsm/tlv.h> |
Harald Welte | 472e7e9 | 2011-06-05 11:24:08 +0200 | [diff] [blame] | 26 | #include <osmocom/gsm/abis_nm.h> |
Pablo Neira Ayuso | 136f453 | 2011-03-22 16:47:59 +0100 | [diff] [blame] | 27 | #include <osmocom/gsm/protocol/gsm_12_21.h> |
Harald Welte | 0f25585 | 2009-11-12 14:48:42 +0100 | [diff] [blame] | 28 | |
Harald Welte | b40a38f | 2009-11-13 11:56:05 +0100 | [diff] [blame] | 29 | struct cell_global_id { |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 30 | uint16_t mcc; |
| 31 | uint16_t mnc; |
| 32 | uint16_t lac; |
| 33 | uint16_t ci; |
Harald Welte | b40a38f | 2009-11-13 11:56:05 +0100 | [diff] [blame] | 34 | }; |
| 35 | |
Harald Welte | 0f25585 | 2009-11-12 14:48:42 +0100 | [diff] [blame] | 36 | /* The BCCH info from an ip.access test, in host byte order |
| 37 | * and already parsed... */ |
| 38 | struct ipac_bcch_info { |
Harald Welte | b40a38f | 2009-11-13 11:56:05 +0100 | [diff] [blame] | 39 | struct llist_head list; |
| 40 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 41 | uint16_t info_type; |
| 42 | uint8_t freq_qual; |
| 43 | uint16_t arfcn; |
| 44 | uint8_t rx_lev; |
| 45 | uint8_t rx_qual; |
Harald Welte | aff237d | 2009-11-13 14:41:52 +0100 | [diff] [blame] | 46 | int16_t freq_err; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 47 | uint16_t frame_offset; |
| 48 | uint32_t frame_nr_offset; |
| 49 | uint8_t bsic; |
Harald Welte | b40a38f | 2009-11-13 11:56:05 +0100 | [diff] [blame] | 50 | struct cell_global_id cgi; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 51 | uint8_t ba_list_si2[16]; |
| 52 | uint8_t ba_list_si2bis[16]; |
| 53 | uint8_t ba_list_si2ter[16]; |
| 54 | uint8_t ca_list_si1[16]; |
Harald Welte | 0f25585 | 2009-11-12 14:48:42 +0100 | [diff] [blame] | 55 | }; |
| 56 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 57 | /* PUBLIC */ |
| 58 | |
| 59 | struct msgb; |
| 60 | |
| 61 | struct abis_nm_cfg { |
| 62 | /* callback for unidirectional reports */ |
| 63 | int (*report_cb)(struct msgb *, |
| 64 | struct abis_om_fom_hdr *); |
| 65 | /* callback for software activate requests from BTS */ |
| 66 | int (*sw_act_req)(struct msgb *); |
| 67 | }; |
| 68 | |
Holger Hans Peter Freyther | bce5675 | 2012-11-22 14:59:46 +0100 | [diff] [blame] | 69 | struct abis_nm_sw_descr { |
| 70 | /* where does it start? how long is it? */ |
| 71 | const uint8_t *start; |
| 72 | size_t len; |
| 73 | |
| 74 | /* the parsed data */ |
| 75 | const uint8_t *file_id; |
| 76 | uint16_t file_id_len; |
| 77 | const uint8_t *file_ver; |
| 78 | uint16_t file_ver_len; |
| 79 | }; |
| 80 | |
Harald Welte | 8470bf2 | 2008-12-25 23:28:35 +0000 | [diff] [blame] | 81 | extern int abis_nm_rcvmsg(struct msgb *msg); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 82 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 83 | int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 84 | int abis_nm_rx(struct msgb *msg); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 85 | int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2); |
| 86 | int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, |
| 87 | uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state); |
| 88 | int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr, |
| 89 | uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot, |
| 90 | uint8_t tei); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 91 | int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 92 | uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 93 | int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 94 | uint8_t e1_port, uint8_t e1_timeslot, |
| 95 | uint8_t e1_subslot); |
Harald Welte | fe568f2 | 2012-08-14 19:15:57 +0200 | [diff] [blame] | 96 | int abis_nm_get_attr(struct gsm_bts *bts, uint8_t obj_class, |
| 97 | uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 98 | uint8_t *attr, uint8_t attr_len); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 99 | int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len); |
| 100 | int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len); |
| 101 | int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb); |
| 102 | int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, |
| 103 | uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len); |
| 104 | int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 105 | int abis_nm_event_reports(struct gsm_bts *bts, int on); |
| 106 | int abis_nm_reset_resource(struct gsm_bts *bts); |
Holger Hans Peter Freyther | 64278ed | 2010-05-12 23:51:46 +0800 | [diff] [blame] | 107 | int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 108 | uint8_t win_size, int forced, |
Harald Welte | 3ffd137 | 2009-02-01 22:15:49 +0000 | [diff] [blame] | 109 | gsm_cbfn *cbfn, void *cb_data); |
| 110 | int abis_nm_software_load_status(struct gsm_bts *bts); |
Harald Welte | 5e4d1b3 | 2009-02-01 13:36:56 +0000 | [diff] [blame] | 111 | int abis_nm_software_activate(struct gsm_bts *bts, const char *fname, |
| 112 | gsm_cbfn *cbfn, void *cb_data); |
Harald Welte | 47d88ae | 2009-01-04 12:02:08 +0000 | [diff] [blame] | 113 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 114 | int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0, |
| 115 | uint8_t e1_port1, uint8_t ts1); |
Harald Welte | 1989c08 | 2009-08-06 17:58:31 +0200 | [diff] [blame] | 116 | |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 117 | int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class, |
| 118 | uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 119 | uint8_t test_nr, uint8_t auton_report, struct msgb *msg); |
Harald Welte | c731038 | 2009-08-08 00:02:36 +0200 | [diff] [blame] | 120 | |
Harald Welte | 47d88ae | 2009-01-04 12:02:08 +0000 | [diff] [blame] | 121 | /* Siemens / BS-11 specific */ |
Holger Freyther | 245c534 | 2009-01-27 19:00:44 +0000 | [diff] [blame] | 122 | int abis_nm_bs11_reset_resource(struct gsm_bts *bts); |
Harald Welte | 05188ee | 2009-01-18 11:39:08 +0000 | [diff] [blame] | 123 | int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin); |
| 124 | int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 125 | uint8_t idx, uint8_t attr_len, const uint8_t *attr); |
| 126 | int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx); |
| 127 | int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx); |
Harald Welte | 78fc0d4 | 2009-02-19 02:50:57 +0000 | [diff] [blame] | 128 | int abis_nm_bs11_delete_object(struct gsm_bts *bts, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 129 | enum abis_bs11_objtype type, uint8_t idx); |
| 130 | int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx); |
| 131 | int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port, |
| 132 | uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei); |
Harald Welte | 78fc0d4 | 2009-02-19 02:50:57 +0000 | [diff] [blame] | 133 | int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts); |
| 134 | int abis_nm_bs11_get_serno(struct gsm_bts *bts); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 135 | int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level); |
Harald Welte | 78fc0d4 | 2009-02-19 02:50:57 +0000 | [diff] [blame] | 136 | int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 137 | int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on); |
Harald Welte | 1bc0906 | 2009-01-18 14:17:52 +0000 | [diff] [blame] | 138 | int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on); |
Daniel Willmann | 4b054c8 | 2010-01-07 00:46:26 +0100 | [diff] [blame] | 139 | int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on); |
Harald Welte | 1bc0906 | 2009-01-18 14:17:52 +0000 | [diff] [blame] | 140 | int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); |
Harald Welte | e69f5fb | 2009-04-28 16:31:38 +0000 | [diff] [blame] | 141 | int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); |
Harald Welte | ef06195 | 2009-05-17 12:43:42 +0000 | [diff] [blame] | 142 | int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts); |
Daniel Willmann | 7b1dd74 | 2010-01-07 00:54:01 +0100 | [diff] [blame] | 143 | int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value); |
Harald Welte | ef06195 | 2009-05-17 12:43:42 +0000 | [diff] [blame] | 144 | int abis_nm_bs11_get_cclk(struct gsm_bts *bts); |
Harald Welte | 1bc0906 | 2009-01-18 14:17:52 +0000 | [diff] [blame] | 145 | int abis_nm_bs11_get_state(struct gsm_bts *bts); |
Harald Welte | 5e4d1b3 | 2009-02-01 13:36:56 +0000 | [diff] [blame] | 146 | int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 147 | uint8_t win_size, int forced, gsm_cbfn *cbfn); |
Harald Welte | 268bb40 | 2009-02-01 19:11:56 +0000 | [diff] [blame] | 148 | int abis_nm_bs11_set_ext_time(struct gsm_bts *bts); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 149 | int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport); |
| 150 | int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg); |
Harald Welte | 3ffd137 | 2009-02-01 22:15:49 +0000 | [diff] [blame] | 151 | int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect); |
Harald Welte | 1fa60c8 | 2009-02-09 18:13:26 +0000 | [diff] [blame] | 152 | int abis_nm_bs11_restart(struct gsm_bts *bts); |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 153 | |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 154 | /* ip.access nanoBTS specific commands */ |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 155 | int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type, |
| 156 | uint8_t obj_class, uint8_t bts_nr, |
| 157 | uint8_t trx_nr, uint8_t ts_nr, |
| 158 | uint8_t *attr, int attr_len); |
| 159 | int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr, |
Harald Welte | 193fefc | 2009-04-30 15:16:27 +0000 | [diff] [blame] | 160 | int attr_len); |
Holger Hans Peter Freyther | 52fd4e4 | 2010-05-12 23:34:51 +0800 | [diff] [blame] | 161 | int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx); |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 162 | int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class, |
| 163 | uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 164 | uint8_t *attr, uint8_t attr_len); |
Harald Welte | 746d609 | 2009-10-19 22:11:11 +0200 | [diff] [blame] | 165 | int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 166 | uint32_t ip, uint16_t port, uint8_t stream); |
| 167 | void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts); |
| 168 | int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf); |
| 169 | const char *ipacc_testres_name(uint8_t res); |
Harald Welte | 5c1e458 | 2009-02-15 11:57:29 +0000 | [diff] [blame] | 170 | |
Harald Welte | e0590df | 2009-02-15 03:34:15 +0000 | [diff] [blame] | 171 | /* Functions calling into other code parts */ |
Sylvain Munaut | 1f6c11f | 2010-01-02 16:32:17 +0100 | [diff] [blame] | 172 | int nm_is_running(struct gsm_nm_state *s); |
Harald Welte | 81c9b9c | 2010-05-31 16:40:40 +0200 | [diff] [blame] | 173 | |
| 174 | int abis_nm_vty_init(void); |
| 175 | |
Holger Hans Peter Freyther | 6f61555 | 2010-11-15 20:50:42 +0100 | [diff] [blame] | 176 | void abis_nm_clear_queue(struct gsm_bts *bts); |
| 177 | |
Harald Welte | 15eae8d | 2011-09-26 23:43:23 +0200 | [diff] [blame] | 178 | int _abis_nm_sendmsg(struct msgb *msg); |
Pablo Neira Ayuso | ed5cacb | 2011-08-17 22:44:07 +0200 | [diff] [blame] | 179 | |
| 180 | void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */ |
Holger Hans Peter Freyther | 6f61555 | 2010-11-15 20:50:42 +0100 | [diff] [blame] | 181 | |
Holger Hans Peter Freyther | bce5675 | 2012-11-22 14:59:46 +0100 | [diff] [blame] | 182 | int abis_nm_parse_sw_config(const uint8_t *data, const size_t len, |
| 183 | struct abis_nm_sw_descr *res, const int res_len); |
Holger Hans Peter Freyther | 2f25747 | 2012-11-22 19:04:10 +0100 | [diff] [blame] | 184 | int abis_nm_select_newest_sw(const struct abis_nm_sw_descr *sw, const size_t len); |
Holger Hans Peter Freyther | bce5675 | 2012-11-22 14:59:46 +0100 | [diff] [blame] | 185 | |
Holger Hans Peter Freyther | 8a158bb | 2014-03-26 14:24:42 +0100 | [diff] [blame^] | 186 | /* Helper functions for updating attributes */ |
| 187 | int abis_nm_update_max_power_red(struct gsm_bts_trx *trx); |
| 188 | |
Harald Welte | 52b1f98 | 2008-12-23 20:25:15 +0000 | [diff] [blame] | 189 | #endif /* _NM_H */ |