These patches for openbsc * introduce a similar directory structure for the header files as are used for the source files * fix some implicit declarations of functions * fix a non-critical mismatch in fprintf format specifiers
If the patches seem useful, please merge them to master.
--- openbsc/include/openbsc/abis_nm.h | 167 ------ openbsc/include/openbsc/abis_om2000.h | 98 ---- openbsc/include/openbsc/abis_rsl.h | 101 ---- openbsc/include/openbsc/auth.h | 17 - openbsc/include/openbsc/bsc_api.h | 37 -- openbsc/include/openbsc/bsc_msc.h | 59 -- openbsc/include/openbsc/bsc_nat.h | 437 -------------- openbsc/include/openbsc/bsc_rll.h | 19 - openbsc/include/openbsc/chan_alloc.h | 65 --- openbsc/include/openbsc/control_cmd.h | 155 ----- openbsc/include/openbsc/crc24.h | 10 - openbsc/include/openbsc/db.h | 81 --- openbsc/include/openbsc/debug.h | 67 --- openbsc/include/openbsc/gb_proxy.h | 38 -- openbsc/include/openbsc/gprs/crc24.h | 10 + openbsc/include/openbsc/gprs/gb_proxy.h | 38 ++ openbsc/include/openbsc/gprs/gprs_gmm.h | 19 + openbsc/include/openbsc/gprs/gprs_llc.h | 162 ++++++ openbsc/include/openbsc/gprs/gprs_sgsn.h | 220 +++++++ openbsc/include/openbsc/gprs_bssgp.h | 232 -------- openbsc/include/openbsc/gprs_gmm.h | 19 - openbsc/include/openbsc/gprs_llc.h | 162 ------ openbsc/include/openbsc/gprs_ns.h | 232 -------- openbsc/include/openbsc/gprs_ns_frgre.h | 6 - openbsc/include/openbsc/gprs_sgsn.h | 220 ------- openbsc/include/openbsc/gsm_04_08.h | 72 --- openbsc/include/openbsc/gsm_04_11.h | 40 -- openbsc/include/openbsc/gsm_04_80.h | 20 - openbsc/include/openbsc/gsm_data.h | 388 ------------- openbsc/include/openbsc/gsm_data_shared.h | 602 -------------------- openbsc/include/openbsc/gsm_subscriber.h | 106 ---- openbsc/include/openbsc/ipaccess/network_listen.h | 16 + openbsc/include/openbsc/libbsc/abis_nm.h | 167 ++++++ openbsc/include/openbsc/libbsc/abis_om2000.h | 98 ++++ openbsc/include/openbsc/libbsc/abis_rsl.h | 101 ++++ openbsc/include/openbsc/libbsc/bsc_api.h | 37 ++ openbsc/include/openbsc/libbsc/bsc_msc.h | 59 ++ openbsc/include/openbsc/libbsc/bsc_rll.h | 19 + openbsc/include/openbsc/libbsc/chan_alloc.h | 65 +++ openbsc/include/openbsc/libbsc/meas_rep.h | 87 +++ openbsc/include/openbsc/libbsc/paging.h | 73 +++ openbsc/include/openbsc/libbsc/rest_octets.h | 132 +++++ .../include/openbsc/libbsc/system_information.h | 10 + openbsc/include/openbsc/libcommon/debug.h | 67 +++ openbsc/include/openbsc/libcommon/gsm_data.h | 388 +++++++++++++ .../include/openbsc/libcommon/gsm_data_shared.h | 602 ++++++++++++++++++++ openbsc/include/openbsc/libcommon/socket.h | 14 + openbsc/include/openbsc/libctrl/control_cmd.h | 155 +++++ openbsc/include/openbsc/libgb/gprs_bssgp.h | 232 ++++++++ openbsc/include/openbsc/libgb/gprs_ns.h | 232 ++++++++ openbsc/include/openbsc/libgb/gprs_ns_frgre.h | 6 + openbsc/include/openbsc/libmsc/auth.h | 17 + openbsc/include/openbsc/libmsc/db.h | 81 +++ openbsc/include/openbsc/libmsc/gsm_04_08.h | 72 +++ openbsc/include/openbsc/libmsc/gsm_04_11.h | 40 ++ openbsc/include/openbsc/libmsc/gsm_04_80.h | 20 + openbsc/include/openbsc/libmsc/gsm_subscriber.h | 106 ++++ openbsc/include/openbsc/libmsc/mncc.h | 173 ++++++ openbsc/include/openbsc/libmsc/osmo_msc.h | 11 + openbsc/include/openbsc/libmsc/silent_call.h | 12 + openbsc/include/openbsc/libmsc/sms_queue.h | 17 + openbsc/include/openbsc/libmsc/transaction.h | 76 +++ openbsc/include/openbsc/libmsc/ussd.h | 10 + openbsc/include/openbsc/libtrau/rtp_proxy.h | 91 +++ openbsc/include/openbsc/libtrau/trau_mux.h | 55 ++ openbsc/include/openbsc/meas_rep.h | 87 --- openbsc/include/openbsc/mncc.h | 173 ------ openbsc/include/openbsc/network_listen.h | 16 - openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h | 28 + openbsc/include/openbsc/osmo-bsc/osmo_bsc_rf.h | 35 ++ openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h | 437 ++++++++++++++ openbsc/include/openbsc/osmo_bsc_grace.h | 28 - openbsc/include/openbsc/osmo_bsc_rf.h | 35 -- openbsc/include/openbsc/osmo_msc.h | 11 - openbsc/include/openbsc/paging.h | 73 --- openbsc/include/openbsc/rest_octets.h | 132 ----- openbsc/include/openbsc/rtp_proxy.h | 91 --- openbsc/include/openbsc/silent_call.h | 12 - openbsc/include/openbsc/sms_queue.h | 17 - openbsc/include/openbsc/socket.h | 14 - openbsc/include/openbsc/system_information.h | 10 - openbsc/include/openbsc/transaction.h | 76 --- openbsc/include/openbsc/trau_mux.h | 55 -- openbsc/include/openbsc/ussd.h | 10 - 84 files changed, 4290 insertions(+), 4290 deletions(-) delete mode 100644 openbsc/include/openbsc/abis_nm.h delete mode 100644 openbsc/include/openbsc/abis_om2000.h delete mode 100644 openbsc/include/openbsc/abis_rsl.h delete mode 100644 openbsc/include/openbsc/auth.h delete mode 100644 openbsc/include/openbsc/bsc_api.h delete mode 100644 openbsc/include/openbsc/bsc_msc.h delete mode 100644 openbsc/include/openbsc/bsc_nat.h delete mode 100644 openbsc/include/openbsc/bsc_rll.h delete mode 100644 openbsc/include/openbsc/chan_alloc.h delete mode 100644 openbsc/include/openbsc/control_cmd.h delete mode 100644 openbsc/include/openbsc/crc24.h delete mode 100644 openbsc/include/openbsc/db.h delete mode 100644 openbsc/include/openbsc/debug.h delete mode 100644 openbsc/include/openbsc/gb_proxy.h create mode 100644 openbsc/include/openbsc/gprs/crc24.h create mode 100644 openbsc/include/openbsc/gprs/gb_proxy.h create mode 100644 openbsc/include/openbsc/gprs/gprs_gmm.h create mode 100644 openbsc/include/openbsc/gprs/gprs_llc.h create mode 100644 openbsc/include/openbsc/gprs/gprs_sgsn.h delete mode 100644 openbsc/include/openbsc/gprs_bssgp.h delete mode 100644 openbsc/include/openbsc/gprs_gmm.h delete mode 100644 openbsc/include/openbsc/gprs_llc.h delete mode 100644 openbsc/include/openbsc/gprs_ns.h delete mode 100644 openbsc/include/openbsc/gprs_ns_frgre.h delete mode 100644 openbsc/include/openbsc/gprs_sgsn.h delete mode 100644 openbsc/include/openbsc/gsm_04_08.h delete mode 100644 openbsc/include/openbsc/gsm_04_11.h delete mode 100644 openbsc/include/openbsc/gsm_04_80.h delete mode 100644 openbsc/include/openbsc/gsm_data.h delete mode 100644 openbsc/include/openbsc/gsm_data_shared.h delete mode 100644 openbsc/include/openbsc/gsm_subscriber.h create mode 100644 openbsc/include/openbsc/ipaccess/network_listen.h create mode 100644 openbsc/include/openbsc/libbsc/abis_nm.h create mode 100644 openbsc/include/openbsc/libbsc/abis_om2000.h create mode 100644 openbsc/include/openbsc/libbsc/abis_rsl.h create mode 100644 openbsc/include/openbsc/libbsc/bsc_api.h create mode 100644 openbsc/include/openbsc/libbsc/bsc_msc.h create mode 100644 openbsc/include/openbsc/libbsc/bsc_rll.h create mode 100644 openbsc/include/openbsc/libbsc/chan_alloc.h create mode 100644 openbsc/include/openbsc/libbsc/meas_rep.h create mode 100644 openbsc/include/openbsc/libbsc/paging.h create mode 100644 openbsc/include/openbsc/libbsc/rest_octets.h create mode 100644 openbsc/include/openbsc/libbsc/system_information.h create mode 100644 openbsc/include/openbsc/libcommon/debug.h create mode 100644 openbsc/include/openbsc/libcommon/gsm_data.h create mode 100644 openbsc/include/openbsc/libcommon/gsm_data_shared.h create mode 100644 openbsc/include/openbsc/libcommon/socket.h create mode 100644 openbsc/include/openbsc/libctrl/control_cmd.h create mode 100644 openbsc/include/openbsc/libgb/gprs_bssgp.h create mode 100644 openbsc/include/openbsc/libgb/gprs_ns.h create mode 100644 openbsc/include/openbsc/libgb/gprs_ns_frgre.h create mode 100644 openbsc/include/openbsc/libmsc/auth.h create mode 100644 openbsc/include/openbsc/libmsc/db.h create mode 100644 openbsc/include/openbsc/libmsc/gsm_04_08.h create mode 100644 openbsc/include/openbsc/libmsc/gsm_04_11.h create mode 100644 openbsc/include/openbsc/libmsc/gsm_04_80.h create mode 100644 openbsc/include/openbsc/libmsc/gsm_subscriber.h create mode 100644 openbsc/include/openbsc/libmsc/mncc.h create mode 100644 openbsc/include/openbsc/libmsc/osmo_msc.h create mode 100644 openbsc/include/openbsc/libmsc/silent_call.h create mode 100644 openbsc/include/openbsc/libmsc/sms_queue.h create mode 100644 openbsc/include/openbsc/libmsc/transaction.h create mode 100644 openbsc/include/openbsc/libmsc/ussd.h create mode 100644 openbsc/include/openbsc/libtrau/rtp_proxy.h create mode 100644 openbsc/include/openbsc/libtrau/trau_mux.h delete mode 100644 openbsc/include/openbsc/meas_rep.h delete mode 100644 openbsc/include/openbsc/mncc.h delete mode 100644 openbsc/include/openbsc/network_listen.h create mode 100644 openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h create mode 100644 openbsc/include/openbsc/osmo-bsc/osmo_bsc_rf.h create mode 100644 openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h delete mode 100644 openbsc/include/openbsc/osmo_bsc_grace.h delete mode 100644 openbsc/include/openbsc/osmo_bsc_rf.h delete mode 100644 openbsc/include/openbsc/osmo_msc.h delete mode 100644 openbsc/include/openbsc/paging.h delete mode 100644 openbsc/include/openbsc/rest_octets.h delete mode 100644 openbsc/include/openbsc/rtp_proxy.h delete mode 100644 openbsc/include/openbsc/silent_call.h delete mode 100644 openbsc/include/openbsc/sms_queue.h delete mode 100644 openbsc/include/openbsc/socket.h delete mode 100644 openbsc/include/openbsc/system_information.h delete mode 100644 openbsc/include/openbsc/transaction.h delete mode 100644 openbsc/include/openbsc/trau_mux.h delete mode 100644 openbsc/include/openbsc/ussd.h
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h deleted file mode 100644 index f11ac11..0000000 --- a/openbsc/include/openbsc/abis_nm.h +++ /dev/null @@ -1,167 +0,0 @@ -/* GSM Network Management messages on the A-bis interface - * 3GPP TS 12.21 version 8.0.0 Release 1999 / ETSI TS 100 623 V8.0.0 */ - -/* (C) 2008-2009 by Harald Welte laforge@gnumonks.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef _NM_H -#define _NM_H - -#include <osmocom/gsm/tlv.h> -#include <osmocom/gsm/abis_nm.h> -#include <osmocom/gsm/protocol/gsm_12_21.h> - -struct cell_global_id { - uint16_t mcc; - uint16_t mnc; - uint16_t lac; - uint16_t ci; -}; - -/* The BCCH info from an ip.access test, in host byte order - * and already parsed... */ -struct ipac_bcch_info { - struct llist_head list; - - uint16_t info_type; - uint8_t freq_qual; - uint16_t arfcn; - uint8_t rx_lev; - uint8_t rx_qual; - int16_t freq_err; - uint16_t frame_offset; - uint32_t frame_nr_offset; - uint8_t bsic; - struct cell_global_id cgi; - uint8_t ba_list_si2[16]; - uint8_t ba_list_si2bis[16]; - uint8_t ba_list_si2ter[16]; - uint8_t ca_list_si1[16]; -}; - -/* PUBLIC */ - -struct msgb; - -struct abis_nm_cfg { - /* callback for unidirectional reports */ - int (*report_cb)(struct msgb *, - struct abis_om_fom_hdr *); - /* callback for software activate requests from BTS */ - int (*sw_act_req)(struct msgb *); -}; - -extern int abis_nm_rcvmsg(struct msgb *msg); - -int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len); -int abis_nm_rx(struct msgb *msg); -int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2); -int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, - uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state); -int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr, - uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot, - uint8_t tei); -int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx, - uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot); -int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts, - uint8_t e1_port, uint8_t e1_timeslot, - uint8_t e1_subslot); -int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len); -int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len); -int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb); -int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, - uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len); -int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg); -int abis_nm_event_reports(struct gsm_bts *bts, int on); -int abis_nm_reset_resource(struct gsm_bts *bts); -int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname, - uint8_t win_size, int forced, - gsm_cbfn *cbfn, void *cb_data); -int abis_nm_software_load_status(struct gsm_bts *bts); -int abis_nm_software_activate(struct gsm_bts *bts, const char *fname, - gsm_cbfn *cbfn, void *cb_data); - -int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0, - uint8_t e1_port1, uint8_t ts1); - -int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class, - uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, - uint8_t test_nr, uint8_t auton_report, struct msgb *msg); - -/* Siemens / BS-11 specific */ -int abis_nm_bs11_reset_resource(struct gsm_bts *bts); -int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin); -int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type, - uint8_t idx, uint8_t attr_len, const uint8_t *attr); -int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx); -int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx); -int abis_nm_bs11_delete_object(struct gsm_bts *bts, - enum abis_bs11_objtype type, uint8_t idx); -int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx); -int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port, - uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei); -int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts); -int abis_nm_bs11_get_serno(struct gsm_bts *bts); -int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level); -int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx); -int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on); -int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on); -int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on); -int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); -int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); -int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts); -int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value); -int abis_nm_bs11_get_cclk(struct gsm_bts *bts); -int abis_nm_bs11_get_state(struct gsm_bts *bts); -int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname, - uint8_t win_size, int forced, gsm_cbfn *cbfn); -int abis_nm_bs11_set_ext_time(struct gsm_bts *bts); -int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport); -int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg); -int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect); -int abis_nm_bs11_restart(struct gsm_bts *bts); - -/* ip.access nanoBTS specific commands */ -int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type, - uint8_t obj_class, uint8_t bts_nr, - uint8_t trx_nr, uint8_t ts_nr, - uint8_t *attr, int attr_len); -int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr, - int attr_len); -int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx); -int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class, - uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, - uint8_t *attr, uint8_t attr_len); -int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, - uint32_t ip, uint16_t port, uint8_t stream); -void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts); -int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf); -const char *ipacc_testres_name(uint8_t res); - -/* Functions calling into other code parts */ -int nm_is_running(struct gsm_nm_state *s); - -int abis_nm_vty_init(void); - -void abis_nm_clear_queue(struct gsm_bts *bts); - -int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml); - -void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */ - -#endif /* _NM_H */ diff --git a/openbsc/include/openbsc/abis_om2000.h b/openbsc/include/openbsc/abis_om2000.h deleted file mode 100644 index 2ff7270..0000000 --- a/openbsc/include/openbsc/abis_om2000.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef OPENBSC_ABIS_OM2K_H -#define OPENBSC_ABIS_OM2K_H -/* Ericsson RBS 2xxx GSM O&M (OM2000) messages on the A-bis interface - * implemented based on protocol trace analysis, no formal documentation */ - -/* (C) 2010-2011 by Harald Welte laforge@gnumonks.org - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -enum abis_om2k_mo_cls { - OM2K_MO_CLS_TRXC = 0x01, - OM2K_MO_CLS_TS = 0x03, - OM2K_MO_CLS_TF = 0x04, - OM2K_MO_CLS_IS = 0x05, - OM2K_MO_CLS_CON = 0x06, - OM2K_MO_CLS_DP = 0x07, - OM2K_MO_CLS_CF = 0x0a, - OM2K_MO_CLS_TX = 0x0b, - OM2K_MO_CLS_RX = 0x0c, -}; - -enum om2k_mo_state { - OM2K_MO_S_RESET = 0, - OM2K_MO_S_STARTED, - OM2K_MO_S_ENABLED, - OM2K_MO_S_DISABLED, -}; - -struct abis_om2k_mo { - uint8_t class; - uint8_t bts; - uint8_t assoc_so; - uint8_t inst; -} __attribute__ ((packed)); - -/* on-wire format for IS conn group */ -struct om2k_is_conn_grp { - uint16_t icp1; - uint16_t icp2; - uint8_t cont_idx; -} __attribute__ ((packed)); - -/* internal data formant for IS conn group */ -struct is_conn_group { - struct llist_head list; - uint16_t icp1; - uint16_t icp2; - uint8_t ci; -}; - -extern const struct abis_om2k_mo om2k_mo_cf; -extern const struct abis_om2k_mo om2k_mo_is; -extern const struct abis_om2k_mo om2k_mo_con; -extern const struct abis_om2k_mo om2k_mo_tf; - -extern const struct value_string om2k_mo_class_short_vals[]; - -int abis_om2k_rcvmsg(struct msgb *msg); - -extern const struct abis_om2k_mo om2k_mo_cf; - -int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_enable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); -int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo, - uint8_t operational); -int abis_om2k_tx_is_conf_req(struct gsm_bts *bts); -int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts); -int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx); -int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx); -int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts); - -int abis_om2k_vty_init(void); - -struct vty; -void abis_om2k_config_write_bts(struct vty *vty, struct gsm_bts *bts); - -#endif /* OPENBCS_ABIS_OM2K_H */ diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h deleted file mode 100644 index bf1df5e..0000000 --- a/openbsc/include/openbsc/abis_rsl.h +++ /dev/null @@ -1,101 +0,0 @@ -/* GSM Radio Signalling Link messages on the A-bis interface - * 3GPP TS 08.58 version 8.6.0 Release 1999 / ETSI TS 100 596 V8.6.0 */ - -/* (C) 2008 by Harald Welte laforge@gnumonks.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef _RSL_H -#define _RSL_H - -#include <osmocom/gsm/protocol/gsm_08_58.h> - -#include <osmocom/core/msgb.h> - -struct gsm_bts; -struct gsm_lchan; -struct gsm_subscriber; -struct gsm_bts_trx_ts; - - -int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type, - const uint8_t *data, int len); -int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, - const uint8_t *data, int len); -int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr, - uint8_t act_type, - struct rsl_ie_chan_mode *chan_mode, - struct rsl_ie_chan_ident *chan_ident, - uint8_t bs_power, uint8_t ms_power, - uint8_t ta); -int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type, - uint8_t ta, uint8_t ho_ref); -int rsl_chan_mode_modify_req(struct gsm_lchan *ts); -int rsl_encryption_cmd(struct msgb *msg); -int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, - uint8_t *ms_ident, uint8_t chan_needed); -int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val); - -int rsl_data_request(struct msgb *msg, uint8_t link_id); -int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); -int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); - -/* Siemens vendor-specific RSL extensions */ -int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); - -/* ip.access specfic RSL extensions */ -int rsl_ipacc_crcx(struct gsm_lchan *lchan); -int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip, - uint16_t port, uint8_t rtp_payload2); -int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan); -int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act); - -int abis_rsl_rcvmsg(struct msgb *msg); - -uint64_t str_to_imsi(const char *imsi_str); -int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason); - -int rsl_lchan_set_state(struct gsm_lchan *lchan, int); - -/* to be provided by external code */ -int abis_rsl_sendmsg(struct msgb *msg); -int rsl_deact_sacch(struct gsm_lchan *lchan); -int rsl_lchan_rll_release(struct gsm_lchan *lchan, uint8_t link_id); - -/* BCCH related code */ -int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf); -int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf); - -int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type, - const uint8_t *data, int len); - -int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db); -int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm); - -/* SMSCB functionality */ -int rsl_sms_cb_command(struct gsm_bts *bts, uint8_t chan_number, - uint8_t cb_command, const uint8_t *data, int len); - -/* some Nokia specific stuff */ -int rsl_nokia_si_begin(struct gsm_bts_trx *trx); -int rsl_nokia_si_end(struct gsm_bts_trx *trx); - -/* required for Nokia BTS power control */ -int rsl_bs_power_control(struct gsm_bts_trx *trx, uint8_t channel, uint8_t reduction); - -#endif /* RSL_MT_H */ - diff --git a/openbsc/include/openbsc/auth.h b/openbsc/include/openbsc/auth.h deleted file mode 100644 index 2364fb3..0000000 --- a/openbsc/include/openbsc/auth.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _AUTH_H -#define _AUTH_H - -struct gsm_auth_tuple; -struct gsm_subscriber; - -enum auth_action { - AUTH_NOT_AVAIL = 0, /* No auth tuple available */ - AUTH_DO_AUTH_THAN_CIPH = 1, /* Firsth authenticate, then cipher */ - AUTH_DO_CIPH = 2, /* Only ciphering */ - AUTH_DO_AUTH = 3, /* Only authentication, no ciphering */ -}; - -int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple, - struct gsm_subscriber *subscr, int key_seq); - -#endif /* _AUTH_H */ diff --git a/openbsc/include/openbsc/bsc_api.h b/openbsc/include/openbsc/bsc_api.h deleted file mode 100644 index 36ec370..0000000 --- a/openbsc/include/openbsc/bsc_api.h +++ /dev/null @@ -1,37 +0,0 @@ -/* GSM 08.08 like API for OpenBSC */ - -#ifndef OPENBSC_BSC_API_H -#define OPENBSC_BSC_API_H - -#include "gsm_data.h" - -#define BSC_API_CONN_POL_ACCEPT 0 -#define BSC_API_CONN_POL_REJECT 1 - -struct bsc_api { - void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci); - void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn, - struct msgb *msg, uint8_t chosen_encr); - int (*compl_l3)(struct gsm_subscriber_connection *conn, - struct msgb *msg, uint16_t chosen_channel); - void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id, - struct msgb *msg); - void (*assign_compl)(struct gsm_subscriber_connection *conn, - uint8_t rr_cause, uint8_t chosen_channel, - uint8_t encr_alg_id, uint8_t speech_mode); - void (*assign_fail)(struct gsm_subscriber_connection *conn, - uint8_t cause, uint8_t *rr_cause); - int (*clear_request)(struct gsm_subscriber_connection *conn, - uint32_t cause); -}; - -int bsc_api_init(struct gsm_network *network, struct bsc_api *api); -int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sach); -int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate); -int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, - const uint8_t *key, int len, int include_imeisv); -int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, - unsigned int mi_len, uint8_t *mi, int chan_type); -int gsm0808_clear(struct gsm_subscriber_connection *conn); - -#endif diff --git a/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h deleted file mode 100644 index 9543002..0000000 --- a/openbsc/include/openbsc/bsc_msc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Routines to talk to the MSC using the IPA Protocol */ -/* - * (C) 2010 by Holger Hans Peter Freyther zecke@selfish.org - * (C) 2010 by On-Waves - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef BSC_MSC_H -#define BSC_MSC_H - -#include <osmocom/core/write_queue.h> -#include <osmocom/core/timer.h> - -struct bsc_msc_dest { - struct llist_head list; - - char *ip; - int port; - int dscp; -}; - - -struct bsc_msc_connection { - struct osmo_wqueue write_queue; - int is_connected; - int is_authenticated; - int first_contact; - - struct llist_head *dests; - - void (*connection_loss) (struct bsc_msc_connection *); - void (*connected) (struct bsc_msc_connection *); - struct osmo_timer_list reconnect_timer; - struct osmo_timer_list timeout_timer; -}; - -struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest); -int bsc_msc_connect(struct bsc_msc_connection *); -void bsc_msc_schedule_connect(struct bsc_msc_connection *); - -void bsc_msc_lost(struct bsc_msc_connection *); - -struct msgb *bsc_msc_id_get_resp(const char *token); - -#endif diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h deleted file mode 100644 index b4f07e0..0000000 --- a/openbsc/include/openbsc/bsc_nat.h +++ /dev/null @@ -1,437 +0,0 @@ -/* - * (C) 2010-2011 by Holger Hans Peter Freyther zecke@selfish.org - * (C) 2010-2011 by On-Waves - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef BSC_NAT_H -#define BSC_NAT_H - -#include "mgcp.h" - - -#include <osmocom/core/select.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/msgfile.h> -#include <osmocom/core/timer.h> -#include <osmocom/core/write_queue.h> -#include <osmocom/core/rate_ctr.h> -#include <osmocom/core/statistics.h> -#include <osmocom/gsm/protocol/gsm_04_08.h> - -#include <regex.h> - -#define DIR_BSC 1 -#define DIR_MSC 2 - -#define PAGIN_GROUP_UNASSIGNED -1 - -struct sccp_source_reference; -struct sccp_connections; -struct bsc_nat_parsed; -struct bsc_nat; -struct bsc_nat_ussd_con; - -enum { - NAT_CON_TYPE_NONE, - NAT_CON_TYPE_LU, - NAT_CON_TYPE_CM_SERV_REQ, - NAT_CON_TYPE_PAG_RESP, - NAT_CON_TYPE_SSA, - NAT_CON_TYPE_LOCAL_REJECT, - NAT_CON_TYPE_OTHER, -}; - -/* - * Is this terminated to the MSC, to the local machine (release - * handling for IMSI filtering) or to a USSD provider? - */ -enum { - NAT_CON_END_MSC, - NAT_CON_END_LOCAL, - NAT_CON_END_USSD, -}; - -/* - * Pending command entry - */ -struct bsc_cmd_list { - struct llist_head list_entry; - - struct osmo_timer_list timeout; - - /* The NATed ID used on the bsc_con*/ - int nat_id; - - /* The control connection from which the command originated */ - struct ctrl_connection *ccon; - - /* The command from the control connection */ - struct ctrl_cmd *cmd; -}; - -/* - * Per BSC data structure - */ -struct bsc_connection { - struct llist_head list_entry; - - /* do we know anything about this BSC? */ - int authenticated; - - /* the fd we use to communicate */ - struct osmo_wqueue write_queue; - - /* the BSS associated */ - struct bsc_config *cfg; - - /* a timeout node */ - struct osmo_timer_list id_timeout; - - /* pong timeout */ - struct osmo_timer_list ping_timeout; - struct osmo_timer_list pong_timeout; - - /* mgcp related code */ - char *_endpoint_status; - int number_multiplexes; - int max_endpoints; - int last_endpoint; - - /* track the pending commands for this BSC */ - struct llist_head cmd_pending; - int last_id; - - /* a back pointer */ - struct bsc_nat *nat; -}; - -/** - * Stats per BSC - */ -struct bsc_config_stats { - struct rate_ctr_group *ctrg; -}; - -enum bsc_cfg_ctr { - BCFG_CTR_SCCP_CONN, - BCFG_CTR_SCCP_CALLS, - BCFG_CTR_NET_RECONN, - BCFG_CTR_DROPPED_SCCP, - BCFG_CTR_DROPPED_CALLS, - BCFG_CTR_REJECTED_CR, - BCFG_CTR_REJECTED_MSG, - BCFG_CTR_ILL_PACKET, - BCFG_CTR_CON_TYPE_LU, - BCFG_CTR_CON_CMSERV_RQ, - BCFG_CTR_CON_PAG_RESP, - BCFG_CTR_CON_SSA, - BCFG_CTR_CON_OTHER, -}; - -/** - * One BSC entry in the config - */ -struct bsc_config { - struct llist_head entry; - - char *token; - int nr; - - char *description; - - /* imsi white and blacklist */ - char *acc_lst_name; - - int forbid_paging; - int paging_group; - - /* audio handling */ - int max_endpoints; - - /* backpointer */ - struct bsc_nat *nat; - - struct bsc_config_stats stats; - - struct llist_head lac_list; -}; - -struct bsc_lac_entry { - struct llist_head entry; - uint16_t lac; -}; - -struct bsc_nat_paging_group { - struct llist_head entry; - - /* list of lac entries */ - struct llist_head lists; - int nr; -}; - -/** - * BSCs point of view of endpoints - */ -struct bsc_endpoint { - /* the operation that is carried out */ - int transaction_state; - /* the pending transaction id */ - char *transaction_id; - /* the bsc we are talking to */ - struct bsc_connection *bsc; -}; - -/** - * Statistic for the nat. - */ -struct bsc_nat_statistics { - struct { - struct osmo_counter *conn; - struct osmo_counter *calls; - } sccp; - - struct { - struct osmo_counter *reconn; - struct osmo_counter *auth_fail; - } bsc; - - struct { - struct osmo_counter *reconn; - } msc; - - struct { - struct osmo_counter *reconn; - } ussd; -}; - -enum bsc_nat_acc_ctr { - ACC_LIST_BSC_FILTER, - ACC_LIST_NAT_FILTER, -}; - -struct bsc_nat_acc_lst { - struct llist_head list; - - /* counter */ - struct rate_ctr_group *stats; - - /* the name of the list */ - const char *name; - struct llist_head fltr_list; -}; - -struct bsc_nat_acc_lst_entry { - struct llist_head list; - - /* the filter */ - char *imsi_allow; - regex_t imsi_allow_re; - char *imsi_deny; - regex_t imsi_deny_re; -}; - -/** - * the structure of the "nat" network - */ -struct bsc_nat { - /* active SCCP connections that need patching */ - struct llist_head sccp_connections; - - /* active BSC connections that need patching */ - struct llist_head bsc_connections; - - /* access lists */ - struct llist_head access_lists; - - /* paging groups */ - struct llist_head paging_groups; - - /* known BSC's */ - struct llist_head bsc_configs; - int num_bsc; - int bsc_ip_dscp; - - /* MGCP config */ - struct mgcp_config *mgcp_cfg; - uint8_t mgcp_msg[4096]; - int mgcp_length; - - /* msc things */ - struct llist_head dests; - struct bsc_msc_dest *main_dest; - struct bsc_msc_connection *msc_con; - char *token; - - /* timeouts */ - int auth_timeout; - int ping_timeout; - int pong_timeout; - - struct bsc_endpoint *bsc_endpoints; - - /* filter */ - char *acc_lst_name; - - /* number rewriting */ - char *num_rewr_name; - struct llist_head num_rewr; - - char *smsc_rewr_name; - struct llist_head smsc_rewr; - char *tpdest_match_name; - struct llist_head tpdest_match; - - /* USSD messages we want to match */ - char *ussd_lst_name; - char *ussd_query; - regex_t ussd_query_re; - char *ussd_token; - char *ussd_local; - struct osmo_fd ussd_listen; - struct bsc_nat_ussd_con *ussd_con; - - /* for maintainenance */ - int blocked; - - /* statistics */ - struct bsc_nat_statistics stats; -}; - -struct bsc_nat_ussd_con { - struct osmo_wqueue queue; - struct bsc_nat *nat; - int authorized; - - struct osmo_timer_list auth_timeout; -}; - -/* create and init the structures */ -struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token); -struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num); -void bsc_config_free(struct bsc_config *); -void bsc_config_add_lac(struct bsc_config *cfg, int lac); -void bsc_config_del_lac(struct bsc_config *cfg, int lac); -int bsc_config_handles_lac(struct bsc_config *cfg, int lac); - -struct bsc_nat *bsc_nat_alloc(void); -struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat); -void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip); - -void sccp_connection_destroy(struct sccp_connections *); -void bsc_close_connection(struct bsc_connection *); - -const char *bsc_con_type_to_string(int type); - -/** - * parse the given message into the above structure - */ -struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg); - -/** - * filter based on IP Access header in both directions - */ -int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed); -int bsc_nat_vty_init(struct bsc_nat *nat); -int bsc_nat_find_paging(struct msgb *msg, const uint8_t **,int *len); - -/** - * Content filtering. - */ -int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg, - struct bsc_nat_parsed *, int *con_type, char **imsi); -int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg, - struct sccp_connections *con, struct bsc_nat_parsed *parsed); - -/** - * SCCP patching and handling - */ -struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed); -int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *parsed); -void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed); -struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *); -struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *); -struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *); - -/** - * MGCP/Audio handling - */ -int bsc_mgcp_nr_multiplexes(int max_endpoints); -int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length); -int bsc_mgcp_assign_patch(struct sccp_connections *, struct msgb *msg); -void bsc_mgcp_init(struct sccp_connections *); -void bsc_mgcp_dlcx(struct sccp_connections *); -void bsc_mgcp_free_endpoints(struct bsc_nat *nat); -int bsc_mgcp_nat_init(struct bsc_nat *nat); - -struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number); -struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port); -void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg); - -void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc); -int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]); -uint32_t bsc_mgcp_extract_ci(const char *resp); - - -int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id); -int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id); -int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg); -int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg); - -/* IMSI allow/deny handling */ -struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name); -struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name); -void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst); - -struct bsc_nat_acc_lst_entry *bsc_nat_acc_lst_entry_create(struct bsc_nat_acc_lst *); -int bsc_nat_lst_check_allow(struct bsc_nat_acc_lst *lst, const char *imsi); - -int bsc_nat_msc_is_connected(struct bsc_nat *nat); - -int bsc_conn_type_to_ctr(struct sccp_connections *conn); - -struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len); - -/** USSD filtering */ -int bsc_ussd_init(struct bsc_nat *nat); -int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct msgb *msg); -int bsc_close_ussd_connections(struct bsc_nat *nat); - -struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi); - -/** paging group handling */ -struct bsc_nat_paging_group *bsc_nat_paging_group_num(struct bsc_nat *nat, int group); -struct bsc_nat_paging_group *bsc_nat_paging_group_create(struct bsc_nat *nat, int group); -void bsc_nat_paging_group_delete(struct bsc_nat_paging_group *); -void bsc_nat_paging_group_add_lac(struct bsc_nat_paging_group *grp, int lac); -void bsc_nat_paging_group_del_lac(struct bsc_nat_paging_group *grp, int lac); - -/** - * Number rewriting support below - */ -struct bsc_nat_num_rewr_entry { - struct llist_head list; - - regex_t msisdn_reg; - regex_t num_reg; - - char *replace; -}; - -void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *); - -#endif diff --git a/openbsc/include/openbsc/bsc_rll.h b/openbsc/include/openbsc/bsc_rll.h deleted file mode 100644 index 729ba60..0000000 --- a/openbsc/include/openbsc/bsc_rll.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _BSC_RLL_H -#define _BSC_RLL_H - -#include <openbsc/gsm_data.h> - -enum bsc_rllr_ind { - BSC_RLLR_IND_EST_CONF, - BSC_RLLR_IND_REL_IND, - BSC_RLLR_IND_ERR_IND, - BSC_RLLR_IND_TIMEOUT, -}; - -int rll_establish(struct gsm_lchan *lchan, uint8_t link_id, - void (*cb)(struct gsm_lchan *, uint8_t, void *, - enum bsc_rllr_ind), - void *data); -void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type); - -#endif /* _BSC_RLL_H */ diff --git a/openbsc/include/openbsc/chan_alloc.h b/openbsc/include/openbsc/chan_alloc.h deleted file mode 100644 index 5eda312..0000000 --- a/openbsc/include/openbsc/chan_alloc.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Management functions to allocate/release struct gsm_lchan */ -/* (C) 2008 by Harald Welte laforge@gnumonks.org - * (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ -#ifndef _CHAN_ALLOC_H -#define _CHAN_ALLOC_H - -#include "gsm_data.h" - -struct gsm_subscriber_connection; - -/* Special allocator for C0 of BTS */ -struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan); - -/* Regular physical channel allocator */ -struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, - enum gsm_phys_chan_config pchan); - -/* Regular physical channel (TS) */ -void ts_free(struct gsm_bts_trx_ts *ts); - -/* Find an allocated channel for a specified subscriber */ -struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr); - -/* Allocate a logical channel (SDCCH, TCH, ...) */ -struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger); - -/* Free a logical channel (SDCCH, TCH, ...) */ -void lchan_free(struct gsm_lchan *lchan); -void lchan_reset(struct gsm_lchan *lchan); - -/* Release the given lchan */ -int lchan_release(struct gsm_lchan *lchan, int sach_deact, int reason); - -struct load_counter { - unsigned int total; - unsigned int used; -}; - -struct pchan_load { - struct load_counter pchan[GSM_PCHAN_UNKNOWN]; -}; - -void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); -void network_chan_load(struct pchan_load *pl, struct gsm_network *net); - -int trx_is_usable(struct gsm_bts_trx *trx); - -#endif /* _CHAN_ALLOC_H */ diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h deleted file mode 100644 index 2a5391f..0000000 --- a/openbsc/include/openbsc/control_cmd.h +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef _CONTROL_CMD_H -#define _CONTROL_CMD_H - -#include <osmocom/core/msgb.h> -#include <osmocom/core/write_queue.h> - -#include <osmocom/vty/vector.h> - -#define CTRL_CMD_ERROR -1 -#define CTRL_CMD_HANDLED 0 -#define CTRL_CMD_REPLY 1 - -enum ctrl_node_type { - CTRL_NODE_ROOT, /* Root elements */ - CTRL_NODE_NET, /* Network specific (net.) */ - CTRL_NODE_BTS, /* BTS specific (net.btsN.) */ - CTRL_NODE_TRX, /* TRX specific (net.btsN.trxM.) */ - CTRL_NODE_TS, /* TS specific (net.btsN.trxM.tsI.) */ - _LAST_CTRL_NODE -}; - -enum ctrl_type { - CTRL_TYPE_UNKNOWN, - CTRL_TYPE_GET, - CTRL_TYPE_SET, - CTRL_TYPE_GET_REPLY, - CTRL_TYPE_SET_REPLY, - CTRL_TYPE_TRAP, - CTRL_TYPE_ERROR -}; - -struct ctrl_connection { - struct llist_head list_entry; - - /* The queue for sending data back */ - struct osmo_wqueue write_queue; - - /* Callback if the connection was closed */ - void (*closed_cb)(struct ctrl_connection *conn); - - /* Pending commands for this connection */ - struct llist_head cmds; -}; - -struct ctrl_cmd { - struct ctrl_connection *ccon; - enum ctrl_type type; - char *id; - void *node; - char *variable; - char *value; - char *reply; -}; - -struct ctrl_cmd_struct { - int nr_commands; - char **command; -}; - -struct ctrl_cmd_element { - const char *name; - const char *param; - struct ctrl_cmd_struct strcmd; - int (*set)(struct ctrl_cmd *cmd, void *data); - int (*get)(struct ctrl_cmd *cmd, void *data); - int (*verify)(struct ctrl_cmd *cmd, const char *value, void *data); -}; - -struct ctrl_cmd_map { - char *cmd; - enum ctrl_type type; -}; - -int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data); -int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd); -int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data); -int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); -struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg); -struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd); -struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd); -struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type); - -#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \ -static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \ -{ \ - dtype *node = data; \ - cmd->reply = talloc_asprintf(cmd, "%i", node->element); \ - if (!cmd->reply) { \ - cmd->reply = "OOM"; \ - return CTRL_CMD_ERROR; \ - } \ - return CTRL_CMD_REPLY; \ -} \ -static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \ -{ \ - dtype *node = data; \ - int tmp = atoi(cmd->value); \ - node->element = tmp; \ - return get_##cmdname(cmd, data); \ -} \ -static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \ -{ \ - int tmp = atoi(value); \ - if ((tmp >= min)&&(tmp <= max)) { \ - return 0; \ - } \ - return -1; \ -} \ -struct ctrl_cmd_element cmd_##cmdname = { \ - .name = cmdstr, \ - .param = NULL, \ - .get = &get_##cmdname, \ - .set = &set_##cmdname, \ - .verify = &verify_##cmdname, \ -} - -#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \ -static int get_##cmdname(struct ctrl_cmd *cmd, dtype *data) \ -{ \ - cmd->reply = talloc_asprintf(cmd, "%s", data->element); \ - if (!cmd->reply) { \ - cmd->reply = "OOM"; \ - return CTRL_CMD_ERROR; \ - } \ - return CTRL_CMD_REPLY; \ -} \ -static int set_##cmdname(struct ctrl_cmd *cmd, dtype *data) \ -{ \ - bsc_replace_string(cmd->node, &data->element, cmd->value); \ - return get_##cmdname(cmd, data); \ -} \ -struct ctrl_cmd_element cmd_##cmdname = { \ - .name = cmdstr, \ - .param = NULL, \ - .get = &get_##cmdname, \ - .set = &set_##cmdname, \ - .verify = NULL, \ -} - -#define CTRL_CMD_DEFINE(cmdname, cmdstr) \ -static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \ -static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \ -static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \ -struct ctrl_cmd_element cmd_##cmdname = { \ - .name = cmdstr, \ - .param = NULL, \ - .get = &get_##cmdname, \ - .set = &set_##cmdname, \ - .verify = &verify_##cmdname, \ -} - -struct gsm_network; -int controlif_setup(struct gsm_network *gsmnet, uint16_t port); - -#endif /* _CONTROL_CMD_H */ diff --git a/openbsc/include/openbsc/crc24.h b/openbsc/include/openbsc/crc24.h deleted file mode 100644 index 756638c..0000000 --- a/openbsc/include/openbsc/crc24.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _CRC24_H -#define _CRC24_H - -#include <stdint.h> - -#define INIT_CRC24 0xffffff - -uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len); - -#endif diff --git a/openbsc/include/openbsc/db.h b/openbsc/include/openbsc/db.h deleted file mode 100644 index d0c85ea..0000000 --- a/openbsc/include/openbsc/db.h +++ /dev/null @@ -1,81 +0,0 @@ -/* (C) 2008 by Jan Luebbe jluebbe@debian.org - * (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef _DB_H -#define _DB_H - -#include "gsm_subscriber.h" - -struct gsm_equipment; -struct gsm_network; -struct gsm_auth_info; -struct gsm_auth_tuple; -struct gsm_sms; -struct gsm_subscriber; - -/* one time initialisation */ -int db_init(const char *name); -int db_prepare(void); -int db_fini(void); - -/* subscriber management */ -struct gsm_subscriber *db_create_subscriber(struct gsm_network *net, - char *imsi); -struct gsm_subscriber *db_get_subscriber(struct gsm_network *net, - enum gsm_subscriber_field field, - const char *subscr); -int db_sync_subscriber(struct gsm_subscriber *subscriber); -int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber); -int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber); -int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t* token); -int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char *imei); -int db_sync_equipment(struct gsm_equipment *equip); -int db_subscriber_update(struct gsm_subscriber *subscriber); - -/* auth info */ -int db_get_authinfo_for_subscr(struct gsm_auth_info *ainfo, - struct gsm_subscriber *subscr); -int db_sync_authinfo_for_subscr(struct gsm_auth_info *ainfo, - struct gsm_subscriber *subscr); -int db_get_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple, - struct gsm_subscriber *subscr); -int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple, - struct gsm_subscriber *subscr); - -/* SMS store-and-forward */ -int db_sms_store(struct gsm_sms *sms); -struct gsm_sms *db_sms_get(struct gsm_network *net, unsigned long long id); -struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, unsigned long long min_id); -struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id, unsigned int failed); -struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr); -int db_sms_mark_sent(struct gsm_sms *sms); -int db_sms_inc_deliver_attempts(struct gsm_sms *sms); - -/* APDU blob storage */ -int db_apdu_blob_store(struct gsm_subscriber *subscr, - uint8_t apdu_id_flags, uint8_t len, - uint8_t *apdu); - -/* Statistics counter storage */ -struct osmo_counter; -int db_store_counter(struct osmo_counter *ctr); -struct rate_ctr_group; -int db_store_rate_ctr_group(struct rate_ctr_group *ctrg); - -#endif /* _DB_H */ diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h deleted file mode 100644 index 43f0ff8..0000000 --- a/openbsc/include/openbsc/debug.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _DEBUG_H -#define _DEBUG_H - -#include <stdio.h> -#include <osmocom/core/linuxlist.h> - -#define DEBUG -#include <osmocom/core/logging.h> - -/* Debug Areas of the code */ -enum { - DRLL, - DCC, - DMM, - DRR, - DRSL, - DNM, - DMNCC, - DSMS, - DPAG, - DMEAS, - DSCCP, - DMSC, - DMGCP, - DHO, - DDB, - DREF, - DGPRS, - DNS, - DBSSGP, - DLLC, - DSNDCP, - DNAT, - DCTRL, - Debug_LastEntry, -}; - -/* context */ -#define BSC_CTX_LCHAN 0 -#define BSC_CTX_SUBSCR 1 -#define BSC_CTX_BTS 2 -#define BSC_CTX_SCCP 3 -#define BSC_CTX_NSVC 4 -#define BSC_CTX_BVC 5 - -/* target */ - -enum { - //DEBUG_FILTER_ALL = 1 << 0, - LOG_FILTER_IMSI = 1 << 1, - LOG_FILTER_NSVC = 1 << 2, - LOG_FILTER_BVC = 1 << 3, -}; - -/* we don't need a header dependency for this... */ -struct gprs_nsvc; -struct bssgp_bvc_ctx; - -void log_set_imsi_filter(struct log_target *target, const char *imsi); -void log_set_nsvc_filter(struct log_target *target, - struct gprs_nsvc *nsvc); -void log_set_bvc_filter(struct log_target *target, - struct bssgp_bvc_ctx *bctx); - -extern const struct log_info log_info; - -#endif /* _DEBUG_H */ diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h deleted file mode 100644 index c0cdcbf..0000000 --- a/openbsc/include/openbsc/gb_proxy.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _GB_PROXY_H -#define _GB_PROXY_H - - -#include <osmocom/core/msgb.h> - -#include <openbsc/gprs_ns.h> -#include <osmocom/vty/command.h> - -struct gbproxy_config { - /* parsed from config file */ - uint16_t nsip_sgsn_nsei; - - /* misc */ - struct gprs_ns_inst *nsi; -}; - -extern struct gbproxy_config gbcfg; -extern struct cmd_element show_gbproxy_cmd; - -/* gb_proxy_vty .c */ - -int gbproxy_vty_init(void); -int gbproxy_parse_config(const char *config_file, struct gbproxy_config *cfg); - - -/* gb_proxy.c */ - -/* Main input function for Gb proxy */ -int gbprox_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci); - -int gbprox_signal(unsigned int subsys, unsigned int signal, - void *handler_data, void *signal_data); - -/* Reset all persistent NS-VC's */ -int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi); - -#endif diff --git a/openbsc/include/openbsc/gprs/crc24.h b/openbsc/include/openbsc/gprs/crc24.h new file mode 100644 index 0000000..756638c --- /dev/null +++ b/openbsc/include/openbsc/gprs/crc24.h @@ -0,0 +1,10 @@ +#ifndef _CRC24_H +#define _CRC24_H + +#include <stdint.h> + +#define INIT_CRC24 0xffffff + +uint32_t crc24_calc(uint32_t fcs, uint8_t *cp, unsigned int len); + +#endif diff --git a/openbsc/include/openbsc/gprs/gb_proxy.h b/openbsc/include/openbsc/gprs/gb_proxy.h new file mode 100644 index 0000000..c0cdcbf --- /dev/null +++ b/openbsc/include/openbsc/gprs/gb_proxy.h @@ -0,0 +1,38 @@ +#ifndef _GB_PROXY_H +#define _GB_PROXY_H + + +#include <osmocom/core/msgb.h> + +#include <openbsc/gprs_ns.h> +#include <osmocom/vty/command.h> + +struct gbproxy_config { + /* parsed from config file */ + uint16_t nsip_sgsn_nsei; + + /* misc */ + struct gprs_ns_inst *nsi; +}; + +extern struct gbproxy_config gbcfg; +extern struct cmd_element show_gbproxy_cmd; + +/* gb_proxy_vty .c */ + +int gbproxy_vty_init(void); +int gbproxy_parse_config(const char *config_file, struct gbproxy_config *cfg); + + +/* gb_proxy.c */ + +/* Main input function for Gb proxy */ +int gbprox_rcvmsg(struct msgb *msg, struct gprs_nsvc *nsvc, uint16_t ns_bvci); + +int gbprox_signal(unsigned int subsys, unsigned int signal, + void *handler_data, void *signal_data); + +/* Reset all persistent NS-VC's */ +int gbprox_reset_persistent_nsvcs(struct gprs_ns_inst *nsi); + +#endif diff --git a/openbsc/include/openbsc/gprs/gprs_gmm.h b/openbsc/include/openbsc/gprs/gprs_gmm.h new file mode 100644 index 0000000..f6b3e5e --- /dev/null +++ b/openbsc/include/openbsc/gprs/gprs_gmm.h @@ -0,0 +1,19 @@ +#ifndef _GPRS_GMM_H +#define _GPRS_GMM_H + +#include <osmocom/core/msgb.h> +#include <openbsc/gprs_sgsn.h> + +int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause); +int gsm48_tx_gsm_act_pdp_rej(struct sgsn_mm_ctx *mm, uint8_t tid, + uint8_t cause, uint8_t pco_len, uint8_t *pco_v); +int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp); +int gsm48_tx_gsm_deact_pdp_acc(struct sgsn_pdp_ctx *pdp); + +int gsm0408_gprs_rcvmsg(struct msgb *msg, struct gprs_llc_llme *llme); + +int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli); +int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli, + uint8_t suspend_ref); + +#endif /* _GPRS_GMM_H */ diff --git a/openbsc/include/openbsc/gprs/gprs_llc.h b/openbsc/include/openbsc/gprs/gprs_llc.h new file mode 100644 index 0000000..9f17605 --- /dev/null +++ b/openbsc/include/openbsc/gprs/gprs_llc.h @@ -0,0 +1,162 @@ +#ifndef _GPRS_LLC_H +#define _GPRS_LLC_H + +#include <stdint.h> +#include <openbsc/gprs_sgsn.h> + +/* Section 4.7 LLC Layer Structure */ +enum gprs_llc_sapi { + GPRS_SAPI_GMM = 1, + GPRS_SAPI_TOM2 = 2, + GPRS_SAPI_SNDCP3 = 3, + GPRS_SAPI_SNDCP5 = 5, + GPRS_SAPI_SMS = 7, + GPRS_SAPI_TOM8 = 8, + GPRS_SAPI_SNDCP9 = 9, + GPRS_SAPI_SNDCP11 = 11, +}; + +/* Section 6.4 Commands and Responses */ +enum gprs_llc_u_cmd { + GPRS_LLC_U_DM_RESP = 0x01, + GPRS_LLC_U_DISC_CMD = 0x04, + GPRS_LLC_U_UA_RESP = 0x06, + GPRS_LLC_U_SABM_CMD = 0x07, + GPRS_LLC_U_FRMR_RESP = 0x08, + GPRS_LLC_U_XID = 0x0b, + GPRS_LLC_U_NULL_CMD = 0x00, +}; + +/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ +/* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ +enum gprs_llc_primitive { + /* GMM <-> LLME */ + LLGMM_ASSIGN_REQ, /* GMM tells us new TLLI: TLLI old, TLLI new, Kc, CiphAlg */ + LLGMM_RESET_REQ, /* GMM tells us to perform XID negotiation: TLLI */ + LLGMM_RESET_CNF, /* LLC informs GMM that XID has completed: TLLI */ + LLGMM_SUSPEND_REQ, /* GMM tells us MS has suspended: TLLI, Page */ + LLGMM_RESUME_REQ, /* GMM tells us MS has resumed: TLLI */ + LLGMM_PAGE_IND, /* LLC asks GMM to page MS: TLLI */ + LLGMM_IOV_REQ, /* GMM tells us to perform XID: TLLI */ + LLGMM_STATUS_IND, /* LLC informs GMM about error: TLLI, Cause */ + /* LLE <-> (GMM/SNDCP/SMS/TOM) */ + LL_RESET_IND, /* TLLI */ + LL_ESTABLISH_REQ, /* TLLI, XID Req */ + LL_ESTABLISH_IND, /* TLLI, XID Req, N201-I, N201-U */ + LL_ESTABLISH_RESP, /* TLLI, XID Negotiated */ + LL_ESTABLISH_CONF, /* TLLI, XID Neg, N201-i, N201-U */ + LL_RELEASE_REQ, /* TLLI, Local */ + LL_RELEASE_IND, /* TLLI, Cause */ + LL_RELEASE_CONF, /* TLLI */ + LL_XID_REQ, /* TLLI, XID Requested */ + LL_XID_IND, /* TLLI, XID Req, N201-I, N201-U */ + LL_XID_RESP, /* TLLI, XID Negotiated */ + LL_XID_CONF, /* TLLI, XID Neg, N201-I, N201-U */ + LL_DATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */ + LL_DATA_IND, /* TLLI, SN-PDU */ + LL_DATA_CONF, /* TLLI, Ref */ + LL_UNITDATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */ + LL_UNITDATA_IND, /* TLLI, SN-PDU */ + LL_STATUS_IND, /* TLLI, Cause */ +}; + +/* Section 4.5.2 Logical Link States + Annex C.2 */ +enum gprs_llc_lle_state { + GPRS_LLES_UNASSIGNED = 1, /* No TLLI yet */ + GPRS_LLES_ASSIGNED_ADM = 2, /* TLLI assigned */ + GPRS_LLES_LOCAL_EST = 3, /* Local Establishment */ + GPRS_LLES_REMOTE_EST = 4, /* Remote Establishment */ + GPRS_LLES_ABM = 5, + GPRS_LLES_LOCAL_REL = 6, /* Local Release */ + GPRS_LLES_TIMER_REC = 7, /* Timer Recovery */ +}; + +enum gprs_llc_llme_state { + GPRS_LLMS_UNASSIGNED = 1, /* No TLLI yet */ + GPRS_LLMS_ASSIGNED = 2, /* TLLI assigned */ +}; + +/* Section 8.9.9 LLC layer parameter default values */ +struct gprs_llc_params { + uint16_t iov_i_exp; + uint16_t t200_201; + uint16_t n200; + uint16_t n201_u; + uint16_t n201_i; + uint16_t mD; + uint16_t mU; + uint16_t kD; + uint16_t kU; +}; + +/* Section 4.7.1: Logical Link Entity: One per DLCI (TLLI + SAPI) */ +struct gprs_llc_lle { + struct llist_head list; + + uint32_t sapi; + + struct gprs_llc_llme *llme; + + enum gprs_llc_lle_state state; + + struct osmo_timer_list t200; + struct osmo_timer_list t201; /* wait for acknowledgement */ + + uint16_t v_sent; + uint16_t v_ack; + uint16_t v_recv; + + uint16_t vu_send; + uint16_t vu_recv; + + /* Overflow Counter for ABM */ + uint32_t oc_i_send; + uint32_t oc_i_recv; + + /* Overflow Counter for unconfirmed transfer */ + uint32_t oc_ui_send; + uint32_t oc_ui_recv; + + unsigned int retrans_ctr; + + struct gprs_llc_params params; +}; + +#define NUM_SAPIS 16 + +struct gprs_llc_llme { + struct llist_head list; + + enum gprs_llc_llme_state state; + + uint32_t tlli; + uint32_t old_tlli; + + /* Crypto parameters */ + enum gprs_ciph_algo algo; + uint8_t kc[8]; + + /* over which BSSGP BTS ctx do we need to transmit */ + uint16_t bvci; + uint16_t nsei; + struct gprs_llc_lle lle[NUM_SAPIS]; +}; + +extern struct llist_head gprs_llc_llmes; + +/* BSSGP-UL-UNITDATA.ind */ +int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv); + +/* LL-UNITDATA.req */ +int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command, + void *mmctx); + +/* 04.64 Chapter 7.2.1.1 LLGMM-ASSIGN */ +int gprs_llgmm_assign(struct gprs_llc_llme *llme, + uint32_t old_tlli, uint32_t new_tlli, + enum gprs_ciph_algo alg, const uint8_t *kc); + +int gprs_llc_init(const char *cipher_plugin_path); +int gprs_llc_vty_init(void); + +#endif diff --git a/openbsc/include/openbsc/gprs/gprs_sgsn.h b/openbsc/include/openbsc/gprs/gprs_sgsn.h new file mode 100644 index 0000000..62fbb85 --- /dev/null +++ b/openbsc/include/openbsc/gprs/gprs_sgsn.h @@ -0,0 +1,220 @@ +#ifndef _GPRS_SGSN_H +#define _GPRS_SGSN_H + +#include <stdint.h> +#include <netinet/in.h> + +#include <osmocom/gsm/gsm48.h> + +#include <osmocom/crypt/gprs_cipher.h> + +#define GSM_IMSI_LENGTH 17 +#define GSM_IMEI_LENGTH 17 +#define GSM_EXTENSION_LENGTH 15 + +struct gprs_llc_lle; + +/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */ +enum gprs_mm_state { + GMM_DEREGISTERED, /* 4.1.3.3.1.1 */ + GMM_COMMON_PROC_INIT, /* 4.1.3.3.1.2 */ + GMM_REGISTERED_NORMAL, /* 4.1.3.3.2.1 */ + GMM_REGISTERED_SUSPENDED, /* 4.1.3.3.2.2 */ + GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */ +}; + +enum gprs_mm_ctr { + GMM_CTR_PKTS_SIG_IN, + GMM_CTR_PKTS_SIG_OUT, + GMM_CTR_PKTS_UDATA_IN, + GMM_CTR_PKTS_UDATA_OUT, + GMM_CTR_BYTES_UDATA_IN, + GMM_CTR_BYTES_UDATA_OUT, + GMM_CTR_PDP_CTX_ACT, + GMM_CTR_SUSPEND, + GMM_CTR_PAGING_PS, + GMM_CTR_PAGING_CS, + GMM_CTR_RA_UPDATE, +}; + +enum gprs_pdp_ctx { + PDP_CTR_PKTS_UDATA_IN, + PDP_CTR_PKTS_UDATA_OUT, + PDP_CTR_BYTES_UDATA_IN, + PDP_CTR_BYTES_UDATA_OUT, +}; + +enum gprs_t3350_mode { + GMM_T3350_MODE_ATT, + GMM_T3350_MODE_RAU, + GMM_T3350_MODE_PTMSI_REALL, +}; + +#define MS_RADIO_ACCESS_CAPA + +/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */ +/* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */ +struct sgsn_mm_ctx { + struct llist_head list; + + char imsi[GSM_IMSI_LENGTH]; + enum gprs_mm_state mm_state; + uint32_t p_tmsi; + uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */ + uint32_t p_tmsi_sig; + char imei[GSM_IMEI_LENGTH]; + /* Opt: Software Version Numbber / TS 23.195 */ + char msisdn[GSM_EXTENSION_LENGTH]; + struct gprs_ra_id ra; + uint16_t cell_id; + uint32_t cell_id_age; + uint16_t sac; /* Iu: Service Area Code */ + uint32_t sac_age;/* Iu: Service Area Code age */ + /* VLR number */ + uint32_t new_sgsn_addr; + /* Authentication Triplets */ + /* Kc */ + /* Iu: CK, IK, KSI */ + /* CKSN */ + enum gprs_ciph_algo ciph_algo; + struct { + uint8_t buf[52]; /* 10.5.5.12a */ + uint8_t len; + } ms_radio_access_capa; + struct { + uint8_t buf[4]; /* 10.5.5.12 */ + uint8_t len; + } ms_network_capa; + uint16_t drx_parms; + int mnrg; /* MS reported to HLR? */ + int ngaf; /* MS reported to MSC/VLR? */ + int ppf; /* paging for GPRS + non-GPRS? */ + /* SMS Parameters */ + int recovery; + uint8_t radio_prio_sms; + + struct llist_head pdp_list; + + /* Additional bits not present in the GSM TS */ + struct gprs_llc_llme *llme; + uint32_t tlli; + uint32_t tlli_new; + uint16_t nsei; + uint16_t bvci; + struct rate_ctr_group *ctrg; + struct osmo_timer_list timer; + unsigned int T; /* Txxxx number */ + unsigned int num_T_exp; /* number of consecutive T expirations */ + + enum gprs_t3350_mode t3350_mode; + uint8_t t3370_id_type; +}; + +/* look-up a SGSN MM context based on TLLI + RAI */ +struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, + const struct gprs_ra_id *raid); +struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi); +struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi); + +/* Allocate a new SGSN MM context */ +struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli, + const struct gprs_ra_id *raid); +void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm); + + +enum pdp_ctx_state { + PDP_STATE_NONE, + PDP_STATE_CR_REQ, + PDP_STATE_CR_CONF, + + /* 04.08 / Figure 6.2 / 6.1.2.2 */ + PDP_STATE_INACT_PEND, + PDP_STATE_INACTIVE = PDP_STATE_NONE, +}; + +enum pdp_type { + PDP_TYPE_NONE, + PDP_TYPE_ETSI_PPP, + PDP_TYPE_IANA_IPv4, + PDP_TYPE_IANA_IPv6, +}; + +struct sgsn_pdp_ctx { + struct llist_head list; /* list_head for mmctx->pdp_list */ + struct llist_head g_list; /* list_head for global list */ + struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */ + struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */ + struct rate_ctr_group *ctrg; + + //unsigned int id; + struct pdp_t *lib; /* pointer to libgtp PDP ctx */ + enum pdp_ctx_state state; + enum pdp_type type; + uint32_t address; + char *apn_subscribed; + //char *apn_used; + uint16_t nsapi; /* SNDCP */ + uint16_t sapi; /* LLC */ + uint8_t ti; /* transaction identifier */ + int vplmn_allowed; + uint32_t qos_profile_subscr; + //uint32_t qos_profile_req; + //uint32_t qos_profile_neg; + uint8_t radio_prio; + uint32_t tx_npdu_nr; + uint32_t rx_npdu_nr; + uint32_t tx_gtp_snd; + uint32_t rx_gtp_snu; + //uint32_t charging_id; + int reordering_reqd; + + struct osmo_timer_list timer; + unsigned int T; /* Txxxx number */ + unsigned int num_T_exp; /* number of consecutive T expirations */ +}; + + +/* look up PDP context by MM context and NSAPI */ +struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm, + uint8_t nsapi); +/* look up PDP context by MM context and transaction ID */ +struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm, + uint8_t tid); + +struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, + uint8_t nsapi); +void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp); + + +struct sgsn_ggsn_ctx { + struct llist_head list; + uint32_t id; + unsigned int gtp_version; + struct in_addr remote_addr; + int remote_restart_ctr; + struct gsn_t *gsn; +}; +struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id); +struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id); +struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr); +struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id); + +struct apn_ctx { + struct llist_head list; + struct sgsn_ggsn_ctx *ggsn; + char *name; + char *description; +}; + +extern struct llist_head sgsn_mm_ctxts; +extern struct llist_head sgsn_ggsn_ctxts; +extern struct llist_head sgsn_apn_ctxts; +extern struct llist_head sgsn_pdp_ctxts; + +uint32_t sgsn_alloc_ptmsi(void); + +/* High-level function to be called in case a GGSN has disappeared or + * ottherwise lost state (recovery procedure) */ +int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); + +#endif /* _GPRS_SGSN_H */ diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/openbsc/gprs_bssgp.h deleted file mode 100644 index cef4c30..0000000 --- a/openbsc/include/openbsc/gprs_bssgp.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef _GPRS_BSSGP_H -#define _GPRS_BSSGP_H - -#include <stdint.h> - -/* Section 5.4.1 */ -#define BVCI_SIGNALLING 0x0000 -#define BVCI_PTM 0x0001 - -/* Section 11.3.26 / Table 11.27 */ -enum bssgp_pdu_type { - /* PDUs between RL and BSSGP SAPs */ - BSSGP_PDUT_DL_UNITDATA = 0x00, - BSSGP_PDUT_UL_UNITDATA = 0x01, - BSSGP_PDUT_RA_CAPABILITY = 0x02, - BSSGP_PDUT_PTM_UNITDATA = 0x03, - /* PDUs between GMM SAPs */ - BSSGP_PDUT_PAGING_PS = 0x06, - BSSGP_PDUT_PAGING_CS = 0x07, - BSSGP_PDUT_RA_CAPA_UDPATE = 0x08, - BSSGP_PDUT_RA_CAPA_UPDATE_ACK = 0x09, - BSSGP_PDUT_RADIO_STATUS = 0x0a, - BSSGP_PDUT_SUSPEND = 0x0b, - BSSGP_PDUT_SUSPEND_ACK = 0x0c, - BSSGP_PDUT_SUSPEND_NACK = 0x0d, - BSSGP_PDUT_RESUME = 0x0e, - BSSGP_PDUT_RESUME_ACK = 0x0f, - BSSGP_PDUT_RESUME_NACK = 0x10, - /* PDus between NM SAPs */ - BSSGP_PDUT_BVC_BLOCK = 0x20, - BSSGP_PDUT_BVC_BLOCK_ACK = 0x21, - BSSGP_PDUT_BVC_RESET = 0x22, - BSSGP_PDUT_BVC_RESET_ACK = 0x23, - BSSGP_PDUT_BVC_UNBLOCK = 0x24, - BSSGP_PDUT_BVC_UNBLOCK_ACK = 0x25, - BSSGP_PDUT_FLOW_CONTROL_BVC = 0x26, - BSSGP_PDUT_FLOW_CONTROL_BVC_ACK = 0x27, - BSSGP_PDUT_FLOW_CONTROL_MS = 0x28, - BSSGP_PDUT_FLOW_CONTROL_MS_ACK = 0x29, - BSSGP_PDUT_FLUSH_LL = 0x2a, - BSSGP_PDUT_FLUSH_LL_ACK = 0x2b, - BSSGP_PDUT_LLC_DISCARD = 0x2c, - BSSGP_PDUT_SGSN_INVOKE_TRACE = 0x40, - BSSGP_PDUT_STATUS = 0x41, - /* PDUs between PFM SAP's */ - BSSGP_PDUT_DOWNLOAD_BSS_PFC = 0x50, - BSSGP_PDUT_CREATE_BSS_PFC = 0x51, - BSSGP_PDUT_CREATE_BSS_PFC_ACK = 0x52, - BSSGP_PDUT_CREATE_BSS_PFC_NACK = 0x53, - BSSGP_PDUT_MODIFY_BSS_PFC = 0x54, - BSSGP_PDUT_MODIFY_BSS_PFC_ACK = 0x55, - BSSGP_PDUT_DELETE_BSS_PFC = 0x56, - BSSGP_PDUT_DELETE_BSS_PFC_ACK = 0x57, -}; - -/* Section 10.2.1 and 10.2.2 */ -struct bssgp_ud_hdr { - uint8_t pdu_type; - uint32_t tlli; - uint8_t qos_profile[3]; - uint8_t data[0]; /* TLV's */ -} __attribute__((packed)); - -struct bssgp_normal_hdr { - uint8_t pdu_type; - uint8_t data[0]; /* TLV's */ -}; - -enum bssgp_iei_type { - BSSGP_IE_ALIGNMENT = 0x00, - BSSGP_IE_BMAX_DEFAULT_MS = 0x01, - BSSGP_IE_BSS_AREA_ID = 0x02, - BSSGP_IE_BUCKET_LEAK_RATE = 0x03, - BSSGP_IE_BVCI = 0x04, - BSSGP_IE_BVC_BUCKET_SIZE = 0x05, - BSSGP_IE_BVC_MEASUREMENT = 0x06, - BSSGP_IE_CAUSE = 0x07, - BSSGP_IE_CELL_ID = 0x08, - BSSGP_IE_CHAN_NEEDED = 0x09, - BSSGP_IE_DRX_PARAMS = 0x0a, - BSSGP_IE_EMLPP_PRIO = 0x0b, - BSSGP_IE_FLUSH_ACTION = 0x0c, - BSSGP_IE_IMSI = 0x0d, - BSSGP_IE_LLC_PDU = 0x0e, - BSSGP_IE_LLC_FRAMES_DISCARDED = 0x0f, - BSSGP_IE_LOCATION_AREA = 0x10, - BSSGP_IE_MOBILE_ID = 0x11, - BSSGP_IE_MS_BUCKET_SIZE = 0x12, - BSSGP_IE_MS_RADIO_ACCESS_CAP = 0x13, - BSSGP_IE_OMC_ID = 0x14, - BSSGP_IE_PDU_IN_ERROR = 0x15, - BSSGP_IE_PDU_LIFETIME = 0x16, - BSSGP_IE_PRIORITY = 0x17, - BSSGP_IE_QOS_PROFILE = 0x18, - BSSGP_IE_RADIO_CAUSE = 0x19, - BSSGP_IE_RA_CAP_UPD_CAUSE = 0x1a, - BSSGP_IE_ROUTEING_AREA = 0x1b, - BSSGP_IE_R_DEFAULT_MS = 0x1c, - BSSGP_IE_SUSPEND_REF_NR = 0x1d, - BSSGP_IE_TAG = 0x1e, - BSSGP_IE_TLLI = 0x1f, - BSSGP_IE_TMSI = 0x20, - BSSGP_IE_TRACE_REFERENC = 0x21, - BSSGP_IE_TRACE_TYPE = 0x22, - BSSGP_IE_TRANSACTION_ID = 0x23, - BSSGP_IE_TRIGGER_ID = 0x24, - BSSGP_IE_NUM_OCT_AFF = 0x25, - BSSGP_IE_LSA_ID_LIST = 0x26, - BSSGP_IE_LSA_INFORMATION = 0x27, - BSSGP_IE_PACKET_FLOW_ID = 0x28, - BSSGP_IE_PACKET_FLOW_TIMER = 0x29, - BSSGP_IE_AGG_BSS_QOS_PROFILE = 0x3a, - BSSGP_IE_FEATURE_BITMAP = 0x3b, - BSSGP_IE_BUCKET_FULL_RATIO = 0x3c, - BSSGP_IE_SERVICE_UTRAN_CCO = 0x3d, -}; - -/* Section 11.3.8 / Table 11.10: Cause coding */ -enum gprs_bssgp_cause { - BSSGP_CAUSE_PROC_OVERLOAD = 0x00, - BSSGP_CAUSE_EQUIP_FAIL = 0x01, - BSSGP_CAUSE_TRASIT_NET_FAIL = 0x02, - BSSGP_CAUSE_CAPA_GREATER_0KPBS = 0x03, - BSSGP_CAUSE_UNKNOWN_MS = 0x04, - BSSGP_CAUSE_UNKNOWN_BVCI = 0x05, - BSSGP_CAUSE_CELL_TRAF_CONG = 0x06, - BSSGP_CAUSE_SGSN_CONG = 0x07, - BSSGP_CAUSE_OML_INTERV = 0x08, - BSSGP_CAUSE_BVCI_BLOCKED = 0x09, - BSSGP_CAUSE_PFC_CREATE_FAIL = 0x0a, - BSSGP_CAUSE_SEM_INCORR_PDU = 0x20, - BSSGP_CAUSE_INV_MAND_INF = 0x21, - BSSGP_CAUSE_MISSING_MAND_IE = 0x22, - BSSGP_CAUSE_MISSING_COND_IE = 0x23, - BSSGP_CAUSE_UNEXP_COND_IE = 0x24, - BSSGP_CAUSE_COND_IE_ERR = 0x25, - BSSGP_CAUSE_PDU_INCOMP_STATE = 0x26, - BSSGP_CAUSE_PROTO_ERR_UNSPEC = 0x27, - BSSGP_CAUSE_PDU_INCOMP_FEAT = 0x28, -}; - -/* Our implementation */ - -/* gprs_bssgp_util.c */ -extern struct gprs_ns_inst *bssgp_nsi; -struct msgb *bssgp_msgb_alloc(void); -const char *bssgp_cause_str(enum gprs_bssgp_cause cause); -/* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */ -int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei, - uint16_t bvci, uint16_t ns_bvci); -/* Chapter 10.4.14: Status */ -int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg); - -/* gprs_bssgp.c */ - -#define BVC_S_BLOCKED 0x0001 - -/* The per-BTS context that we keep on the SGSN side of the BSSGP link */ -struct bssgp_bvc_ctx { - struct llist_head list; - - /* parsed RA ID and Cell ID of the remote BTS */ - struct gprs_ra_id ra_id; - uint16_t cell_id; - - /* NSEI and BVCI of underlying Gb link. Together they - * uniquely identify a link to a BTS (5.4.4) */ - uint16_t bvci; - uint16_t nsei; - - uint32_t state; - - struct rate_ctr_group *ctrg; - - /* we might want to add this as a shortcut later, avoiding the NSVC - * lookup for every packet, similar to a routing cache */ - //struct gprs_nsvc *nsvc; -}; -extern struct llist_head bssgp_bvc_ctxts; -/* Find a BTS Context based on parsed RA ID and Cell ID */ -struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid); -/* Find a BTS context based on BVCI+NSEI tuple */ -struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei); - -#include <osmocom/gsm/tlv.h> - -/* BSSGP-UL-UNITDATA.ind */ -int gprs_bssgp_rcvmsg(struct msgb *msg); - -/* BSSGP-DL-UNITDATA.req */ -struct sgsn_mm_ctx; -int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx); - -uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf); - -/* Wrapper around TLV parser to parse BSSGP IEs */ -static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len) -{ - return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0); -} - -enum bssgp_paging_mode { - BSSGP_PAGING_PS, - BSSGP_PAGING_CS, -}; - -enum bssgp_paging_scope { - BSSGP_PAGING_BSS_AREA, /* all cells in BSS */ - BSSGP_PAGING_LOCATION_AREA, /* all cells in LA */ - BSSGP_PAGING_ROUTEING_AREA, /* all cells in RA */ - BSSGP_PAGING_BVCI, /* one cell */ -}; - -struct bssgp_paging_info { - enum bssgp_paging_mode mode; - enum bssgp_paging_scope scope; - struct gprs_ra_id raid; - uint16_t bvci; - const char *imsi; - uint32_t *ptmsi; - uint16_t drx_params; - uint8_t qos[3]; -}; - -/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */ -int gprs_bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci, - struct bssgp_paging_info *pinfo); - -/* gprs_bssgp_vty.c */ -int gprs_bssgp_vty_init(void); - -#endif /* _GPRS_BSSGP_H */ diff --git a/openbsc/include/openbsc/gprs_gmm.h b/openbsc/include/openbsc/gprs_gmm.h deleted file mode 100644 index f6b3e5e..0000000 --- a/openbsc/include/openbsc/gprs_gmm.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _GPRS_GMM_H -#define _GPRS_GMM_H - -#include <osmocom/core/msgb.h> -#include <openbsc/gprs_sgsn.h> - -int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause); -int gsm48_tx_gsm_act_pdp_rej(struct sgsn_mm_ctx *mm, uint8_t tid, - uint8_t cause, uint8_t pco_len, uint8_t *pco_v); -int gsm48_tx_gsm_act_pdp_acc(struct sgsn_pdp_ctx *pdp); -int gsm48_tx_gsm_deact_pdp_acc(struct sgsn_pdp_ctx *pdp); - -int gsm0408_gprs_rcvmsg(struct msgb *msg, struct gprs_llc_llme *llme); - -int gprs_gmm_rx_suspend(struct gprs_ra_id *raid, uint32_t tlli); -int gprs_gmm_rx_resume(struct gprs_ra_id *raid, uint32_t tlli, - uint8_t suspend_ref); - -#endif /* _GPRS_GMM_H */ diff --git a/openbsc/include/openbsc/gprs_llc.h b/openbsc/include/openbsc/gprs_llc.h deleted file mode 100644 index 9f17605..0000000 --- a/openbsc/include/openbsc/gprs_llc.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef _GPRS_LLC_H -#define _GPRS_LLC_H - -#include <stdint.h> -#include <openbsc/gprs_sgsn.h> - -/* Section 4.7 LLC Layer Structure */ -enum gprs_llc_sapi { - GPRS_SAPI_GMM = 1, - GPRS_SAPI_TOM2 = 2, - GPRS_SAPI_SNDCP3 = 3, - GPRS_SAPI_SNDCP5 = 5, - GPRS_SAPI_SMS = 7, - GPRS_SAPI_TOM8 = 8, - GPRS_SAPI_SNDCP9 = 9, - GPRS_SAPI_SNDCP11 = 11, -}; - -/* Section 6.4 Commands and Responses */ -enum gprs_llc_u_cmd { - GPRS_LLC_U_DM_RESP = 0x01, - GPRS_LLC_U_DISC_CMD = 0x04, - GPRS_LLC_U_UA_RESP = 0x06, - GPRS_LLC_U_SABM_CMD = 0x07, - GPRS_LLC_U_FRMR_RESP = 0x08, - GPRS_LLC_U_XID = 0x0b, - GPRS_LLC_U_NULL_CMD = 0x00, -}; - -/* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ -/* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ -enum gprs_llc_primitive { - /* GMM <-> LLME */ - LLGMM_ASSIGN_REQ, /* GMM tells us new TLLI: TLLI old, TLLI new, Kc, CiphAlg */ - LLGMM_RESET_REQ, /* GMM tells us to perform XID negotiation: TLLI */ - LLGMM_RESET_CNF, /* LLC informs GMM that XID has completed: TLLI */ - LLGMM_SUSPEND_REQ, /* GMM tells us MS has suspended: TLLI, Page */ - LLGMM_RESUME_REQ, /* GMM tells us MS has resumed: TLLI */ - LLGMM_PAGE_IND, /* LLC asks GMM to page MS: TLLI */ - LLGMM_IOV_REQ, /* GMM tells us to perform XID: TLLI */ - LLGMM_STATUS_IND, /* LLC informs GMM about error: TLLI, Cause */ - /* LLE <-> (GMM/SNDCP/SMS/TOM) */ - LL_RESET_IND, /* TLLI */ - LL_ESTABLISH_REQ, /* TLLI, XID Req */ - LL_ESTABLISH_IND, /* TLLI, XID Req, N201-I, N201-U */ - LL_ESTABLISH_RESP, /* TLLI, XID Negotiated */ - LL_ESTABLISH_CONF, /* TLLI, XID Neg, N201-i, N201-U */ - LL_RELEASE_REQ, /* TLLI, Local */ - LL_RELEASE_IND, /* TLLI, Cause */ - LL_RELEASE_CONF, /* TLLI */ - LL_XID_REQ, /* TLLI, XID Requested */ - LL_XID_IND, /* TLLI, XID Req, N201-I, N201-U */ - LL_XID_RESP, /* TLLI, XID Negotiated */ - LL_XID_CONF, /* TLLI, XID Neg, N201-I, N201-U */ - LL_DATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */ - LL_DATA_IND, /* TLLI, SN-PDU */ - LL_DATA_CONF, /* TLLI, Ref */ - LL_UNITDATA_REQ, /* TLLI, SN-PDU, Ref, QoS, Radio Prio, Ciph */ - LL_UNITDATA_IND, /* TLLI, SN-PDU */ - LL_STATUS_IND, /* TLLI, Cause */ -}; - -/* Section 4.5.2 Logical Link States + Annex C.2 */ -enum gprs_llc_lle_state { - GPRS_LLES_UNASSIGNED = 1, /* No TLLI yet */ - GPRS_LLES_ASSIGNED_ADM = 2, /* TLLI assigned */ - GPRS_LLES_LOCAL_EST = 3, /* Local Establishment */ - GPRS_LLES_REMOTE_EST = 4, /* Remote Establishment */ - GPRS_LLES_ABM = 5, - GPRS_LLES_LOCAL_REL = 6, /* Local Release */ - GPRS_LLES_TIMER_REC = 7, /* Timer Recovery */ -}; - -enum gprs_llc_llme_state { - GPRS_LLMS_UNASSIGNED = 1, /* No TLLI yet */ - GPRS_LLMS_ASSIGNED = 2, /* TLLI assigned */ -}; - -/* Section 8.9.9 LLC layer parameter default values */ -struct gprs_llc_params { - uint16_t iov_i_exp; - uint16_t t200_201; - uint16_t n200; - uint16_t n201_u; - uint16_t n201_i; - uint16_t mD; - uint16_t mU; - uint16_t kD; - uint16_t kU; -}; - -/* Section 4.7.1: Logical Link Entity: One per DLCI (TLLI + SAPI) */ -struct gprs_llc_lle { - struct llist_head list; - - uint32_t sapi; - - struct gprs_llc_llme *llme; - - enum gprs_llc_lle_state state; - - struct osmo_timer_list t200; - struct osmo_timer_list t201; /* wait for acknowledgement */ - - uint16_t v_sent; - uint16_t v_ack; - uint16_t v_recv; - - uint16_t vu_send; - uint16_t vu_recv; - - /* Overflow Counter for ABM */ - uint32_t oc_i_send; - uint32_t oc_i_recv; - - /* Overflow Counter for unconfirmed transfer */ - uint32_t oc_ui_send; - uint32_t oc_ui_recv; - - unsigned int retrans_ctr; - - struct gprs_llc_params params; -}; - -#define NUM_SAPIS 16 - -struct gprs_llc_llme { - struct llist_head list; - - enum gprs_llc_llme_state state; - - uint32_t tlli; - uint32_t old_tlli; - - /* Crypto parameters */ - enum gprs_ciph_algo algo; - uint8_t kc[8]; - - /* over which BSSGP BTS ctx do we need to transmit */ - uint16_t bvci; - uint16_t nsei; - struct gprs_llc_lle lle[NUM_SAPIS]; -}; - -extern struct llist_head gprs_llc_llmes; - -/* BSSGP-UL-UNITDATA.ind */ -int gprs_llc_rcvmsg(struct msgb *msg, struct tlv_parsed *tv); - -/* LL-UNITDATA.req */ -int gprs_llc_tx_ui(struct msgb *msg, uint8_t sapi, int command, - void *mmctx); - -/* 04.64 Chapter 7.2.1.1 LLGMM-ASSIGN */ -int gprs_llgmm_assign(struct gprs_llc_llme *llme, - uint32_t old_tlli, uint32_t new_tlli, - enum gprs_ciph_algo alg, const uint8_t *kc); - -int gprs_llc_init(const char *cipher_plugin_path); -int gprs_llc_vty_init(void); - -#endif diff --git a/openbsc/include/openbsc/gprs_ns.h b/openbsc/include/openbsc/gprs_ns.h deleted file mode 100644 index 8f28d46..0000000 --- a/openbsc/include/openbsc/gprs_ns.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef _GPRS_NS_H -#define _GPRS_NS_H - -#include <stdint.h> - -/* GPRS Networks Service (NS) messages on the Gb interface - * 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) - * 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */ - -struct gprs_ns_hdr { - uint8_t pdu_type; - uint8_t data[0]; -} __attribute__((packed)); - -/* TS 08.16, Section 10.3.7, Table 14 */ -enum ns_pdu_type { - NS_PDUT_UNITDATA = 0x00, - NS_PDUT_RESET = 0x02, - NS_PDUT_RESET_ACK = 0x03, - NS_PDUT_BLOCK = 0x04, - NS_PDUT_BLOCK_ACK = 0x05, - NS_PDUT_UNBLOCK = 0x06, - NS_PDUT_UNBLOCK_ACK = 0x07, - NS_PDUT_STATUS = 0x08, - NS_PDUT_ALIVE = 0x0a, - NS_PDUT_ALIVE_ACK = 0x0b, - /* TS 48.016 Section 10.3.7, Table 10.3.7.1 */ - SNS_PDUT_ACK = 0x0c, - SNS_PDUT_ADD = 0x0d, - SNS_PDUT_CHANGE_WEIGHT = 0x0e, - SNS_PDUT_CONFIG = 0x0f, - SNS_PDUT_CONFIG_ACK = 0x10, - SNS_PDUT_DELETE = 0x11, - SNS_PDUT_SIZE = 0x12, - SNS_PDUT_SIZE_ACK = 0x13, -}; - -/* TS 08.16, Section 10.3, Table 12 */ -enum ns_ctrl_ie { - NS_IE_CAUSE = 0x00, - NS_IE_VCI = 0x01, - NS_IE_PDU = 0x02, - NS_IE_BVCI = 0x03, - NS_IE_NSEI = 0x04, - /* TS 48.016 Section 10.3, Table 10.3.1 */ - NS_IE_IPv4_LIST = 0x05, - NS_IE_IPv6_LIST = 0x06, - NS_IE_MAX_NR_NSVC = 0x07, - NS_IE_IPv4_EP_NR = 0x08, - NS_IE_IPv6_EP_NR = 0x09, - NS_IE_RESET_FLAG = 0x0a, - NS_IE_IP_ADDR = 0x0b, -}; - -/* TS 08.16, Section 10.3.2, Table 13 */ -enum ns_cause { - NS_CAUSE_TRANSIT_FAIL = 0x00, - NS_CAUSE_OM_INTERVENTION = 0x01, - NS_CAUSE_EQUIP_FAIL = 0x02, - NS_CAUSE_NSVC_BLOCKED = 0x03, - NS_CAUSE_NSVC_UNKNOWN = 0x04, - NS_CAUSE_BVCI_UNKNOWN = 0x05, - NS_CAUSE_SEM_INCORR_PDU = 0x08, - NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a, - NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b, - NS_CAUSE_INVAL_ESSENT_IE = 0x0c, - NS_CAUSE_MISSING_ESSENT_IE = 0x0d, - /* TS 48.016 Section 10.3.2, Table 10.3.2.1 */ - NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e, - NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f, - NS_CAUSE_INVAL_NR_NS_VC = 0x10, - NS_CAUSE_INVAL_WEIGH = 0x11, - NS_CAUSE_UNKN_IP_EP = 0x12, - NS_CAUSE_UNKN_IP_ADDR = 0x13, - NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14, -}; - -/* Our Implementation */ -#include <netinet/in.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/timer.h> -#include <osmocom/core/select.h> - -#define NS_TIMERS_COUNT 7 -#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)" -#define NS_TIMERS_HELP \ - "(un)blocking Timer (Tns-block) timeout\n" \ - "(un)blocking Timer (Tns-block) number of retries\n" \ - "Reset Timer (Tns-reset) timeout\n" \ - "Reset Timer (Tns-reset) number of retries\n" \ - "Test Timer (Tns-test) timeout\n" \ - -enum ns_timeout { - NS_TOUT_TNS_BLOCK, - NS_TOUT_TNS_BLOCK_RETRIES, - NS_TOUT_TNS_RESET, - NS_TOUT_TNS_RESET_RETRIES, - NS_TOUT_TNS_TEST, - NS_TOUT_TNS_ALIVE, - NS_TOUT_TNS_ALIVE_RETRIES, -}; - -#define NSE_S_BLOCKED 0x0001 -#define NSE_S_ALIVE 0x0002 - -enum gprs_ns_ll { - GPRS_NS_LL_UDP, - GPRS_NS_LL_E1, - GPRS_NS_LL_FR_GRE, -}; - -enum gprs_ns_evt { - GPRS_NS_EVT_UNIT_DATA, -}; - -struct gprs_nsvc; -typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, - struct msgb *msg, uint16_t bvci); - -/* An instance of the NS protocol stack */ -struct gprs_ns_inst { - /* callback to the user for incoming UNIT DATA IND */ - gprs_ns_cb_t *cb; - - /* linked lists of all NSVC in this instance */ - struct llist_head gprs_nsvcs; - - /* a NSVC object that's needed to deal with packets for unknown NSVC */ - struct gprs_nsvc *unknown_nsvc; - - uint16_t timeout[NS_TIMERS_COUNT]; - - /* NS-over-IP specific bits */ - struct { - struct osmo_fd fd; - uint32_t local_ip; - uint16_t local_port; - } nsip; - /* NS-over-FR-over-GRE-over-IP specific bits */ - struct { - struct osmo_fd fd; - uint32_t local_ip; - int enabled:1; - } frgre; -}; - -enum nsvc_timer_mode { - /* standard timers */ - NSVC_TIMER_TNS_TEST, - NSVC_TIMER_TNS_ALIVE, - NSVC_TIMER_TNS_RESET, - _NSVC_TIMER_NR, -}; - -struct gprs_nsvc { - struct llist_head list; - struct gprs_ns_inst *nsi; - - uint16_t nsei; /* end-to-end significance */ - uint16_t nsvci; /* uniquely identifies NS-VC at SGSN */ - - uint32_t state; - uint32_t remote_state; - - struct osmo_timer_list timer; - enum nsvc_timer_mode timer_mode; - int alive_retries; - - unsigned int remote_end_is_sgsn:1; - unsigned int persistent:1; - - struct rate_ctr_group *ctrg; - - /* which link-layer are we based on? */ - enum gprs_ns_ll ll; - - union { - struct { - struct sockaddr_in bts_addr; - } ip; - struct { - struct sockaddr_in bts_addr; - } frgre; - }; -}; - -/* Create a new NS protocol instance */ -struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb); - -/* Destroy a NS protocol instance */ -void gprs_ns_destroy(struct gprs_ns_inst *nsi); - -/* Listen for incoming GPRS packets via NS/UDP */ -int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi); - -struct sockaddr_in; - -/* main function for higher layers (BSSGP) to send NS messages */ -int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg); - -int gprs_ns_tx_reset(struct gprs_nsvc *nsvc, uint8_t cause); -int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause); -int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc); - -/* Listen for incoming GPRS packets via NS/FR/GRE */ -int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi); - -/* Establish a connection (from the BSS) to the SGSN */ -struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi, - struct sockaddr_in *dest, uint16_t nsei, - uint16_t nsvci); - -struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci); -void nsvc_delete(struct gprs_nsvc *nsvc); -struct gprs_nsvc *nsvc_by_nsei(struct gprs_ns_inst *nsi, uint16_t nsei); -struct gprs_nsvc *nsvc_by_nsvci(struct gprs_ns_inst *nsi, uint16_t nsvci); - -/* Initiate a RESET procedure (including timer start, ...)*/ -void gprs_nsvc_reset(struct gprs_nsvc *nsvc, uint8_t cause); - -/* Add NS-specific VTY stuff */ -int gprs_ns_vty_init(struct gprs_ns_inst *nsi); - -#define NS_ALLOC_SIZE 2048 -#define NS_ALLOC_HEADROOM 20 -static inline struct msgb *gprs_ns_msgb_alloc(void) -{ - return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS"); -} - -#endif diff --git a/openbsc/include/openbsc/gprs_ns_frgre.h b/openbsc/include/openbsc/gprs_ns_frgre.h deleted file mode 100644 index abcd43f..0000000 --- a/openbsc/include/openbsc/gprs_ns_frgre.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _GPRS_NS_FRGRE_H -#define _GPRS_NS_FRGRE_H - -int gprs_ns_frgre_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg); - -#endif diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h deleted file mode 100644 index 62fbb85..0000000 --- a/openbsc/include/openbsc/gprs_sgsn.h +++ /dev/null @@ -1,220 +0,0 @@ -#ifndef _GPRS_SGSN_H -#define _GPRS_SGSN_H - -#include <stdint.h> -#include <netinet/in.h> - -#include <osmocom/gsm/gsm48.h> - -#include <osmocom/crypt/gprs_cipher.h> - -#define GSM_IMSI_LENGTH 17 -#define GSM_IMEI_LENGTH 17 -#define GSM_EXTENSION_LENGTH 15 - -struct gprs_llc_lle; - -/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */ -enum gprs_mm_state { - GMM_DEREGISTERED, /* 4.1.3.3.1.1 */ - GMM_COMMON_PROC_INIT, /* 4.1.3.3.1.2 */ - GMM_REGISTERED_NORMAL, /* 4.1.3.3.2.1 */ - GMM_REGISTERED_SUSPENDED, /* 4.1.3.3.2.2 */ - GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */ -}; - -enum gprs_mm_ctr { - GMM_CTR_PKTS_SIG_IN, - GMM_CTR_PKTS_SIG_OUT, - GMM_CTR_PKTS_UDATA_IN, - GMM_CTR_PKTS_UDATA_OUT, - GMM_CTR_BYTES_UDATA_IN, - GMM_CTR_BYTES_UDATA_OUT, - GMM_CTR_PDP_CTX_ACT, - GMM_CTR_SUSPEND, - GMM_CTR_PAGING_PS, - GMM_CTR_PAGING_CS, - GMM_CTR_RA_UPDATE, -}; - -enum gprs_pdp_ctx { - PDP_CTR_PKTS_UDATA_IN, - PDP_CTR_PKTS_UDATA_OUT, - PDP_CTR_BYTES_UDATA_IN, - PDP_CTR_BYTES_UDATA_OUT, -}; - -enum gprs_t3350_mode { - GMM_T3350_MODE_ATT, - GMM_T3350_MODE_RAU, - GMM_T3350_MODE_PTMSI_REALL, -}; - -#define MS_RADIO_ACCESS_CAPA - -/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */ -/* Extended by 3GPP TS 23.060, Table 6: SGSN MM and PDP Contexts */ -struct sgsn_mm_ctx { - struct llist_head list; - - char imsi[GSM_IMSI_LENGTH]; - enum gprs_mm_state mm_state; - uint32_t p_tmsi; - uint32_t p_tmsi_old; /* old P-TMSI before new is confirmed */ - uint32_t p_tmsi_sig; - char imei[GSM_IMEI_LENGTH]; - /* Opt: Software Version Numbber / TS 23.195 */ - char msisdn[GSM_EXTENSION_LENGTH]; - struct gprs_ra_id ra; - uint16_t cell_id; - uint32_t cell_id_age; - uint16_t sac; /* Iu: Service Area Code */ - uint32_t sac_age;/* Iu: Service Area Code age */ - /* VLR number */ - uint32_t new_sgsn_addr; - /* Authentication Triplets */ - /* Kc */ - /* Iu: CK, IK, KSI */ - /* CKSN */ - enum gprs_ciph_algo ciph_algo; - struct { - uint8_t buf[52]; /* 10.5.5.12a */ - uint8_t len; - } ms_radio_access_capa; - struct { - uint8_t buf[4]; /* 10.5.5.12 */ - uint8_t len; - } ms_network_capa; - uint16_t drx_parms; - int mnrg; /* MS reported to HLR? */ - int ngaf; /* MS reported to MSC/VLR? */ - int ppf; /* paging for GPRS + non-GPRS? */ - /* SMS Parameters */ - int recovery; - uint8_t radio_prio_sms; - - struct llist_head pdp_list; - - /* Additional bits not present in the GSM TS */ - struct gprs_llc_llme *llme; - uint32_t tlli; - uint32_t tlli_new; - uint16_t nsei; - uint16_t bvci; - struct rate_ctr_group *ctrg; - struct osmo_timer_list timer; - unsigned int T; /* Txxxx number */ - unsigned int num_T_exp; /* number of consecutive T expirations */ - - enum gprs_t3350_mode t3350_mode; - uint8_t t3370_id_type; -}; - -/* look-up a SGSN MM context based on TLLI + RAI */ -struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli, - const struct gprs_ra_id *raid); -struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi); -struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi); - -/* Allocate a new SGSN MM context */ -struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(uint32_t tlli, - const struct gprs_ra_id *raid); -void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm); - - -enum pdp_ctx_state { - PDP_STATE_NONE, - PDP_STATE_CR_REQ, - PDP_STATE_CR_CONF, - - /* 04.08 / Figure 6.2 / 6.1.2.2 */ - PDP_STATE_INACT_PEND, - PDP_STATE_INACTIVE = PDP_STATE_NONE, -}; - -enum pdp_type { - PDP_TYPE_NONE, - PDP_TYPE_ETSI_PPP, - PDP_TYPE_IANA_IPv4, - PDP_TYPE_IANA_IPv6, -}; - -struct sgsn_pdp_ctx { - struct llist_head list; /* list_head for mmctx->pdp_list */ - struct llist_head g_list; /* list_head for global list */ - struct sgsn_mm_ctx *mm; /* back pointer to MM CTX */ - struct sgsn_ggsn_ctx *ggsn; /* which GGSN serves this PDP */ - struct rate_ctr_group *ctrg; - - //unsigned int id; - struct pdp_t *lib; /* pointer to libgtp PDP ctx */ - enum pdp_ctx_state state; - enum pdp_type type; - uint32_t address; - char *apn_subscribed; - //char *apn_used; - uint16_t nsapi; /* SNDCP */ - uint16_t sapi; /* LLC */ - uint8_t ti; /* transaction identifier */ - int vplmn_allowed; - uint32_t qos_profile_subscr; - //uint32_t qos_profile_req; - //uint32_t qos_profile_neg; - uint8_t radio_prio; - uint32_t tx_npdu_nr; - uint32_t rx_npdu_nr; - uint32_t tx_gtp_snd; - uint32_t rx_gtp_snu; - //uint32_t charging_id; - int reordering_reqd; - - struct osmo_timer_list timer; - unsigned int T; /* Txxxx number */ - unsigned int num_T_exp; /* number of consecutive T expirations */ -}; - - -/* look up PDP context by MM context and NSAPI */ -struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_nsapi(const struct sgsn_mm_ctx *mm, - uint8_t nsapi); -/* look up PDP context by MM context and transaction ID */ -struct sgsn_pdp_ctx *sgsn_pdp_ctx_by_tid(const struct sgsn_mm_ctx *mm, - uint8_t tid); - -struct sgsn_pdp_ctx *sgsn_pdp_ctx_alloc(struct sgsn_mm_ctx *mm, - uint8_t nsapi); -void sgsn_pdp_ctx_free(struct sgsn_pdp_ctx *pdp); - - -struct sgsn_ggsn_ctx { - struct llist_head list; - uint32_t id; - unsigned int gtp_version; - struct in_addr remote_addr; - int remote_restart_ctr; - struct gsn_t *gsn; -}; -struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_alloc(uint32_t id); -struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_id(uint32_t id); -struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_by_addr(struct in_addr *addr); -struct sgsn_ggsn_ctx *sgsn_ggsn_ctx_find_alloc(uint32_t id); - -struct apn_ctx { - struct llist_head list; - struct sgsn_ggsn_ctx *ggsn; - char *name; - char *description; -}; - -extern struct llist_head sgsn_mm_ctxts; -extern struct llist_head sgsn_ggsn_ctxts; -extern struct llist_head sgsn_apn_ctxts; -extern struct llist_head sgsn_pdp_ctxts; - -uint32_t sgsn_alloc_ptmsi(void); - -/* High-level function to be called in case a GGSN has disappeared or - * ottherwise lost state (recovery procedure) */ -int drop_all_pdp_for_ggsn(struct sgsn_ggsn_ctx *ggsn); - -#endif /* _GPRS_SGSN_H */ diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h deleted file mode 100644 index ec6c2c0..0000000 --- a/openbsc/include/openbsc/gsm_04_08.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _GSM_04_08_H -#define _GSM_04_08_H - -#include <osmocom/gsm/gsm48.h> -#include <osmocom/gsm/gsm_utils.h> -#include <osmocom/gsm/protocol/gsm_04_08.h> - -#include <openbsc/meas_rep.h> - -struct msgb; -struct gsm_bts; -struct gsm_subscriber; -struct gsm_network; -struct gsm_trans; -struct gsm_subscriber_connection; - -#define GSM48_ALLOC_SIZE 2048 -#define GSM48_ALLOC_HEADROOM 256 - -static inline struct msgb *gsm48_msgb_alloc(void) -{ - return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM, - "GSM 04.08"); -} - -/* config options controlling the behaviour of the lower leves */ -void gsm0408_allow_everyone(int allow); -void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause); -void gsm0408_clear_all_trans(struct gsm_network *net, int protocol); -int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg); - -int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id); -int gsm0408_new_conn(struct gsm_subscriber_connection *conn); -enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra); -/* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */ -int get_reason_by_chreq(uint8_t ra, int neci); -void gsm_net_update_ctype(struct gsm_network *net); - -int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn); -int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq); -int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn); -int gsm48_send_rr_release(struct gsm_lchan *lchan); -int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); -int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id, - uint8_t apdu_len, const uint8_t *apdu); -int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class); -int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, - uint8_t power_command, uint8_t ho_ref); - -int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg); - -/* convert a ASCII phone number to call-control BCD */ -int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, - int h_len, const char *input); -int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv, - int h_len); - -int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv); -int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type); -int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type); -int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr); - -int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode); -int gsm48_rx_rr_modif_ack(struct msgb *msg); -int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); - -struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); -struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); -void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, - const struct gsm_lchan *lchan); - -#endif diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h deleted file mode 100644 index 2abe3e2..0000000 --- a/openbsc/include/openbsc/gsm_04_11.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _GSM_04_11_H -#define _GSM_04_11_H - -#include <osmocom/gsm/protocol/gsm_04_11.h> - -#define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */ - -/* SMS deliver PDU */ -struct sms_deliver { - uint8_t mti:2; /* message type indicator */ - uint8_t mms:1; /* more messages to send */ - uint8_t rp:1; /* reply path */ - uint8_t udhi:1; /* user data header indicator */ - uint8_t sri:1; /* status report indication */ - uint8_t *orig_addr; /* originating address */ - uint8_t pid; /* protocol identifier */ - uint8_t dcs; /* data coding scheme */ - /* service centre time stamp */ - uint8_t ud_len; /* user data length */ - uint8_t *user_data; /* user data */ - - uint8_t msg_ref; /* message reference */ - uint8_t *smsc; -}; - -struct msgb; - -int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn, struct msgb *msg); - -struct gsm_sms *sms_alloc(void); -void sms_free(struct gsm_sms *sms); -struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, int dcs, const char *text); - -void _gsm411_sms_trans_free(struct gsm_trans *trans); -int gsm411_send_sms_subscr(struct gsm_subscriber *subscr, - struct gsm_sms *sms); -int gsm411_send_sms(struct gsm_subscriber_connection *conn, - struct gsm_sms *sms); -void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn); -#endif diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h deleted file mode 100644 index 0a60652..0000000 --- a/openbsc/include/openbsc/gsm_04_80.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _GSM_04_80_H -#define _GSM_04_80_H - -#include <osmocom/core/msgb.h> -#include <osmocom/gsm/protocol/gsm_04_80.h> -#include <osmocom/gsm/gsm0480.h> - -struct gsm_subscriber_connection; - -int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn, - const struct msgb *in_msg, const char* response_text, - const struct ussd_request *req); -int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn, - const struct msgb *msg, - const struct ussd_request *request); - -int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text); -int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn); - -#endif diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h deleted file mode 100644 index f74ece8..0000000 --- a/openbsc/include/openbsc/gsm_data.h +++ /dev/null @@ -1,388 +0,0 @@ -#ifndef _GSM_DATA_H -#define _GSM_DATA_H - -#include <stdint.h> - -#include <osmocom/core/timer.h> -#include <osmocom/core/select.h> - -#include <openbsc/rest_octets.h> -#include <osmocom/abis/e1_input.h> - -#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3] - -/* the data structure stored in msgb->cb for openbsc apps */ -struct openbsc_msgb_cb { - unsigned char *bssgph; - unsigned char *llch; - - /* Cell Identifier */ - unsigned char *bssgp_cell_id; - - /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */ - uint16_t nsei; - uint16_t bvci; - - /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */ - uint32_t tlli; -} __attribute__((packed)); -#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0])) -#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli -#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei -#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci -#define msgb_gmmh(__x) (__x)->l3h -#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph -#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x)) -#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id -#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch - -#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] - -enum gsm_security_event { - GSM_SECURITY_NOAVAIL, - GSM_SECURITY_AUTH_FAILED, - GSM_SECURITY_SUCCEEDED, -}; - -struct msgb; -typedef int gsm_cbfn(unsigned int hooknum, - unsigned int event, - struct msgb *msg, - void *data, void *param); - -/* Real authentication information containing Ki */ -enum gsm_auth_algo { - AUTH_ALGO_NONE, - AUTH_ALGO_XOR, - AUTH_ALGO_COMP128v1, -}; - -struct gsm_auth_info { - enum gsm_auth_algo auth_algo; - unsigned int a3a8_ki_len; - uint8_t a3a8_ki[16]; -}; - -struct gsm_auth_tuple { - int use_count; - int key_seq; - uint8_t rand[16]; - uint8_t sres[4]; - uint8_t kc[8]; -}; -#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */ - -/* - * LOCATION UPDATING REQUEST state - * - * Our current operation is: - * - Get imei/tmsi - * - Accept/Reject according to global policy - */ -struct gsm_loc_updating_operation { - struct osmo_timer_list updating_timer; - unsigned int waiting_for_imsi : 1; - unsigned int waiting_for_imei : 1; - unsigned int key_seq : 4; -}; - -/* - * AUTHENTICATION/CIPHERING state - */ -struct gsm_security_operation { - struct gsm_auth_tuple atuple; - gsm_cbfn *cb; - void *cb_data; -}; - -/* - * A dummy to keep a connection up for at least - * a couple of seconds to work around MSC issues. - */ -struct gsm_anchor_operation { - struct osmo_timer_list timeout; -}; - -/* Maximum number of neighbor cells whose average we track */ -#define MAX_NEIGH_MEAS 10 -/* Maximum size of the averaging window for neighbor cells */ -#define MAX_WIN_NEIGH_AVG 10 - -/* processed neighbor measurements for one cell */ -struct neigh_meas_proc { - uint16_t arfcn; - uint8_t bsic; - uint8_t rxlev[MAX_WIN_NEIGH_AVG]; - unsigned int rxlev_cnt; - uint8_t last_seen_nr; -}; - -/* the per subscriber data for lchan */ -struct gsm_subscriber_connection { - struct llist_head entry; - - /* To whom we are allocated at the moment */ - struct gsm_subscriber *subscr; - - /* - * Operations that have a state and might be pending - */ - struct gsm_loc_updating_operation *loc_operation; - struct gsm_security_operation *sec_operation; - struct gsm_anchor_operation *anch_operation; - - /* Are we part of a special "silent" call */ - int silent_call; - int put_channel; - - /* bsc structures */ - struct osmo_bsc_sccp_con *sccp_con; - - /* back pointers */ - int in_release; - struct gsm_lchan *lchan; - struct gsm_lchan *ho_lchan; - struct gsm_bts *bts; - - /* for assignment handling */ - struct osmo_timer_list T10; - struct gsm_lchan *secondary_lchan; - -}; - - -#define ROLE_BSC -#include "gsm_data_shared.h" - - -/* Some statistics of our network */ -struct gsmnet_stats { - struct { - struct osmo_counter *total; - struct osmo_counter *no_channel; - } chreq; - struct { - struct osmo_counter *attempted; - struct osmo_counter *no_channel; /* no channel available */ - struct osmo_counter *timeout; /* T3103 timeout */ - struct osmo_counter *completed; /* HO COMPL received */ - struct osmo_counter *failed; /* HO FAIL received */ - } handover; - struct { - struct osmo_counter *attach; - struct osmo_counter *normal; - struct osmo_counter *periodic; - struct osmo_counter *detach; - } loc_upd_type; - struct { - struct osmo_counter *reject; - struct osmo_counter *accept; - } loc_upd_resp; - struct { - struct osmo_counter *attempted; - struct osmo_counter *detached; - struct osmo_counter *completed; - struct osmo_counter *expired; - } paging; - struct { - struct osmo_counter *submitted; /* MO SMS submissions */ - struct osmo_counter *no_receiver; - struct osmo_counter *delivered; /* MT SMS deliveries */ - struct osmo_counter *rp_err_mem; - struct osmo_counter *rp_err_other; - } sms; - struct { - struct osmo_counter *mo_setup; - struct osmo_counter *mo_connect_ack; - struct osmo_counter *mt_setup; - struct osmo_counter *mt_connect; - } call; - struct { - struct osmo_counter *rf_fail; - struct osmo_counter *rll_err; - } chan; - struct { - struct osmo_counter *oml_fail; - struct osmo_counter *rsl_fail; - } bts; -}; - -enum gsm_auth_policy { - GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */ - GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */ - GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */ -}; - -#define GSM_T3101_DEFAULT 10 -#define GSM_T3113_DEFAULT 60 - -struct gsm_network { - /* global parameters */ - uint16_t country_code; - uint16_t network_code; - char *name_long; - char *name_short; - enum gsm_auth_policy auth_policy; - enum gsm48_reject_value reject_cause; - int a5_encryption; - int neci; - int send_mm_info; - struct { - int active; - /* Window RXLEV averaging */ - unsigned int win_rxlev_avg; /* number of SACCH frames */ - /* Window RXQUAL averaging */ - unsigned int win_rxqual_avg; /* number of SACCH frames */ - /* Window RXLEV neighbouring cells averaging */ - unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */ - - /* how often should we check for power budget HO */ - unsigned int pwr_interval; /* SACCH frames */ - /* how much better does a neighbor cell have to be ? */ - unsigned int pwr_hysteresis; /* dBm */ - /* maximum distacne before we try a handover */ - unsigned int max_distance; /* TA values */ - } handover; - - struct gsmnet_stats stats; - - /* layer 4 */ - int (*mncc_recv) (struct gsm_network *net, struct msgb *msg); - struct llist_head upqueue; - struct llist_head trans_list; - struct bsc_api *bsc_api; - - unsigned int num_bts; - struct llist_head bts_list; - - /* timer values */ - int T3101; - int T3103; - int T3105; - int T3107; - int T3109; - int T3111; - int T3113; - int T3115; - int T3117; - int T3119; - int T3122; - int T3141; - - /* Radio Resource Location Protocol (TS 04.31) */ - struct { - enum rrlp_mode mode; - } rrlp; - - /* enable the DTXu and DTXd for this network */ - int dtx_enabled; - - enum gsm_chan_t ctype_by_chreq[16]; - - /* Use a TCH for handling requests of type paging any */ - int pag_any_tch; - - /* MSC data in case we are a true BSC */ - struct osmo_msc_data *msc_data; - - /* subscriber related features */ - int keep_subscr; - struct gsm_sms_queue *sms_queue; -}; - -#define SMS_HDR_SIZE 128 -#define SMS_TEXT_SIZE 256 -struct gsm_sms { - unsigned long long id; - struct gsm_subscriber *sender; - struct gsm_subscriber *receiver; - - unsigned long validity_minutes; - uint8_t reply_path_req; - uint8_t status_rep_req; - uint8_t ud_hdr_ind; - uint8_t protocol_id; - uint8_t data_coding_scheme; - uint8_t msg_ref; - char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes - * BCD == 20 bytes string */ - uint8_t user_data_len; - uint8_t user_data[SMS_TEXT_SIZE]; - - char text[SMS_TEXT_SIZE]; -}; - -struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code, - int (*mncc_recv)(struct gsm_network *, struct msgb *)); -int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); - -struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); - -/* Get reference to a neighbor cell on a given BCCH ARFCN */ -struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, - uint16_t arfcn, uint8_t bsic); - -enum gsm_bts_type parse_btstype(const char *arg); -const char *btstype2str(enum gsm_bts_type type); -struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, - struct gsm_bts *start_bts); - -extern void *tall_bsc_ctx; -extern int ipacc_rtp_direct; - -static inline int is_ipaccess_bts(struct gsm_bts *bts) -{ - switch (bts->type) { - case GSM_BTS_TYPE_NANOBTS: - return 1; - default: - break; - } - return 0; -} - -static inline int is_siemens_bts(struct gsm_bts *bts) -{ - switch (bts->type) { - case GSM_BTS_TYPE_BS11: - return 1; - default: - break; - } - - return 0; -} - -enum gsm_auth_policy gsm_auth_policy_parse(const char *arg); -const char *gsm_auth_policy_name(enum gsm_auth_policy policy); - -enum rrlp_mode rrlp_mode_parse(const char *arg); -const char *rrlp_mode_name(enum rrlp_mode mode); - -enum bts_gprs_mode bts_gprs_mode_parse(const char *arg); -const char *bts_gprs_mode_name(enum bts_gprs_mode mode); - -int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts); -void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); -struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan); - -int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); -int gsm_bts_model_register(struct gsm_bts_model *model); - -struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan); -void subscr_con_free(struct gsm_subscriber_connection *conn); - -struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, - enum gsm_bts_type type, - uint8_t tsc, uint8_t bsic); -void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr, - uint8_t e1_ts, uint8_t e1_ts_ss); - -void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); -int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat); -struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); - -/* generic E1 line operations for all ISDN-based BTS. */ -extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; - -#endif /* _GSM_DATA_H */ diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h deleted file mode 100644 index ca88fed..0000000 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ /dev/null @@ -1,602 +0,0 @@ -#ifndef _GSM_DATA_SHAREDH -#define _GSM_DATA_SHAREDH - -#include <regex.h> -#include <stdbool.h> -#include <stdint.h> - -#include <osmocom/core/timer.h> -#include <osmocom/core/bitvec.h> -#include <osmocom/core/statistics.h> -#include <osmocom/core/utils.h> -#include <osmocom/gsm/gsm_utils.h> -#include <osmocom/gsm/tlv.h> -#include <osmocom/gsm/rxlev_stat.h> -#include <osmocom/gsm/sysinfo.h> - -#include <osmocom/gsm/protocol/gsm_08_58.h> -#include <osmocom/gsm/protocol/gsm_12_21.h> - -#include <osmocom/abis/e1_input.h> - -struct osmo_msc_data; -struct osmo_bsc_sccp_con; -struct gsm_sms_queue; - -/* RRLP mode of operation */ -enum rrlp_mode { - RRLP_MODE_NONE, - RRLP_MODE_MS_BASED, - RRLP_MODE_MS_PREF, - RRLP_MODE_ASS_PREF, -}; - -/* Channel Request reason */ -enum gsm_chreq_reason_t { - GSM_CHREQ_REASON_EMERG, - GSM_CHREQ_REASON_PAG, - GSM_CHREQ_REASON_CALL, - GSM_CHREQ_REASON_LOCATION_UPD, - GSM_CHREQ_REASON_OTHER, -}; - -#define TRX_NR_TS 8 -#define TS_MAX_LCHAN 8 - -#define HARDCODED_ARFCN 123 -#define HARDCODED_TSC 7 -#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ - -/* for multi-drop config */ -#define HARDCODED_BTS0_TS 1 -#define HARDCODED_BTS1_TS 6 -#define HARDCODED_BTS2_TS 11 - -/* reserved according to GSM 03.03 § 2.4 */ -#define GSM_RESERVED_TMSI 0xFFFFFFFF - -enum gsm_hooks { - GSM_HOOK_NM_SWLOAD, - GSM_HOOK_RR_PAGING, - GSM_HOOK_RR_SECURITY, -}; - -enum gsm_paging_event { - GSM_PAGING_SUCCEEDED, - GSM_PAGING_EXPIRED, - GSM_PAGING_OOM, - GSM_PAGING_BUSY, -}; - -enum bts_gprs_mode { - BTS_GPRS_NONE = 0, - BTS_GPRS_GPRS = 1, - BTS_GPRS_EGPRS = 2, -}; - -struct gsm_lchan; -struct gsm_subscriber; -struct gsm_mncc; -struct rtp_socket; -struct bsc_api; - -/* Network Management State */ -struct gsm_nm_state { - uint8_t operational; - uint8_t administrative; - uint8_t availability; -}; - -struct gsm_abis_mo { - uint8_t obj_class; - struct abis_om_obj_inst obj_inst; - const char *name; - struct gsm_nm_state nm_state; - struct tlv_parsed *nm_attr; - struct gsm_bts *bts; -}; - -#define MAX_A5_KEY_LEN (128/8) -#define A38_XOR_MIN_KEY_LEN 12 -#define A38_XOR_MAX_KEY_LEN 16 -#define A38_COMP128_KEY_LEN 16 -#define RSL_ENC_ALG_A5(x) (x+1) - -/* is the data link established? who established it? */ -#define LCHAN_SAPI_UNUSED 0 -#define LCHAN_SAPI_MS 1 -#define LCHAN_SAPI_NET 2 - -/* state of a logical channel */ -enum gsm_lchan_state { - LCHAN_S_NONE, /* channel is not active */ - LCHAN_S_ACT_REQ, /* channel activatin requested */ - LCHAN_S_ACTIVE, /* channel is active and operational */ - LCHAN_S_REL_REQ, /* channel release has been requested */ - LCHAN_S_REL_ERR, /* channel is in an error state */ - LCHAN_S_INACTIVE, /* channel is set inactive */ -}; - -/* BTS ONLY */ -#define MAX_NUM_UL_MEAS 104 -#define LC_UL_M_F_L1_VALID (1 << 0) -#define LC_UL_M_F_RES_VALID (1 << 1) - -struct bts_ul_meas { - /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ - uint16_t ber10k; - /* timing advance offset (in quarter bits) */ - int16_t ta_offs_qbits; - /* C/I ratio in dB */ - float c_i; - /* flags */ - uint8_t is_sub:1; - /* RSSI in dBm * -1 */ - uint8_t inv_rssi; -}; -/* /BTS ONLY */ - -struct gsm_lchan { - /* The TS that we're part of */ - struct gsm_bts_trx_ts *ts; - /* The logical subslot number in the TS */ - uint8_t nr; - /* The logical channel type */ - enum gsm_chan_t type; - /* RSL channel mode */ - enum rsl_cmod_spd rsl_cmode; - /* If TCH, traffic channel mode */ - enum gsm48_chan_mode tch_mode; - /* State */ - enum gsm_lchan_state state; - /* Power levels for MS and BTS */ - uint8_t bs_power; - uint8_t ms_power; - /* Encryption information */ - struct { - uint8_t alg_id; - uint8_t key_len; - uint8_t key[MAX_A5_KEY_LEN]; - } encr; - - /* AMR bits */ - struct gsm48_multi_rate_conf mr_conf; - - /* Established data link layer services */ - uint8_t sapis[8]; - int sach_deact; - int release_reason; - - struct { - uint32_t bound_ip; - uint32_t connect_ip; - uint16_t bound_port; - uint16_t connect_port; - uint16_t conn_id; - uint8_t rtp_payload; - uint8_t rtp_payload2; - uint8_t speech_mode; - struct rtp_socket *rtp_socket; - } abis_ip; - - uint8_t rqd_ta; - -#ifdef ROLE_BSC - struct osmo_timer_list T3101; - struct osmo_timer_list T3111; - struct osmo_timer_list error_timer; - struct osmo_timer_list act_timer; - - /* table of neighbor cell measurements */ - struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; - - /* cache of last measurement reports on this lchan */ - struct gsm_meas_rep meas_rep[6]; - int meas_rep_idx; - - /* GSM Random Access data */ - struct gsm48_req_ref *rqd_ref; - - struct gsm_subscriber_connection *conn; -#else - struct lapdm_channel lapdm_ch; - struct { - /* bitmask of all SI that are present/valid in si_buf */ - uint32_t valid; - uint32_t last; - /* buffers where we put the pre-computed SI */ - sysinfo_buf_t buf[_MAX_SYSINFO_TYPE]; - } si; - struct { - uint8_t flags; - /* RSL measurment result number, 0 at lchan_act */ - uint8_t res_nr; - /* current Tx power level of the BTS */ - uint8_t bts_tx_pwr; - /* number of measurements stored in array below */ - uint8_t num_ul_meas; - struct bts_ul_meas uplink[MAX_NUM_UL_MEAS]; - /* last L1 header from the MS */ - uint8_t l1_info[2]; - struct { - uint8_t rxlev_full; - uint8_t rxlev_sub; - uint8_t rxqual_full; - uint8_t rxqual_sub; - } res; - } meas; -#endif -}; - -#define TS_F_PDCH_MODE 0x1000 -/* One Timeslot in a TRX */ -struct gsm_bts_trx_ts { - struct gsm_bts_trx *trx; - /* number of this timeslot at the TRX */ - uint8_t nr; - - enum gsm_phys_chan_config pchan; - - unsigned int flags; - struct gsm_abis_mo mo; - struct tlv_parsed nm_attr; - uint8_t nm_chan_comb; - int tsc; /* -1 == use BTS TSC */ - - struct { - /* Parameters below are configured by VTY */ - int enabled; - uint8_t maio; - uint8_t hsn; - struct bitvec arfcns; - uint8_t arfcns_data[1024/8]; - /* This is the pre-computed MA for channel assignments */ - struct bitvec ma; - uint8_t ma_len; /* part of ma_data that is used */ - uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ - } hopping; - - /* To which E1 subslot are we connected */ - struct gsm_e1_subslot e1_link; - - struct gsm_lchan lchan[TS_MAX_LCHAN]; -}; - -/* One TRX in a BTS */ -struct gsm_bts_trx { - /* list header in bts->trx_list */ - struct llist_head list; - - struct gsm_bts *bts; - /* number of this TRX in the BTS */ - uint8_t nr; - /* human readable name / description */ - char *description; - /* how do we talk RSL with this TRX? */ - struct gsm_e1_subslot rsl_e1_link; - uint8_t rsl_tei; - struct e1inp_sign_link *rsl_link; - /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ - struct e1inp_sign_link *oml_link; - - struct gsm_abis_mo mo; - struct tlv_parsed nm_attr; - struct { - struct gsm_abis_mo mo; - } bb_transc; - - uint16_t arfcn; - int nominal_power; /* in dBm */ - unsigned int max_power_red; /* in actual dB */ - - struct { - void *l1h; - } role_bts; - - union { - struct { - struct { - struct gsm_abis_mo mo; - } bbsig; - struct { - struct gsm_abis_mo mo; - } pa; - } bs11; - struct { - unsigned int test_state; - uint8_t test_nr; - struct rxlev_stats rxlev_stat; - } ipaccess; - }; - struct gsm_bts_trx_ts ts[TRX_NR_TS]; -}; - -#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i]) - -enum gsm_bts_type { - GSM_BTS_TYPE_UNKNOWN, - GSM_BTS_TYPE_BS11, - GSM_BTS_TYPE_NANOBTS, - GSM_BTS_TYPE_RBS2000, - GSM_BTS_TYPE_HSL_FEMTO, - GSM_BTS_TYPE_NOKIA_SITE, -}; - -struct vty; - -struct gsm_bts_model { - struct llist_head list; - - enum gsm_bts_type type; - const char *name; - - bool started; - int (*start)(struct gsm_network *net); - int (*oml_rcvmsg)(struct msgb *msg); - - void (*e1line_bind_ops)(struct e1inp_line *line); - - void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); - void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); - void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); - - struct tlv_definition nm_att_tlvdef; - - struct bitvec features; - uint8_t _features_data[128/8]; -}; - -enum gsm_bts_features { - BTS_FEAT_HSCSD, - BTS_FEAT_GPRS, - BTS_FEAT_EGPRS, - BTS_FEAT_ECSD, - BTS_FEAT_HOPPING, -}; - -/* - * This keeps track of the paging status of one BTS. It - * includes a number of pending requests, a back pointer - * to the gsm_bts, a timer and some more state. - */ -struct gsm_bts_paging_state { - /* pending requests */ - struct llist_head pending_requests; - struct gsm_bts *bts; - - struct osmo_timer_list work_timer; - struct osmo_timer_list credit_timer; - - /* free chans needed */ - int free_chans_need; - - /* load */ - uint16_t available_slots; -}; - -struct gsm_envabtse { - struct gsm_abis_mo mo; -}; - -struct gsm_bts_gprs_nsvc { - struct gsm_bts *bts; - /* data read via VTY config file, to configure the BTS - * via OML from BSC */ - int id; - uint16_t nsvci; - uint16_t local_port; /* on the BTS */ - uint16_t remote_port; /* on the SGSN */ - uint32_t remote_ip; /* on the SGSN */ - - struct gsm_abis_mo mo; -}; - -enum neigh_list_manual_mode { - NL_MODE_AUTOMATIC = 0, - NL_MODE_MANUAL = 1, - NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ -}; - -/* One BTS */ -struct gsm_bts { - /* list header in net->bts_list */ - struct llist_head list; - - /* number of ths BTS in network */ - uint8_t nr; - /* human readable name / description */ - char *description; - /* Cell Identity */ - uint16_t cell_identity; - /* location area code of this BTS */ - uint16_t location_area_code; - /* Training Sequence Code */ - uint8_t tsc; - /* Base Station Identification Code (BSIC) */ - uint8_t bsic; - /* type of BTS */ - enum gsm_bts_type type; - struct gsm_bts_model *model; - enum gsm_band band; - /* maximum Tx power that the MS is permitted to use in this cell */ - int ms_max_power; - - /* how do we talk OML with this TRX? */ - struct gsm_e1_subslot oml_e1_link; - uint8_t oml_tei; - struct e1inp_sign_link *oml_link; - - /* Abis network management O&M handle */ - struct abis_nm_h *nmh; - - struct gsm_abis_mo mo; - - /* number of this BTS on given E1 link */ - uint8_t bts_nr; - - /* paging state and control */ - struct gsm_bts_paging_state paging; - - /* CCCH is on C0 */ - struct gsm_bts_trx *c0; - - struct { - struct gsm_abis_mo mo; - } site_mgr; - - /* bitmask of all SI that are present/valid in si_buf */ - uint32_t si_valid; - /* buffers where we put the pre-computed SI */ - sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; - - /* ip.accesss Unit ID's have Site/BTS/TRX layout */ - union { - struct { - uint16_t site_id; - uint16_t bts_id; - uint32_t flags; - } ip_access; - struct { - struct { - struct gsm_abis_mo mo; - } cclk; - struct { - struct gsm_abis_mo mo; - } rack; - struct gsm_envabtse envabtse[4]; - } bs11; - struct { - struct { - struct gsm_abis_mo mo; - struct llist_head conn_groups; - } is; - struct { - struct gsm_abis_mo mo; - struct llist_head conn_groups; - } con; - struct { - struct gsm_abis_mo mo; - } dp; - struct { - struct gsm_abis_mo mo; - } tf; - } rbs2000; - struct { - unsigned long serno; - } hsl; - struct { - uint8_t bts_type; - int configured:1, - do_reset:1, - wait_reset:1; - struct osmo_timer_list reset_timer; - } nokia; - }; - - /* Not entirely sure how ip.access specific this is */ - struct { - enum bts_gprs_mode mode; - struct { - struct gsm_abis_mo mo; - uint16_t nsei; - uint8_t timer[7]; - } nse; - struct { - struct gsm_abis_mo mo; - uint16_t bvci; - uint8_t timer[11]; - } cell; - struct gsm_bts_gprs_nsvc nsvc[2]; - uint8_t rac; - } gprs; - - /* RACH NM values */ - int rach_b_thresh; - int rach_ldavg_slots; - - /* transceivers */ - int num_trx; - struct llist_head trx_list; - -#ifdef ROLE_BSC - /* Abis NM queue */ - struct llist_head abis_queue; - int abis_nm_pend; - - struct gsm_network *network; - - /* should the channel allocator allocate channels from high TRX to TRX0, - * rather than starting from TRX0 and go upwards? */ - int chan_alloc_reverse; - - enum neigh_list_manual_mode neigh_list_manual_mode; - /* parameters from which we build SYSTEM INFORMATION */ - struct { - struct gsm48_rach_control rach_control; - uint8_t ncc_permitted; - struct gsm48_cell_sel_par cell_sel_par; - struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ - struct gsm48_cell_options cell_options; - struct gsm48_control_channel_descr chan_desc; - struct bitvec neigh_list; - struct bitvec cell_alloc; - struct bitvec si5_neigh_list; - struct { - /* bitmask large enough for all possible ARFCN's */ - uint8_t neigh_list[1024/8]; - uint8_t cell_alloc[1024/8]; - /* If the user wants a different neighbor list in SI5 than in SI2 */ - uint8_t si5_neigh_list[1024/8]; - } data; - } si_common; - - /* do we use static (user-defined) system information messages? (bitmask) */ - uint32_t si_mode_static; -#endif /* ROLE_BSC */ - void *role; -}; - - -struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); -struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); - -struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num); - -const char *gsm_pchan_name(enum gsm_phys_chan_config c); -enum gsm_phys_chan_config gsm_pchan_parse(const char *name); -const char *gsm_lchant_name(enum gsm_chan_t c); -const char *gsm_chreq_name(enum gsm_chreq_reason_t c); -char *gsm_trx_name(struct gsm_bts_trx *trx); -char *gsm_ts_name(struct gsm_bts_trx_ts *ts); -char *gsm_lchan_name(struct gsm_lchan *lchan); -const char *gsm_lchans_name(enum gsm_lchan_state s); - - -void gsm_abis_mo_reset(struct gsm_abis_mo *mo); - -struct gsm_abis_mo * -gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class, - struct abis_om_obj_inst *obj_inst); - -struct gsm_nm_state * -gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, - struct abis_om_obj_inst *obj_inst); -void * -gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, - struct abis_om_obj_inst *obj_inst); - -/* reset the state of all MO in the BTS */ -void gsm_bts_mo_reset(struct gsm_bts *bts); - -uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr); -uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); - -/* - * help with parsing regexps - */ -int gsm_parse_reg(void *ctx, regex_t *reg, char **str, - int argc, const char **argv) __attribute__ ((warn_unused_result)); - - - -#endif diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h deleted file mode 100644 index 6cf8573..0000000 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef _GSM_SUBSCR_H -#define _GSM_SUBSCR_H - -#include "gsm_data.h" -#include <osmocom/core/linuxlist.h> - -#define GSM_IMEI_LENGTH 17 -#define GSM_IMSI_LENGTH 17 -#define GSM_NAME_LENGTH 160 - -#define GSM_EXTENSION_LENGTH 15 /* MSISDN can only be 15 digits length */ -#define GSM_MIN_EXTEN 20000 -#define GSM_MAX_EXTEN 49999 - -#define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 -#define tmsi_from_string(str) strtoul(str, NULL, 10) - -struct vty; - -struct gsm_equipment { - long long unsigned int id; - char imei[GSM_IMEI_LENGTH]; - char name[GSM_NAME_LENGTH]; - - struct gsm48_classmark1 classmark1; - uint8_t classmark2_len; - uint8_t classmark2[3]; - uint8_t classmark3_len; - uint8_t classmark3[14]; -}; - -struct gsm_subscriber { - struct gsm_network *net; - long long unsigned int id; - char imsi[GSM_IMSI_LENGTH]; - uint32_t tmsi; - uint16_t lac; - char name[GSM_NAME_LENGTH]; - char extension[GSM_EXTENSION_LENGTH]; - int authorized; - - /* Temporary field which is not stored in the DB/HLR */ - uint32_t flags; - - /* Every user can only have one equipment in use at any given - * point in time */ - struct gsm_equipment equipment; - - /* for internal management */ - int use_count; - struct llist_head entry; - - /* pending requests */ - int in_callback; - struct llist_head requests; -}; - -enum gsm_subscriber_field { - GSM_SUBSCRIBER_IMSI, - GSM_SUBSCRIBER_TMSI, - GSM_SUBSCRIBER_EXTENSION, - GSM_SUBSCRIBER_ID, -}; - -enum gsm_subscriber_update_reason { - GSM_SUBSCRIBER_UPDATE_ATTACHED, - GSM_SUBSCRIBER_UPDATE_DETACHED, - GSM_SUBSCRIBER_UPDATE_EQUIPMENT, -}; - -struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr); -struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr); -struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net, - uint32_t tmsi); -struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net, - const char *imsi); -struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net, - const char *ext); -struct gsm_subscriber *subscr_get_by_id(struct gsm_network *net, - unsigned long long id); -struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net, - const char *imsi); -int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason); -void subscr_put_channel(struct gsm_subscriber *subscr); -void subscr_get_channel(struct gsm_subscriber *subscr, - int type, gsm_cbfn *cbfn, void *param); -struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net, - uint32_t tmsi); -struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net, - const char *imsi); - -int subscr_pending_requests(struct gsm_subscriber *subscr); -int subscr_pending_clear(struct gsm_subscriber *subscr); -int subscr_pending_dump(struct gsm_subscriber *subscr, struct vty *vty); -int subscr_pending_kick(struct gsm_subscriber *subscr); - -char *subscr_name(struct gsm_subscriber *subscr); - -int subscr_purge_inactive(struct gsm_network *net); -void subscr_update_from_db(struct gsm_subscriber *subscr); - -/* internal */ -struct gsm_subscriber *subscr_alloc(void); -extern struct llist_head active_subscribers; - -#endif /* _GSM_SUBSCR_H */ diff --git a/openbsc/include/openbsc/ipaccess/network_listen.h b/openbsc/include/openbsc/ipaccess/network_listen.h new file mode 100644 index 0000000..67d1f4e --- /dev/null +++ b/openbsc/include/openbsc/ipaccess/network_listen.h @@ -0,0 +1,16 @@ +#ifndef _OPENBSC_NWL_H +#define _OPENBSC_NWL_H + +#include <stdint.h> +#include <openbsc/gsm_data.h> + +void ipac_nwl_init(void); + +/* Start a NWL test. It will raise the S_IPAC_TEST_COMPLETE signal. */ +int ipac_nwl_test_start(struct gsm_bts_trx *trx, uint8_t testnr, + const uint8_t *phys_conf, unsigned int phys_conf_len); + +int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev, + uint16_t max_num_arfcns); + +#endif /* _OPENBSC_NWL_H */ diff --git a/openbsc/include/openbsc/libbsc/abis_nm.h b/openbsc/include/openbsc/libbsc/abis_nm.h new file mode 100644 index 0000000..f11ac11 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/abis_nm.h @@ -0,0 +1,167 @@ +/* GSM Network Management messages on the A-bis interface + * 3GPP TS 12.21 version 8.0.0 Release 1999 / ETSI TS 100 623 V8.0.0 */ + +/* (C) 2008-2009 by Harald Welte laforge@gnumonks.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef _NM_H +#define _NM_H + +#include <osmocom/gsm/tlv.h> +#include <osmocom/gsm/abis_nm.h> +#include <osmocom/gsm/protocol/gsm_12_21.h> + +struct cell_global_id { + uint16_t mcc; + uint16_t mnc; + uint16_t lac; + uint16_t ci; +}; + +/* The BCCH info from an ip.access test, in host byte order + * and already parsed... */ +struct ipac_bcch_info { + struct llist_head list; + + uint16_t info_type; + uint8_t freq_qual; + uint16_t arfcn; + uint8_t rx_lev; + uint8_t rx_qual; + int16_t freq_err; + uint16_t frame_offset; + uint32_t frame_nr_offset; + uint8_t bsic; + struct cell_global_id cgi; + uint8_t ba_list_si2[16]; + uint8_t ba_list_si2bis[16]; + uint8_t ba_list_si2ter[16]; + uint8_t ca_list_si1[16]; +}; + +/* PUBLIC */ + +struct msgb; + +struct abis_nm_cfg { + /* callback for unidirectional reports */ + int (*report_cb)(struct msgb *, + struct abis_om_fom_hdr *); + /* callback for software activate requests from BTS */ + int (*sw_act_req)(struct msgb *); +}; + +extern int abis_nm_rcvmsg(struct msgb *msg); + +int abis_nm_tlv_parse(struct tlv_parsed *tp, struct gsm_bts *bts, const uint8_t *buf, int len); +int abis_nm_rx(struct msgb *msg); +int abis_nm_opstart(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, uint8_t i1, uint8_t i2); +int abis_nm_chg_adm_state(struct gsm_bts *bts, uint8_t obj_class, uint8_t i0, + uint8_t i1, uint8_t i2, enum abis_nm_adm_state adm_state); +int abis_nm_establish_tei(struct gsm_bts *bts, uint8_t trx_nr, + uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot, + uint8_t tei); +int abis_nm_conn_terr_sign(struct gsm_bts_trx *trx, + uint8_t e1_port, uint8_t e1_timeslot, uint8_t e1_subslot); +int abis_nm_conn_terr_traf(struct gsm_bts_trx_ts *ts, + uint8_t e1_port, uint8_t e1_timeslot, + uint8_t e1_subslot); +int abis_nm_set_bts_attr(struct gsm_bts *bts, uint8_t *attr, int attr_len); +int abis_nm_set_radio_attr(struct gsm_bts_trx *trx, uint8_t *attr, int attr_len); +int abis_nm_set_channel_attr(struct gsm_bts_trx_ts *ts, uint8_t chan_comb); +int abis_nm_sw_act_req_ack(struct gsm_bts *bts, uint8_t obj_class, uint8_t i1, + uint8_t i2, uint8_t i3, int nack, uint8_t *attr, int att_len); +int abis_nm_raw_msg(struct gsm_bts *bts, int len, uint8_t *msg); +int abis_nm_event_reports(struct gsm_bts *bts, int on); +int abis_nm_reset_resource(struct gsm_bts *bts); +int abis_nm_software_load(struct gsm_bts *bts, int trx_nr, const char *fname, + uint8_t win_size, int forced, + gsm_cbfn *cbfn, void *cb_data); +int abis_nm_software_load_status(struct gsm_bts *bts); +int abis_nm_software_activate(struct gsm_bts *bts, const char *fname, + gsm_cbfn *cbfn, void *cb_data); + +int abis_nm_conn_mdrop_link(struct gsm_bts *bts, uint8_t e1_port0, uint8_t ts0, + uint8_t e1_port1, uint8_t ts1); + +int abis_nm_perform_test(struct gsm_bts *bts, uint8_t obj_class, + uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, + uint8_t test_nr, uint8_t auton_report, struct msgb *msg); + +/* Siemens / BS-11 specific */ +int abis_nm_bs11_reset_resource(struct gsm_bts *bts); +int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin); +int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type, + uint8_t idx, uint8_t attr_len, const uint8_t *attr); +int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, uint8_t idx); +int abis_nm_bs11_create_bport(struct gsm_bts *bts, uint8_t idx); +int abis_nm_bs11_delete_object(struct gsm_bts *bts, + enum abis_bs11_objtype type, uint8_t idx); +int abis_nm_bs11_delete_bport(struct gsm_bts *bts, uint8_t idx); +int abis_nm_bs11_conn_oml_tei(struct gsm_bts *bts, uint8_t e1_port, + uint8_t e1_timeslot, uint8_t e1_subslot, uint8_t tei); +int abis_nm_bs11_get_oml_tei_ts(struct gsm_bts *bts); +int abis_nm_bs11_get_serno(struct gsm_bts *bts); +int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, uint8_t level); +int abis_nm_bs11_get_trx_power(struct gsm_bts_trx *trx); +int abis_nm_bs11_logon(struct gsm_bts *bts, uint8_t level, const char *name, int on); +int abis_nm_bs11_factory_logon(struct gsm_bts *bts, int on); +int abis_nm_bs11_infield_logon(struct gsm_bts *bts, int on); +int abis_nm_bs11_set_trx1_pw(struct gsm_bts *bts, const char *password); +int abis_nm_bs11_set_pll_locked(struct gsm_bts *bts, int locked); +int abis_nm_bs11_get_pll_mode(struct gsm_bts *bts); +int abis_nm_bs11_set_pll(struct gsm_bts *bts, int value); +int abis_nm_bs11_get_cclk(struct gsm_bts *bts); +int abis_nm_bs11_get_state(struct gsm_bts *bts); +int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname, + uint8_t win_size, int forced, gsm_cbfn *cbfn); +int abis_nm_bs11_set_ext_time(struct gsm_bts *bts); +int abis_nm_bs11_get_bport_line_cfg(struct gsm_bts *bts, uint8_t bport); +int abis_nm_bs11_set_bport_line_cfg(struct gsm_bts *bts, uint8_t bport, enum abis_bs11_line_cfg line_cfg); +int abis_nm_bs11_bsc_disconnect(struct gsm_bts *bts, int reconnect); +int abis_nm_bs11_restart(struct gsm_bts *bts); + +/* ip.access nanoBTS specific commands */ +int abis_nm_ipaccess_msg(struct gsm_bts *bts, uint8_t msg_type, + uint8_t obj_class, uint8_t bts_nr, + uint8_t trx_nr, uint8_t ts_nr, + uint8_t *attr, int attr_len); +int abis_nm_ipaccess_set_nvattr(struct gsm_bts_trx *trx, uint8_t *attr, + int attr_len); +int abis_nm_ipaccess_restart(struct gsm_bts_trx *trx); +int abis_nm_ipaccess_set_attr(struct gsm_bts *bts, uint8_t obj_class, + uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, + uint8_t *attr, uint8_t attr_len); +int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, + uint32_t ip, uint16_t port, uint8_t stream); +void abis_nm_ipaccess_cgi(uint8_t *buf, struct gsm_bts *bts); +int ipac_parse_bcch_info(struct ipac_bcch_info *binf, uint8_t *buf); +const char *ipacc_testres_name(uint8_t res); + +/* Functions calling into other code parts */ +int nm_is_running(struct gsm_nm_state *s); + +int abis_nm_vty_init(void); + +void abis_nm_clear_queue(struct gsm_bts *bts); + +int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml); + +void abis_nm_queue_send_next(struct gsm_bts *bts); /* for bs11_config. */ + +#endif /* _NM_H */ diff --git a/openbsc/include/openbsc/libbsc/abis_om2000.h b/openbsc/include/openbsc/libbsc/abis_om2000.h new file mode 100644 index 0000000..2ff7270 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/abis_om2000.h @@ -0,0 +1,98 @@ +#ifndef OPENBSC_ABIS_OM2K_H +#define OPENBSC_ABIS_OM2K_H +/* Ericsson RBS 2xxx GSM O&M (OM2000) messages on the A-bis interface + * implemented based on protocol trace analysis, no formal documentation */ + +/* (C) 2010-2011 by Harald Welte laforge@gnumonks.org + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +enum abis_om2k_mo_cls { + OM2K_MO_CLS_TRXC = 0x01, + OM2K_MO_CLS_TS = 0x03, + OM2K_MO_CLS_TF = 0x04, + OM2K_MO_CLS_IS = 0x05, + OM2K_MO_CLS_CON = 0x06, + OM2K_MO_CLS_DP = 0x07, + OM2K_MO_CLS_CF = 0x0a, + OM2K_MO_CLS_TX = 0x0b, + OM2K_MO_CLS_RX = 0x0c, +}; + +enum om2k_mo_state { + OM2K_MO_S_RESET = 0, + OM2K_MO_S_STARTED, + OM2K_MO_S_ENABLED, + OM2K_MO_S_DISABLED, +}; + +struct abis_om2k_mo { + uint8_t class; + uint8_t bts; + uint8_t assoc_so; + uint8_t inst; +} __attribute__ ((packed)); + +/* on-wire format for IS conn group */ +struct om2k_is_conn_grp { + uint16_t icp1; + uint16_t icp2; + uint8_t cont_idx; +} __attribute__ ((packed)); + +/* internal data formant for IS conn group */ +struct is_conn_group { + struct llist_head list; + uint16_t icp1; + uint16_t icp2; + uint8_t ci; +}; + +extern const struct abis_om2k_mo om2k_mo_cf; +extern const struct abis_om2k_mo om2k_mo_is; +extern const struct abis_om2k_mo om2k_mo_con; +extern const struct abis_om2k_mo om2k_mo_tf; + +extern const struct value_string om2k_mo_class_short_vals[]; + +int abis_om2k_rcvmsg(struct msgb *msg); + +extern const struct abis_om2k_mo om2k_mo_cf; + +int abis_om2k_tx_reset_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_start_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_status_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_connect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_disconnect_cmd(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_enable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo); +int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo, + uint8_t operational); +int abis_om2k_tx_is_conf_req(struct gsm_bts *bts); +int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts); +int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx); +int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx); +int abis_om2k_tx_ts_conf_req(struct gsm_bts_trx_ts *ts); + +int abis_om2k_vty_init(void); + +struct vty; +void abis_om2k_config_write_bts(struct vty *vty, struct gsm_bts *bts); + +#endif /* OPENBCS_ABIS_OM2K_H */ diff --git a/openbsc/include/openbsc/libbsc/abis_rsl.h b/openbsc/include/openbsc/libbsc/abis_rsl.h new file mode 100644 index 0000000..bf1df5e --- /dev/null +++ b/openbsc/include/openbsc/libbsc/abis_rsl.h @@ -0,0 +1,101 @@ +/* GSM Radio Signalling Link messages on the A-bis interface + * 3GPP TS 08.58 version 8.6.0 Release 1999 / ETSI TS 100 596 V8.6.0 */ + +/* (C) 2008 by Harald Welte laforge@gnumonks.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef _RSL_H +#define _RSL_H + +#include <osmocom/gsm/protocol/gsm_08_58.h> + +#include <osmocom/core/msgb.h> + +struct gsm_bts; +struct gsm_lchan; +struct gsm_subscriber; +struct gsm_bts_trx_ts; + + +int rsl_bcch_info(struct gsm_bts_trx *trx, uint8_t type, + const uint8_t *data, int len); +int rsl_sacch_filling(struct gsm_bts_trx *trx, uint8_t type, + const uint8_t *data, int len); +int rsl_chan_activate(struct gsm_bts_trx *trx, uint8_t chan_nr, + uint8_t act_type, + struct rsl_ie_chan_mode *chan_mode, + struct rsl_ie_chan_ident *chan_ident, + uint8_t bs_power, uint8_t ms_power, + uint8_t ta); +int rsl_chan_activate_lchan(struct gsm_lchan *lchan, uint8_t act_type, + uint8_t ta, uint8_t ho_ref); +int rsl_chan_mode_modify_req(struct gsm_lchan *ts); +int rsl_encryption_cmd(struct msgb *msg); +int rsl_paging_cmd(struct gsm_bts *bts, uint8_t paging_group, uint8_t len, + uint8_t *ms_ident, uint8_t chan_needed); +int rsl_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val); + +int rsl_data_request(struct msgb *msg, uint8_t link_id); +int rsl_establish_request(struct gsm_lchan *lchan, uint8_t link_id); +int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id); + +/* Siemens vendor-specific RSL extensions */ +int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); + +/* ip.access specfic RSL extensions */ +int rsl_ipacc_crcx(struct gsm_lchan *lchan); +int rsl_ipacc_mdcx(struct gsm_lchan *lchan, uint32_t ip, + uint16_t port, uint8_t rtp_payload2); +int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan); +int rsl_ipacc_pdch_activate(struct gsm_bts_trx_ts *ts, int act); + +int abis_rsl_rcvmsg(struct msgb *msg); + +uint64_t str_to_imsi(const char *imsi_str); +int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id, uint8_t reason); + +int rsl_lchan_set_state(struct gsm_lchan *lchan, int); + +/* to be provided by external code */ +int abis_rsl_sendmsg(struct msgb *msg); +int rsl_deact_sacch(struct gsm_lchan *lchan); +int rsl_lchan_rll_release(struct gsm_lchan *lchan, uint8_t link_id); + +/* BCCH related code */ +int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf); +int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf); + +int rsl_sacch_info_modify(struct gsm_lchan *lchan, uint8_t type, + const uint8_t *data, int len); + +int rsl_chan_bs_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int db); +int rsl_chan_ms_power_ctrl(struct gsm_lchan *lchan, unsigned int fpc, int dbm); + +/* SMSCB functionality */ +int rsl_sms_cb_command(struct gsm_bts *bts, uint8_t chan_number, + uint8_t cb_command, const uint8_t *data, int len); + +/* some Nokia specific stuff */ +int rsl_nokia_si_begin(struct gsm_bts_trx *trx); +int rsl_nokia_si_end(struct gsm_bts_trx *trx); + +/* required for Nokia BTS power control */ +int rsl_bs_power_control(struct gsm_bts_trx *trx, uint8_t channel, uint8_t reduction); + +#endif /* RSL_MT_H */ + diff --git a/openbsc/include/openbsc/libbsc/bsc_api.h b/openbsc/include/openbsc/libbsc/bsc_api.h new file mode 100644 index 0000000..36ec370 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/bsc_api.h @@ -0,0 +1,37 @@ +/* GSM 08.08 like API for OpenBSC */ + +#ifndef OPENBSC_BSC_API_H +#define OPENBSC_BSC_API_H + +#include "gsm_data.h" + +#define BSC_API_CONN_POL_ACCEPT 0 +#define BSC_API_CONN_POL_REJECT 1 + +struct bsc_api { + void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci); + void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn, + struct msgb *msg, uint8_t chosen_encr); + int (*compl_l3)(struct gsm_subscriber_connection *conn, + struct msgb *msg, uint16_t chosen_channel); + void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id, + struct msgb *msg); + void (*assign_compl)(struct gsm_subscriber_connection *conn, + uint8_t rr_cause, uint8_t chosen_channel, + uint8_t encr_alg_id, uint8_t speech_mode); + void (*assign_fail)(struct gsm_subscriber_connection *conn, + uint8_t cause, uint8_t *rr_cause); + int (*clear_request)(struct gsm_subscriber_connection *conn, + uint32_t cause); +}; + +int bsc_api_init(struct gsm_network *network, struct bsc_api *api); +int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, struct msgb *msg, int link_id, int allow_sach); +int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate); +int gsm0808_cipher_mode(struct gsm_subscriber_connection *conn, int cipher, + const uint8_t *key, int len, int include_imeisv); +int gsm0808_page(struct gsm_bts *bts, unsigned int page_group, + unsigned int mi_len, uint8_t *mi, int chan_type); +int gsm0808_clear(struct gsm_subscriber_connection *conn); + +#endif diff --git a/openbsc/include/openbsc/libbsc/bsc_msc.h b/openbsc/include/openbsc/libbsc/bsc_msc.h new file mode 100644 index 0000000..9543002 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/bsc_msc.h @@ -0,0 +1,59 @@ +/* Routines to talk to the MSC using the IPA Protocol */ +/* + * (C) 2010 by Holger Hans Peter Freyther zecke@selfish.org + * (C) 2010 by On-Waves + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef BSC_MSC_H +#define BSC_MSC_H + +#include <osmocom/core/write_queue.h> +#include <osmocom/core/timer.h> + +struct bsc_msc_dest { + struct llist_head list; + + char *ip; + int port; + int dscp; +}; + + +struct bsc_msc_connection { + struct osmo_wqueue write_queue; + int is_connected; + int is_authenticated; + int first_contact; + + struct llist_head *dests; + + void (*connection_loss) (struct bsc_msc_connection *); + void (*connected) (struct bsc_msc_connection *); + struct osmo_timer_list reconnect_timer; + struct osmo_timer_list timeout_timer; +}; + +struct bsc_msc_connection *bsc_msc_create(void *ctx, struct llist_head *dest); +int bsc_msc_connect(struct bsc_msc_connection *); +void bsc_msc_schedule_connect(struct bsc_msc_connection *); + +void bsc_msc_lost(struct bsc_msc_connection *); + +struct msgb *bsc_msc_id_get_resp(const char *token); + +#endif diff --git a/openbsc/include/openbsc/libbsc/bsc_rll.h b/openbsc/include/openbsc/libbsc/bsc_rll.h new file mode 100644 index 0000000..729ba60 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/bsc_rll.h @@ -0,0 +1,19 @@ +#ifndef _BSC_RLL_H +#define _BSC_RLL_H + +#include <openbsc/gsm_data.h> + +enum bsc_rllr_ind { + BSC_RLLR_IND_EST_CONF, + BSC_RLLR_IND_REL_IND, + BSC_RLLR_IND_ERR_IND, + BSC_RLLR_IND_TIMEOUT, +}; + +int rll_establish(struct gsm_lchan *lchan, uint8_t link_id, + void (*cb)(struct gsm_lchan *, uint8_t, void *, + enum bsc_rllr_ind), + void *data); +void rll_indication(struct gsm_lchan *lchan, uint8_t link_id, uint8_t type); + +#endif /* _BSC_RLL_H */ diff --git a/openbsc/include/openbsc/libbsc/chan_alloc.h b/openbsc/include/openbsc/libbsc/chan_alloc.h new file mode 100644 index 0000000..5eda312 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/chan_alloc.h @@ -0,0 +1,65 @@ +/* Management functions to allocate/release struct gsm_lchan */ +/* (C) 2008 by Harald Welte laforge@gnumonks.org + * (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ +#ifndef _CHAN_ALLOC_H +#define _CHAN_ALLOC_H + +#include "gsm_data.h" + +struct gsm_subscriber_connection; + +/* Special allocator for C0 of BTS */ +struct gsm_bts_trx_ts *ts_c0_alloc(struct gsm_bts *bts, + enum gsm_phys_chan_config pchan); + +/* Regular physical channel allocator */ +struct gsm_bts_trx_ts *ts_alloc(struct gsm_bts *bts, + enum gsm_phys_chan_config pchan); + +/* Regular physical channel (TS) */ +void ts_free(struct gsm_bts_trx_ts *ts); + +/* Find an allocated channel for a specified subscriber */ +struct gsm_subscriber_connection *connection_for_subscr(struct gsm_subscriber *subscr); + +/* Allocate a logical channel (SDCCH, TCH, ...) */ +struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type, int allow_bigger); + +/* Free a logical channel (SDCCH, TCH, ...) */ +void lchan_free(struct gsm_lchan *lchan); +void lchan_reset(struct gsm_lchan *lchan); + +/* Release the given lchan */ +int lchan_release(struct gsm_lchan *lchan, int sach_deact, int reason); + +struct load_counter { + unsigned int total; + unsigned int used; +}; + +struct pchan_load { + struct load_counter pchan[GSM_PCHAN_UNKNOWN]; +}; + +void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); +void network_chan_load(struct pchan_load *pl, struct gsm_network *net); + +int trx_is_usable(struct gsm_bts_trx *trx); + +#endif /* _CHAN_ALLOC_H */ diff --git a/openbsc/include/openbsc/libbsc/meas_rep.h b/openbsc/include/openbsc/libbsc/meas_rep.h new file mode 100644 index 0000000..f235df6 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/meas_rep.h @@ -0,0 +1,87 @@ +#ifndef _MEAS_REP_H +#define _MEAS_REP_H + +#include <stdint.h> + +#define MRC_F_PROCESSED 0x0001 + +/* extracted from a L3 measurement report IE */ +struct gsm_meas_rep_cell { + uint8_t rxlev; + uint8_t bsic; + uint8_t neigh_idx; + uint16_t arfcn; + unsigned int flags; +}; + +/* RX Level and RX Quality */ +struct gsm_rx_lev_qual { + uint8_t rx_lev; + uint8_t rx_qual; +}; + +/* unidirectional measumrement report */ +struct gsm_meas_rep_unidir { + struct gsm_rx_lev_qual full; + struct gsm_rx_lev_qual sub; +}; + +#define MEAS_REP_F_UL_DTX 0x01 +#define MEAS_REP_F_DL_VALID 0x02 +#define MEAS_REP_F_BA1 0x04 +#define MEAS_REP_F_DL_DTX 0x08 +#define MEAS_REP_F_MS_TO 0x10 +#define MEAS_REP_F_MS_L1 0x20 +#define MEAS_REP_F_FPC 0x40 + +/* parsed uplink and downlink measurement result */ +struct gsm_meas_rep { + /* back-pointer to the logical channel */ + struct gsm_lchan *lchan; + + /* number of the measurement report */ + uint8_t nr; + /* flags, see MEAS_REP_F_* */ + unsigned int flags; + + /* uplink and downlink rxlev, rxqual; full and sub */ + struct gsm_meas_rep_unidir ul; + struct gsm_meas_rep_unidir dl; + + uint8_t bs_power; + uint8_t ms_timing_offset; + struct { + int8_t pwr; /* MS power in dBm */ + uint8_t ta; /* MS timing advance */ + } ms_l1; + + /* neighbor measurement reports for up to 6 cells */ + int num_cell; + struct gsm_meas_rep_cell cell[6]; +}; + +enum meas_rep_field { + MEAS_REP_DL_RXLEV_FULL, + MEAS_REP_DL_RXLEV_SUB, + MEAS_REP_DL_RXQUAL_FULL, + MEAS_REP_DL_RXQUAL_SUB, + MEAS_REP_UL_RXLEV_FULL, + MEAS_REP_UL_RXLEV_SUB, + MEAS_REP_UL_RXQUAL_FULL, + MEAS_REP_UL_RXQUAL_SUB, +}; + +/* obtain an average over the last 'num' fields in the meas reps */ +int get_meas_rep_avg(const struct gsm_lchan *lchan, + enum meas_rep_field field, unsigned int num); + +/* Check if N out of M last values for FIELD are >= bd */ +int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan, + enum meas_rep_field field, + unsigned int n, unsigned int m, int be); + +unsigned int calc_initial_idx(unsigned int array_size, + unsigned int meas_rep_idx, + unsigned int num_values); + +#endif /* _MEAS_REP_H */ diff --git a/openbsc/include/openbsc/libbsc/paging.h b/openbsc/include/openbsc/libbsc/paging.h new file mode 100644 index 0000000..e1438ba --- /dev/null +++ b/openbsc/include/openbsc/libbsc/paging.h @@ -0,0 +1,73 @@ +/* Paging helper and manager.... */ +/* (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef PAGING_H +#define PAGING_H + +#include <stdlib.h> +#include <string.h> + +#include <osmocom/core/linuxlist.h> +#include "gsm_data.h" +#include "gsm_subscriber.h" +#include <osmocom/core/timer.h> + +/** + * A pending paging request + */ +struct gsm_paging_request { + /* list_head for list of all paging requests */ + struct llist_head entry; + /* the subscriber which we're paging. Later gsm_paging_request + * should probably become a part of the gsm_subscriber struct? */ + struct gsm_subscriber *subscr; + /* back-pointer to the BTS on which we are paging */ + struct gsm_bts *bts; + /* what kind of channel type do we ask the MS to establish */ + int chan_type; + + /* Timer 3113: how long do we try to page? */ + struct osmo_timer_list T3113; + + /* How often did we ask the BTS to page? */ + int attempts; + + /* callback to be called in case paging completes */ + gsm_cbfn *cbfn; + void *cbfn_param; +}; + +/* schedule paging request */ +int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, + int type, gsm_cbfn *cbfn, void *data); + +/* stop paging requests */ +void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, + struct gsm_subscriber_connection *conn, + struct msgb *msg); + +/* update paging load */ +void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); + +/* pending paging requests */ +unsigned int paging_pending_requests_nr(struct gsm_bts *bts); + +void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr); + +#endif diff --git a/openbsc/include/openbsc/libbsc/rest_octets.h b/openbsc/include/openbsc/libbsc/rest_octets.h new file mode 100644 index 0000000..2d16a1f --- /dev/null +++ b/openbsc/include/openbsc/libbsc/rest_octets.h @@ -0,0 +1,132 @@ +#ifndef _REST_OCTETS_H +#define _REST_OCTETS_H + +#include <openbsc/gsm_04_08.h> + +/* generate SI1 rest octets */ +int rest_octets_si1(uint8_t *data, uint8_t *nch_pos); + +struct gsm48_si_selection_params { + uint16_t penalty_time:5, + temp_offs:3, + cell_resel_off:6, + cbq:1, + present:1; +}; + +struct gsm48_si_power_offset { + uint8_t power_offset:2, + present:1; +}; + +struct gsm48_si3_gprs_ind { + uint8_t si13_position:1, + ra_colour:3, + present:1; +}; + +struct gsm48_lsa_params { + uint32_t prio_thr:3, + lsa_offset:3, + mcc:12, + mnc:12; + unsigned int present; +}; + +struct gsm48_si_ro_info { + struct gsm48_si_selection_params selection_params; + struct gsm48_si_power_offset power_offset; + uint8_t si2ter_indicator; + uint8_t early_cm_ctrl; + struct { + uint8_t where:3, + present:1; + } scheduling; + struct gsm48_si3_gprs_ind gprs_ind; + + /* SI 4 specific */ + struct gsm48_lsa_params lsa_params; + uint16_t cell_id; + uint8_t break_ind; /* do we have SI7 + SI8 ? */ +}; + + +/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ +int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3); + +/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ +int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4); + +enum pbcch_carrier_type { + PBCCH_BCCH, + PBCCH_ARFCN, + PBCCH_MAIO +}; + +/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */ +enum gprs_nmo { + GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */ + GPRS_NMO_II = 1, /* all paging on CCCH */ + GPRS_NMO_III = 2, /* no paging coordination */ +}; + +/* TS 04.60 12.24 */ +struct gprs_cell_options { + enum gprs_nmo nmo; + /* T3168: wait for packet uplink assignment message */ + uint32_t t3168; /* in milliseconds */ + /* T3192: wait for release of the TBF after reception of the final block */ + uint32_t t3192; /* in milliseconds */ + uint32_t drx_timer_max;/* in seconds */ + uint32_t bs_cv_max; + + uint8_t ext_info_present; + struct { + uint8_t egprs_supported; + uint8_t use_egprs_p_ch_req; + uint8_t bep_period; + uint8_t pfc_supported; + uint8_t dtm_supported; + uint8_t bss_paging_coordination; + } ext_info; +}; + +/* TS 04.60 Table 12.9.2 */ +struct gprs_power_ctrl_pars { + uint8_t alpha; + uint8_t t_avg_w; + uint8_t t_avg_t; + uint8_t pc_meas_chan; + uint8_t n_avg_i; +}; + +struct gsm48_si13_info { + struct gprs_cell_options cell_opts; + struct gprs_power_ctrl_pars pwr_ctrl_pars; + uint8_t bcch_change_mark; + uint8_t si_change_field; + uint8_t pbcch_present; + + union { + struct { + uint8_t rac; + uint8_t spgc_ccch_sup; + uint8_t net_ctrl_ord; + uint8_t prio_acc_thr; + } no_pbcch; + struct { + uint8_t psi1_rep_per; + uint8_t pb; + uint8_t tsc; + uint8_t tn; + enum pbcch_carrier_type carrier_type; + uint16_t arfcn; + uint8_t maio; + } pbcch; + }; +}; + +/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ +int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13); + +#endif /* _REST_OCTETS_H */ diff --git a/openbsc/include/openbsc/libbsc/system_information.h b/openbsc/include/openbsc/libbsc/system_information.h new file mode 100644 index 0000000..6a56848 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/system_information.h @@ -0,0 +1,10 @@ +#ifndef _SYSTEM_INFO_H +#define _SYSTEM_INFO_H + +#include <osmocom/gsm/sysinfo.h> + +struct gsm_bts; + +int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); + +#endif diff --git a/openbsc/include/openbsc/libcommon/debug.h b/openbsc/include/openbsc/libcommon/debug.h new file mode 100644 index 0000000..43f0ff8 --- /dev/null +++ b/openbsc/include/openbsc/libcommon/debug.h @@ -0,0 +1,67 @@ +#ifndef _DEBUG_H +#define _DEBUG_H + +#include <stdio.h> +#include <osmocom/core/linuxlist.h> + +#define DEBUG +#include <osmocom/core/logging.h> + +/* Debug Areas of the code */ +enum { + DRLL, + DCC, + DMM, + DRR, + DRSL, + DNM, + DMNCC, + DSMS, + DPAG, + DMEAS, + DSCCP, + DMSC, + DMGCP, + DHO, + DDB, + DREF, + DGPRS, + DNS, + DBSSGP, + DLLC, + DSNDCP, + DNAT, + DCTRL, + Debug_LastEntry, +}; + +/* context */ +#define BSC_CTX_LCHAN 0 +#define BSC_CTX_SUBSCR 1 +#define BSC_CTX_BTS 2 +#define BSC_CTX_SCCP 3 +#define BSC_CTX_NSVC 4 +#define BSC_CTX_BVC 5 + +/* target */ + +enum { + //DEBUG_FILTER_ALL = 1 << 0, + LOG_FILTER_IMSI = 1 << 1, + LOG_FILTER_NSVC = 1 << 2, + LOG_FILTER_BVC = 1 << 3, +}; + +/* we don't need a header dependency for this... */ +struct gprs_nsvc; +struct bssgp_bvc_ctx; + +void log_set_imsi_filter(struct log_target *target, const char *imsi); +void log_set_nsvc_filter(struct log_target *target, + struct gprs_nsvc *nsvc); +void log_set_bvc_filter(struct log_target *target, + struct bssgp_bvc_ctx *bctx); + +extern const struct log_info log_info; + +#endif /* _DEBUG_H */ diff --git a/openbsc/include/openbsc/libcommon/gsm_data.h b/openbsc/include/openbsc/libcommon/gsm_data.h new file mode 100644 index 0000000..f74ece8 --- /dev/null +++ b/openbsc/include/openbsc/libcommon/gsm_data.h @@ -0,0 +1,388 @@ +#ifndef _GSM_DATA_H +#define _GSM_DATA_H + +#include <stdint.h> + +#include <osmocom/core/timer.h> +#include <osmocom/core/select.h> + +#include <openbsc/rest_octets.h> +#include <osmocom/abis/e1_input.h> + +#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3] + +/* the data structure stored in msgb->cb for openbsc apps */ +struct openbsc_msgb_cb { + unsigned char *bssgph; + unsigned char *llch; + + /* Cell Identifier */ + unsigned char *bssgp_cell_id; + + /* Identifiers of a BTS, equal to 'struct bssgp_bts_ctx' */ + uint16_t nsei; + uint16_t bvci; + + /* Identifier of a MS (inside BTS), equal to 'struct sgsn_mm_ctx' */ + uint32_t tlli; +} __attribute__((packed)); +#define OBSC_MSGB_CB(__msgb) ((struct openbsc_msgb_cb *)&((__msgb)->cb[0])) +#define msgb_tlli(__x) OBSC_MSGB_CB(__x)->tlli +#define msgb_nsei(__x) OBSC_MSGB_CB(__x)->nsei +#define msgb_bvci(__x) OBSC_MSGB_CB(__x)->bvci +#define msgb_gmmh(__x) (__x)->l3h +#define msgb_bssgph(__x) OBSC_MSGB_CB(__x)->bssgph +#define msgb_bssgp_len(__x) ((__x)->tail - (uint8_t *)msgb_bssgph(__x)) +#define msgb_bcid(__x) OBSC_MSGB_CB(__x)->bssgp_cell_id +#define msgb_llch(__x) OBSC_MSGB_CB(__x)->llch + +#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3] + +enum gsm_security_event { + GSM_SECURITY_NOAVAIL, + GSM_SECURITY_AUTH_FAILED, + GSM_SECURITY_SUCCEEDED, +}; + +struct msgb; +typedef int gsm_cbfn(unsigned int hooknum, + unsigned int event, + struct msgb *msg, + void *data, void *param); + +/* Real authentication information containing Ki */ +enum gsm_auth_algo { + AUTH_ALGO_NONE, + AUTH_ALGO_XOR, + AUTH_ALGO_COMP128v1, +}; + +struct gsm_auth_info { + enum gsm_auth_algo auth_algo; + unsigned int a3a8_ki_len; + uint8_t a3a8_ki[16]; +}; + +struct gsm_auth_tuple { + int use_count; + int key_seq; + uint8_t rand[16]; + uint8_t sres[4]; + uint8_t kc[8]; +}; +#define GSM_KEY_SEQ_INVAL 7 /* GSM 04.08 - 10.5.1.2 */ + +/* + * LOCATION UPDATING REQUEST state + * + * Our current operation is: + * - Get imei/tmsi + * - Accept/Reject according to global policy + */ +struct gsm_loc_updating_operation { + struct osmo_timer_list updating_timer; + unsigned int waiting_for_imsi : 1; + unsigned int waiting_for_imei : 1; + unsigned int key_seq : 4; +}; + +/* + * AUTHENTICATION/CIPHERING state + */ +struct gsm_security_operation { + struct gsm_auth_tuple atuple; + gsm_cbfn *cb; + void *cb_data; +}; + +/* + * A dummy to keep a connection up for at least + * a couple of seconds to work around MSC issues. + */ +struct gsm_anchor_operation { + struct osmo_timer_list timeout; +}; + +/* Maximum number of neighbor cells whose average we track */ +#define MAX_NEIGH_MEAS 10 +/* Maximum size of the averaging window for neighbor cells */ +#define MAX_WIN_NEIGH_AVG 10 + +/* processed neighbor measurements for one cell */ +struct neigh_meas_proc { + uint16_t arfcn; + uint8_t bsic; + uint8_t rxlev[MAX_WIN_NEIGH_AVG]; + unsigned int rxlev_cnt; + uint8_t last_seen_nr; +}; + +/* the per subscriber data for lchan */ +struct gsm_subscriber_connection { + struct llist_head entry; + + /* To whom we are allocated at the moment */ + struct gsm_subscriber *subscr; + + /* + * Operations that have a state and might be pending + */ + struct gsm_loc_updating_operation *loc_operation; + struct gsm_security_operation *sec_operation; + struct gsm_anchor_operation *anch_operation; + + /* Are we part of a special "silent" call */ + int silent_call; + int put_channel; + + /* bsc structures */ + struct osmo_bsc_sccp_con *sccp_con; + + /* back pointers */ + int in_release; + struct gsm_lchan *lchan; + struct gsm_lchan *ho_lchan; + struct gsm_bts *bts; + + /* for assignment handling */ + struct osmo_timer_list T10; + struct gsm_lchan *secondary_lchan; + +}; + + +#define ROLE_BSC +#include "gsm_data_shared.h" + + +/* Some statistics of our network */ +struct gsmnet_stats { + struct { + struct osmo_counter *total; + struct osmo_counter *no_channel; + } chreq; + struct { + struct osmo_counter *attempted; + struct osmo_counter *no_channel; /* no channel available */ + struct osmo_counter *timeout; /* T3103 timeout */ + struct osmo_counter *completed; /* HO COMPL received */ + struct osmo_counter *failed; /* HO FAIL received */ + } handover; + struct { + struct osmo_counter *attach; + struct osmo_counter *normal; + struct osmo_counter *periodic; + struct osmo_counter *detach; + } loc_upd_type; + struct { + struct osmo_counter *reject; + struct osmo_counter *accept; + } loc_upd_resp; + struct { + struct osmo_counter *attempted; + struct osmo_counter *detached; + struct osmo_counter *completed; + struct osmo_counter *expired; + } paging; + struct { + struct osmo_counter *submitted; /* MO SMS submissions */ + struct osmo_counter *no_receiver; + struct osmo_counter *delivered; /* MT SMS deliveries */ + struct osmo_counter *rp_err_mem; + struct osmo_counter *rp_err_other; + } sms; + struct { + struct osmo_counter *mo_setup; + struct osmo_counter *mo_connect_ack; + struct osmo_counter *mt_setup; + struct osmo_counter *mt_connect; + } call; + struct { + struct osmo_counter *rf_fail; + struct osmo_counter *rll_err; + } chan; + struct { + struct osmo_counter *oml_fail; + struct osmo_counter *rsl_fail; + } bts; +}; + +enum gsm_auth_policy { + GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */ + GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */ + GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */ +}; + +#define GSM_T3101_DEFAULT 10 +#define GSM_T3113_DEFAULT 60 + +struct gsm_network { + /* global parameters */ + uint16_t country_code; + uint16_t network_code; + char *name_long; + char *name_short; + enum gsm_auth_policy auth_policy; + enum gsm48_reject_value reject_cause; + int a5_encryption; + int neci; + int send_mm_info; + struct { + int active; + /* Window RXLEV averaging */ + unsigned int win_rxlev_avg; /* number of SACCH frames */ + /* Window RXQUAL averaging */ + unsigned int win_rxqual_avg; /* number of SACCH frames */ + /* Window RXLEV neighbouring cells averaging */ + unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */ + + /* how often should we check for power budget HO */ + unsigned int pwr_interval; /* SACCH frames */ + /* how much better does a neighbor cell have to be ? */ + unsigned int pwr_hysteresis; /* dBm */ + /* maximum distacne before we try a handover */ + unsigned int max_distance; /* TA values */ + } handover; + + struct gsmnet_stats stats; + + /* layer 4 */ + int (*mncc_recv) (struct gsm_network *net, struct msgb *msg); + struct llist_head upqueue; + struct llist_head trans_list; + struct bsc_api *bsc_api; + + unsigned int num_bts; + struct llist_head bts_list; + + /* timer values */ + int T3101; + int T3103; + int T3105; + int T3107; + int T3109; + int T3111; + int T3113; + int T3115; + int T3117; + int T3119; + int T3122; + int T3141; + + /* Radio Resource Location Protocol (TS 04.31) */ + struct { + enum rrlp_mode mode; + } rrlp; + + /* enable the DTXu and DTXd for this network */ + int dtx_enabled; + + enum gsm_chan_t ctype_by_chreq[16]; + + /* Use a TCH for handling requests of type paging any */ + int pag_any_tch; + + /* MSC data in case we are a true BSC */ + struct osmo_msc_data *msc_data; + + /* subscriber related features */ + int keep_subscr; + struct gsm_sms_queue *sms_queue; +}; + +#define SMS_HDR_SIZE 128 +#define SMS_TEXT_SIZE 256 +struct gsm_sms { + unsigned long long id; + struct gsm_subscriber *sender; + struct gsm_subscriber *receiver; + + unsigned long validity_minutes; + uint8_t reply_path_req; + uint8_t status_rep_req; + uint8_t ud_hdr_ind; + uint8_t protocol_id; + uint8_t data_coding_scheme; + uint8_t msg_ref; + char dest_addr[20+1]; /* DA LV is 12 bytes max, i.e. 10 bytes + * BCD == 20 bytes string */ + uint8_t user_data_len; + uint8_t user_data[SMS_TEXT_SIZE]; + + char text[SMS_TEXT_SIZE]; +}; + +struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code, + int (*mncc_recv)(struct gsm_network *, struct msgb *)); +int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); + +struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); + +/* Get reference to a neighbor cell on a given BCCH ARFCN */ +struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, + uint16_t arfcn, uint8_t bsic); + +enum gsm_bts_type parse_btstype(const char *arg); +const char *btstype2str(enum gsm_bts_type type); +struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac, + struct gsm_bts *start_bts); + +extern void *tall_bsc_ctx; +extern int ipacc_rtp_direct; + +static inline int is_ipaccess_bts(struct gsm_bts *bts) +{ + switch (bts->type) { + case GSM_BTS_TYPE_NANOBTS: + return 1; + default: + break; + } + return 0; +} + +static inline int is_siemens_bts(struct gsm_bts *bts) +{ + switch (bts->type) { + case GSM_BTS_TYPE_BS11: + return 1; + default: + break; + } + + return 0; +} + +enum gsm_auth_policy gsm_auth_policy_parse(const char *arg); +const char *gsm_auth_policy_name(enum gsm_auth_policy policy); + +enum rrlp_mode rrlp_mode_parse(const char *arg); +const char *rrlp_mode_name(enum rrlp_mode mode); + +enum bts_gprs_mode bts_gprs_mode_parse(const char *arg); +const char *bts_gprs_mode_name(enum bts_gprs_mode mode); + +int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts); +void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); +struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan); + +int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); +int gsm_bts_model_register(struct gsm_bts_model *model); + +struct gsm_subscriber_connection *subscr_con_allocate(struct gsm_lchan *lchan); +void subscr_con_free(struct gsm_subscriber_connection *conn); + +struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, + enum gsm_bts_type type, + uint8_t tsc, uint8_t bsic); +void set_ts_e1link(struct gsm_bts_trx_ts *ts, uint8_t e1_nr, + uint8_t e1_ts, uint8_t e1_ts_ss); + +void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); +int gsm_bts_has_feature(struct gsm_bts *bts, enum gsm_bts_features feat); +struct gsm_bts_trx *gsm_bts_trx_by_nr(struct gsm_bts *bts, int nr); + +/* generic E1 line operations for all ISDN-based BTS. */ +extern struct e1inp_line_ops bts_isdn_e1inp_line_ops; + +#endif /* _GSM_DATA_H */ diff --git a/openbsc/include/openbsc/libcommon/gsm_data_shared.h b/openbsc/include/openbsc/libcommon/gsm_data_shared.h new file mode 100644 index 0000000..ca88fed --- /dev/null +++ b/openbsc/include/openbsc/libcommon/gsm_data_shared.h @@ -0,0 +1,602 @@ +#ifndef _GSM_DATA_SHAREDH +#define _GSM_DATA_SHAREDH + +#include <regex.h> +#include <stdbool.h> +#include <stdint.h> + +#include <osmocom/core/timer.h> +#include <osmocom/core/bitvec.h> +#include <osmocom/core/statistics.h> +#include <osmocom/core/utils.h> +#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/tlv.h> +#include <osmocom/gsm/rxlev_stat.h> +#include <osmocom/gsm/sysinfo.h> + +#include <osmocom/gsm/protocol/gsm_08_58.h> +#include <osmocom/gsm/protocol/gsm_12_21.h> + +#include <osmocom/abis/e1_input.h> + +struct osmo_msc_data; +struct osmo_bsc_sccp_con; +struct gsm_sms_queue; + +/* RRLP mode of operation */ +enum rrlp_mode { + RRLP_MODE_NONE, + RRLP_MODE_MS_BASED, + RRLP_MODE_MS_PREF, + RRLP_MODE_ASS_PREF, +}; + +/* Channel Request reason */ +enum gsm_chreq_reason_t { + GSM_CHREQ_REASON_EMERG, + GSM_CHREQ_REASON_PAG, + GSM_CHREQ_REASON_CALL, + GSM_CHREQ_REASON_LOCATION_UPD, + GSM_CHREQ_REASON_OTHER, +}; + +#define TRX_NR_TS 8 +#define TS_MAX_LCHAN 8 + +#define HARDCODED_ARFCN 123 +#define HARDCODED_TSC 7 +#define HARDCODED_BSIC 0x3f /* NCC = 7 / BCC = 7 */ + +/* for multi-drop config */ +#define HARDCODED_BTS0_TS 1 +#define HARDCODED_BTS1_TS 6 +#define HARDCODED_BTS2_TS 11 + +/* reserved according to GSM 03.03 § 2.4 */ +#define GSM_RESERVED_TMSI 0xFFFFFFFF + +enum gsm_hooks { + GSM_HOOK_NM_SWLOAD, + GSM_HOOK_RR_PAGING, + GSM_HOOK_RR_SECURITY, +}; + +enum gsm_paging_event { + GSM_PAGING_SUCCEEDED, + GSM_PAGING_EXPIRED, + GSM_PAGING_OOM, + GSM_PAGING_BUSY, +}; + +enum bts_gprs_mode { + BTS_GPRS_NONE = 0, + BTS_GPRS_GPRS = 1, + BTS_GPRS_EGPRS = 2, +}; + +struct gsm_lchan; +struct gsm_subscriber; +struct gsm_mncc; +struct rtp_socket; +struct bsc_api; + +/* Network Management State */ +struct gsm_nm_state { + uint8_t operational; + uint8_t administrative; + uint8_t availability; +}; + +struct gsm_abis_mo { + uint8_t obj_class; + struct abis_om_obj_inst obj_inst; + const char *name; + struct gsm_nm_state nm_state; + struct tlv_parsed *nm_attr; + struct gsm_bts *bts; +}; + +#define MAX_A5_KEY_LEN (128/8) +#define A38_XOR_MIN_KEY_LEN 12 +#define A38_XOR_MAX_KEY_LEN 16 +#define A38_COMP128_KEY_LEN 16 +#define RSL_ENC_ALG_A5(x) (x+1) + +/* is the data link established? who established it? */ +#define LCHAN_SAPI_UNUSED 0 +#define LCHAN_SAPI_MS 1 +#define LCHAN_SAPI_NET 2 + +/* state of a logical channel */ +enum gsm_lchan_state { + LCHAN_S_NONE, /* channel is not active */ + LCHAN_S_ACT_REQ, /* channel activatin requested */ + LCHAN_S_ACTIVE, /* channel is active and operational */ + LCHAN_S_REL_REQ, /* channel release has been requested */ + LCHAN_S_REL_ERR, /* channel is in an error state */ + LCHAN_S_INACTIVE, /* channel is set inactive */ +}; + +/* BTS ONLY */ +#define MAX_NUM_UL_MEAS 104 +#define LC_UL_M_F_L1_VALID (1 << 0) +#define LC_UL_M_F_RES_VALID (1 << 1) + +struct bts_ul_meas { + /* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */ + uint16_t ber10k; + /* timing advance offset (in quarter bits) */ + int16_t ta_offs_qbits; + /* C/I ratio in dB */ + float c_i; + /* flags */ + uint8_t is_sub:1; + /* RSSI in dBm * -1 */ + uint8_t inv_rssi; +}; +/* /BTS ONLY */ + +struct gsm_lchan { + /* The TS that we're part of */ + struct gsm_bts_trx_ts *ts; + /* The logical subslot number in the TS */ + uint8_t nr; + /* The logical channel type */ + enum gsm_chan_t type; + /* RSL channel mode */ + enum rsl_cmod_spd rsl_cmode; + /* If TCH, traffic channel mode */ + enum gsm48_chan_mode tch_mode; + /* State */ + enum gsm_lchan_state state; + /* Power levels for MS and BTS */ + uint8_t bs_power; + uint8_t ms_power; + /* Encryption information */ + struct { + uint8_t alg_id; + uint8_t key_len; + uint8_t key[MAX_A5_KEY_LEN]; + } encr; + + /* AMR bits */ + struct gsm48_multi_rate_conf mr_conf; + + /* Established data link layer services */ + uint8_t sapis[8]; + int sach_deact; + int release_reason; + + struct { + uint32_t bound_ip; + uint32_t connect_ip; + uint16_t bound_port; + uint16_t connect_port; + uint16_t conn_id; + uint8_t rtp_payload; + uint8_t rtp_payload2; + uint8_t speech_mode; + struct rtp_socket *rtp_socket; + } abis_ip; + + uint8_t rqd_ta; + +#ifdef ROLE_BSC + struct osmo_timer_list T3101; + struct osmo_timer_list T3111; + struct osmo_timer_list error_timer; + struct osmo_timer_list act_timer; + + /* table of neighbor cell measurements */ + struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; + + /* cache of last measurement reports on this lchan */ + struct gsm_meas_rep meas_rep[6]; + int meas_rep_idx; + + /* GSM Random Access data */ + struct gsm48_req_ref *rqd_ref; + + struct gsm_subscriber_connection *conn; +#else + struct lapdm_channel lapdm_ch; + struct { + /* bitmask of all SI that are present/valid in si_buf */ + uint32_t valid; + uint32_t last; + /* buffers where we put the pre-computed SI */ + sysinfo_buf_t buf[_MAX_SYSINFO_TYPE]; + } si; + struct { + uint8_t flags; + /* RSL measurment result number, 0 at lchan_act */ + uint8_t res_nr; + /* current Tx power level of the BTS */ + uint8_t bts_tx_pwr; + /* number of measurements stored in array below */ + uint8_t num_ul_meas; + struct bts_ul_meas uplink[MAX_NUM_UL_MEAS]; + /* last L1 header from the MS */ + uint8_t l1_info[2]; + struct { + uint8_t rxlev_full; + uint8_t rxlev_sub; + uint8_t rxqual_full; + uint8_t rxqual_sub; + } res; + } meas; +#endif +}; + +#define TS_F_PDCH_MODE 0x1000 +/* One Timeslot in a TRX */ +struct gsm_bts_trx_ts { + struct gsm_bts_trx *trx; + /* number of this timeslot at the TRX */ + uint8_t nr; + + enum gsm_phys_chan_config pchan; + + unsigned int flags; + struct gsm_abis_mo mo; + struct tlv_parsed nm_attr; + uint8_t nm_chan_comb; + int tsc; /* -1 == use BTS TSC */ + + struct { + /* Parameters below are configured by VTY */ + int enabled; + uint8_t maio; + uint8_t hsn; + struct bitvec arfcns; + uint8_t arfcns_data[1024/8]; + /* This is the pre-computed MA for channel assignments */ + struct bitvec ma; + uint8_t ma_len; /* part of ma_data that is used */ + uint8_t ma_data[8]; /* 10.5.2.21: max 8 bytes value part */ + } hopping; + + /* To which E1 subslot are we connected */ + struct gsm_e1_subslot e1_link; + + struct gsm_lchan lchan[TS_MAX_LCHAN]; +}; + +/* One TRX in a BTS */ +struct gsm_bts_trx { + /* list header in bts->trx_list */ + struct llist_head list; + + struct gsm_bts *bts; + /* number of this TRX in the BTS */ + uint8_t nr; + /* human readable name / description */ + char *description; + /* how do we talk RSL with this TRX? */ + struct gsm_e1_subslot rsl_e1_link; + uint8_t rsl_tei; + struct e1inp_sign_link *rsl_link; + /* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */ + struct e1inp_sign_link *oml_link; + + struct gsm_abis_mo mo; + struct tlv_parsed nm_attr; + struct { + struct gsm_abis_mo mo; + } bb_transc; + + uint16_t arfcn; + int nominal_power; /* in dBm */ + unsigned int max_power_red; /* in actual dB */ + + struct { + void *l1h; + } role_bts; + + union { + struct { + struct { + struct gsm_abis_mo mo; + } bbsig; + struct { + struct gsm_abis_mo mo; + } pa; + } bs11; + struct { + unsigned int test_state; + uint8_t test_nr; + struct rxlev_stats rxlev_stat; + } ipaccess; + }; + struct gsm_bts_trx_ts ts[TRX_NR_TS]; +}; + +#define GSM_BTS_SI(bts, i) (void *)(bts->si_buf[i]) + +enum gsm_bts_type { + GSM_BTS_TYPE_UNKNOWN, + GSM_BTS_TYPE_BS11, + GSM_BTS_TYPE_NANOBTS, + GSM_BTS_TYPE_RBS2000, + GSM_BTS_TYPE_HSL_FEMTO, + GSM_BTS_TYPE_NOKIA_SITE, +}; + +struct vty; + +struct gsm_bts_model { + struct llist_head list; + + enum gsm_bts_type type; + const char *name; + + bool started; + int (*start)(struct gsm_network *net); + int (*oml_rcvmsg)(struct msgb *msg); + + void (*e1line_bind_ops)(struct e1inp_line *line); + + void (*config_write_bts)(struct vty *vty, struct gsm_bts *bts); + void (*config_write_trx)(struct vty *vty, struct gsm_bts_trx *trx); + void (*config_write_ts)(struct vty *vty, struct gsm_bts_trx_ts *ts); + + struct tlv_definition nm_att_tlvdef; + + struct bitvec features; + uint8_t _features_data[128/8]; +}; + +enum gsm_bts_features { + BTS_FEAT_HSCSD, + BTS_FEAT_GPRS, + BTS_FEAT_EGPRS, + BTS_FEAT_ECSD, + BTS_FEAT_HOPPING, +}; + +/* + * This keeps track of the paging status of one BTS. It + * includes a number of pending requests, a back pointer + * to the gsm_bts, a timer and some more state. + */ +struct gsm_bts_paging_state { + /* pending requests */ + struct llist_head pending_requests; + struct gsm_bts *bts; + + struct osmo_timer_list work_timer; + struct osmo_timer_list credit_timer; + + /* free chans needed */ + int free_chans_need; + + /* load */ + uint16_t available_slots; +}; + +struct gsm_envabtse { + struct gsm_abis_mo mo; +}; + +struct gsm_bts_gprs_nsvc { + struct gsm_bts *bts; + /* data read via VTY config file, to configure the BTS + * via OML from BSC */ + int id; + uint16_t nsvci; + uint16_t local_port; /* on the BTS */ + uint16_t remote_port; /* on the SGSN */ + uint32_t remote_ip; /* on the SGSN */ + + struct gsm_abis_mo mo; +}; + +enum neigh_list_manual_mode { + NL_MODE_AUTOMATIC = 0, + NL_MODE_MANUAL = 1, + NL_MODE_MANUAL_SI5SEP = 2, /* SI2 and SI5 have separate neighbor lists */ +}; + +/* One BTS */ +struct gsm_bts { + /* list header in net->bts_list */ + struct llist_head list; + + /* number of ths BTS in network */ + uint8_t nr; + /* human readable name / description */ + char *description; + /* Cell Identity */ + uint16_t cell_identity; + /* location area code of this BTS */ + uint16_t location_area_code; + /* Training Sequence Code */ + uint8_t tsc; + /* Base Station Identification Code (BSIC) */ + uint8_t bsic; + /* type of BTS */ + enum gsm_bts_type type; + struct gsm_bts_model *model; + enum gsm_band band; + /* maximum Tx power that the MS is permitted to use in this cell */ + int ms_max_power; + + /* how do we talk OML with this TRX? */ + struct gsm_e1_subslot oml_e1_link; + uint8_t oml_tei; + struct e1inp_sign_link *oml_link; + + /* Abis network management O&M handle */ + struct abis_nm_h *nmh; + + struct gsm_abis_mo mo; + + /* number of this BTS on given E1 link */ + uint8_t bts_nr; + + /* paging state and control */ + struct gsm_bts_paging_state paging; + + /* CCCH is on C0 */ + struct gsm_bts_trx *c0; + + struct { + struct gsm_abis_mo mo; + } site_mgr; + + /* bitmask of all SI that are present/valid in si_buf */ + uint32_t si_valid; + /* buffers where we put the pre-computed SI */ + sysinfo_buf_t si_buf[_MAX_SYSINFO_TYPE]; + + /* ip.accesss Unit ID's have Site/BTS/TRX layout */ + union { + struct { + uint16_t site_id; + uint16_t bts_id; + uint32_t flags; + } ip_access; + struct { + struct { + struct gsm_abis_mo mo; + } cclk; + struct { + struct gsm_abis_mo mo; + } rack; + struct gsm_envabtse envabtse[4]; + } bs11; + struct { + struct { + struct gsm_abis_mo mo; + struct llist_head conn_groups; + } is; + struct { + struct gsm_abis_mo mo; + struct llist_head conn_groups; + } con; + struct { + struct gsm_abis_mo mo; + } dp; + struct { + struct gsm_abis_mo mo; + } tf; + } rbs2000; + struct { + unsigned long serno; + } hsl; + struct { + uint8_t bts_type; + int configured:1, + do_reset:1, + wait_reset:1; + struct osmo_timer_list reset_timer; + } nokia; + }; + + /* Not entirely sure how ip.access specific this is */ + struct { + enum bts_gprs_mode mode; + struct { + struct gsm_abis_mo mo; + uint16_t nsei; + uint8_t timer[7]; + } nse; + struct { + struct gsm_abis_mo mo; + uint16_t bvci; + uint8_t timer[11]; + } cell; + struct gsm_bts_gprs_nsvc nsvc[2]; + uint8_t rac; + } gprs; + + /* RACH NM values */ + int rach_b_thresh; + int rach_ldavg_slots; + + /* transceivers */ + int num_trx; + struct llist_head trx_list; + +#ifdef ROLE_BSC + /* Abis NM queue */ + struct llist_head abis_queue; + int abis_nm_pend; + + struct gsm_network *network; + + /* should the channel allocator allocate channels from high TRX to TRX0, + * rather than starting from TRX0 and go upwards? */ + int chan_alloc_reverse; + + enum neigh_list_manual_mode neigh_list_manual_mode; + /* parameters from which we build SYSTEM INFORMATION */ + struct { + struct gsm48_rach_control rach_control; + uint8_t ncc_permitted; + struct gsm48_cell_sel_par cell_sel_par; + struct gsm48_si_selection_params cell_ro_sel_par; /* rest octet */ + struct gsm48_cell_options cell_options; + struct gsm48_control_channel_descr chan_desc; + struct bitvec neigh_list; + struct bitvec cell_alloc; + struct bitvec si5_neigh_list; + struct { + /* bitmask large enough for all possible ARFCN's */ + uint8_t neigh_list[1024/8]; + uint8_t cell_alloc[1024/8]; + /* If the user wants a different neighbor list in SI5 than in SI2 */ + uint8_t si5_neigh_list[1024/8]; + } data; + } si_common; + + /* do we use static (user-defined) system information messages? (bitmask) */ + uint32_t si_mode_static; +#endif /* ROLE_BSC */ + void *role; +}; + + +struct gsm_bts *gsm_bts_alloc(void *talloc_ctx); +struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); + +struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num); + +const char *gsm_pchan_name(enum gsm_phys_chan_config c); +enum gsm_phys_chan_config gsm_pchan_parse(const char *name); +const char *gsm_lchant_name(enum gsm_chan_t c); +const char *gsm_chreq_name(enum gsm_chreq_reason_t c); +char *gsm_trx_name(struct gsm_bts_trx *trx); +char *gsm_ts_name(struct gsm_bts_trx_ts *ts); +char *gsm_lchan_name(struct gsm_lchan *lchan); +const char *gsm_lchans_name(enum gsm_lchan_state s); + + +void gsm_abis_mo_reset(struct gsm_abis_mo *mo); + +struct gsm_abis_mo * +gsm_objclass2mo(struct gsm_bts *bts, uint8_t obj_class, + struct abis_om_obj_inst *obj_inst); + +struct gsm_nm_state * +gsm_objclass2nmstate(struct gsm_bts *bts, uint8_t obj_class, + struct abis_om_obj_inst *obj_inst); +void * +gsm_objclass2obj(struct gsm_bts *bts, uint8_t obj_class, + struct abis_om_obj_inst *obj_inst); + +/* reset the state of all MO in the BTS */ +void gsm_bts_mo_reset(struct gsm_bts *bts); + +uint8_t gsm_ts2chan_nr(const struct gsm_bts_trx_ts *ts, uint8_t lchan_nr); +uint8_t gsm_lchan2chan_nr(const struct gsm_lchan *lchan); + +/* + * help with parsing regexps + */ +int gsm_parse_reg(void *ctx, regex_t *reg, char **str, + int argc, const char **argv) __attribute__ ((warn_unused_result)); + + + +#endif diff --git a/openbsc/include/openbsc/libcommon/socket.h b/openbsc/include/openbsc/libcommon/socket.h new file mode 100644 index 0000000..0fd85f1 --- /dev/null +++ b/openbsc/include/openbsc/libcommon/socket.h @@ -0,0 +1,14 @@ +#ifndef _BSC_SOCKET_H +#define _BSC_SOCKET_H + +#include <osmocom/core/select.h> + +#ifndef IPPROTO_GRE +#define IPPROTO_GRE 47 +#endif + +int make_sock(struct osmo_fd *bfd, int proto, + uint32_t ip, uint16_t port, int priv_nr, + int (*cb)(struct osmo_fd *fd, unsigned int what), void *data); + +#endif /* _BSC_SOCKET_H */ diff --git a/openbsc/include/openbsc/libctrl/control_cmd.h b/openbsc/include/openbsc/libctrl/control_cmd.h new file mode 100644 index 0000000..2a5391f --- /dev/null +++ b/openbsc/include/openbsc/libctrl/control_cmd.h @@ -0,0 +1,155 @@ +#ifndef _CONTROL_CMD_H +#define _CONTROL_CMD_H + +#include <osmocom/core/msgb.h> +#include <osmocom/core/write_queue.h> + +#include <osmocom/vty/vector.h> + +#define CTRL_CMD_ERROR -1 +#define CTRL_CMD_HANDLED 0 +#define CTRL_CMD_REPLY 1 + +enum ctrl_node_type { + CTRL_NODE_ROOT, /* Root elements */ + CTRL_NODE_NET, /* Network specific (net.) */ + CTRL_NODE_BTS, /* BTS specific (net.btsN.) */ + CTRL_NODE_TRX, /* TRX specific (net.btsN.trxM.) */ + CTRL_NODE_TS, /* TS specific (net.btsN.trxM.tsI.) */ + _LAST_CTRL_NODE +}; + +enum ctrl_type { + CTRL_TYPE_UNKNOWN, + CTRL_TYPE_GET, + CTRL_TYPE_SET, + CTRL_TYPE_GET_REPLY, + CTRL_TYPE_SET_REPLY, + CTRL_TYPE_TRAP, + CTRL_TYPE_ERROR +}; + +struct ctrl_connection { + struct llist_head list_entry; + + /* The queue for sending data back */ + struct osmo_wqueue write_queue; + + /* Callback if the connection was closed */ + void (*closed_cb)(struct ctrl_connection *conn); + + /* Pending commands for this connection */ + struct llist_head cmds; +}; + +struct ctrl_cmd { + struct ctrl_connection *ccon; + enum ctrl_type type; + char *id; + void *node; + char *variable; + char *value; + char *reply; +}; + +struct ctrl_cmd_struct { + int nr_commands; + char **command; +}; + +struct ctrl_cmd_element { + const char *name; + const char *param; + struct ctrl_cmd_struct strcmd; + int (*set)(struct ctrl_cmd *cmd, void *data); + int (*get)(struct ctrl_cmd *cmd, void *data); + int (*verify)(struct ctrl_cmd *cmd, const char *value, void *data); +}; + +struct ctrl_cmd_map { + char *cmd; + enum ctrl_type type; +}; + +int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *data); +int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd); +int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data); +int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); +struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg); +struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd); +struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd); +struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type); + +#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \ +static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \ +{ \ + dtype *node = data; \ + cmd->reply = talloc_asprintf(cmd, "%i", node->element); \ + if (!cmd->reply) { \ + cmd->reply = "OOM"; \ + return CTRL_CMD_ERROR; \ + } \ + return CTRL_CMD_REPLY; \ +} \ +static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \ +{ \ + dtype *node = data; \ + int tmp = atoi(cmd->value); \ + node->element = tmp; \ + return get_##cmdname(cmd, data); \ +} \ +static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \ +{ \ + int tmp = atoi(value); \ + if ((tmp >= min)&&(tmp <= max)) { \ + return 0; \ + } \ + return -1; \ +} \ +struct ctrl_cmd_element cmd_##cmdname = { \ + .name = cmdstr, \ + .param = NULL, \ + .get = &get_##cmdname, \ + .set = &set_##cmdname, \ + .verify = &verify_##cmdname, \ +} + +#define CTRL_CMD_DEFINE_STRING(cmdname, cmdstr, dtype, element) \ +static int get_##cmdname(struct ctrl_cmd *cmd, dtype *data) \ +{ \ + cmd->reply = talloc_asprintf(cmd, "%s", data->element); \ + if (!cmd->reply) { \ + cmd->reply = "OOM"; \ + return CTRL_CMD_ERROR; \ + } \ + return CTRL_CMD_REPLY; \ +} \ +static int set_##cmdname(struct ctrl_cmd *cmd, dtype *data) \ +{ \ + bsc_replace_string(cmd->node, &data->element, cmd->value); \ + return get_##cmdname(cmd, data); \ +} \ +struct ctrl_cmd_element cmd_##cmdname = { \ + .name = cmdstr, \ + .param = NULL, \ + .get = &get_##cmdname, \ + .set = &set_##cmdname, \ + .verify = NULL, \ +} + +#define CTRL_CMD_DEFINE(cmdname, cmdstr) \ +static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \ +static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \ +static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data); \ +struct ctrl_cmd_element cmd_##cmdname = { \ + .name = cmdstr, \ + .param = NULL, \ + .get = &get_##cmdname, \ + .set = &set_##cmdname, \ + .verify = &verify_##cmdname, \ +} + +struct gsm_network; +int controlif_setup(struct gsm_network *gsmnet, uint16_t port); + +#endif /* _CONTROL_CMD_H */ diff --git a/openbsc/include/openbsc/libgb/gprs_bssgp.h b/openbsc/include/openbsc/libgb/gprs_bssgp.h new file mode 100644 index 0000000..cef4c30 --- /dev/null +++ b/openbsc/include/openbsc/libgb/gprs_bssgp.h @@ -0,0 +1,232 @@ +#ifndef _GPRS_BSSGP_H +#define _GPRS_BSSGP_H + +#include <stdint.h> + +/* Section 5.4.1 */ +#define BVCI_SIGNALLING 0x0000 +#define BVCI_PTM 0x0001 + +/* Section 11.3.26 / Table 11.27 */ +enum bssgp_pdu_type { + /* PDUs between RL and BSSGP SAPs */ + BSSGP_PDUT_DL_UNITDATA = 0x00, + BSSGP_PDUT_UL_UNITDATA = 0x01, + BSSGP_PDUT_RA_CAPABILITY = 0x02, + BSSGP_PDUT_PTM_UNITDATA = 0x03, + /* PDUs between GMM SAPs */ + BSSGP_PDUT_PAGING_PS = 0x06, + BSSGP_PDUT_PAGING_CS = 0x07, + BSSGP_PDUT_RA_CAPA_UDPATE = 0x08, + BSSGP_PDUT_RA_CAPA_UPDATE_ACK = 0x09, + BSSGP_PDUT_RADIO_STATUS = 0x0a, + BSSGP_PDUT_SUSPEND = 0x0b, + BSSGP_PDUT_SUSPEND_ACK = 0x0c, + BSSGP_PDUT_SUSPEND_NACK = 0x0d, + BSSGP_PDUT_RESUME = 0x0e, + BSSGP_PDUT_RESUME_ACK = 0x0f, + BSSGP_PDUT_RESUME_NACK = 0x10, + /* PDus between NM SAPs */ + BSSGP_PDUT_BVC_BLOCK = 0x20, + BSSGP_PDUT_BVC_BLOCK_ACK = 0x21, + BSSGP_PDUT_BVC_RESET = 0x22, + BSSGP_PDUT_BVC_RESET_ACK = 0x23, + BSSGP_PDUT_BVC_UNBLOCK = 0x24, + BSSGP_PDUT_BVC_UNBLOCK_ACK = 0x25, + BSSGP_PDUT_FLOW_CONTROL_BVC = 0x26, + BSSGP_PDUT_FLOW_CONTROL_BVC_ACK = 0x27, + BSSGP_PDUT_FLOW_CONTROL_MS = 0x28, + BSSGP_PDUT_FLOW_CONTROL_MS_ACK = 0x29, + BSSGP_PDUT_FLUSH_LL = 0x2a, + BSSGP_PDUT_FLUSH_LL_ACK = 0x2b, + BSSGP_PDUT_LLC_DISCARD = 0x2c, + BSSGP_PDUT_SGSN_INVOKE_TRACE = 0x40, + BSSGP_PDUT_STATUS = 0x41, + /* PDUs between PFM SAP's */ + BSSGP_PDUT_DOWNLOAD_BSS_PFC = 0x50, + BSSGP_PDUT_CREATE_BSS_PFC = 0x51, + BSSGP_PDUT_CREATE_BSS_PFC_ACK = 0x52, + BSSGP_PDUT_CREATE_BSS_PFC_NACK = 0x53, + BSSGP_PDUT_MODIFY_BSS_PFC = 0x54, + BSSGP_PDUT_MODIFY_BSS_PFC_ACK = 0x55, + BSSGP_PDUT_DELETE_BSS_PFC = 0x56, + BSSGP_PDUT_DELETE_BSS_PFC_ACK = 0x57, +}; + +/* Section 10.2.1 and 10.2.2 */ +struct bssgp_ud_hdr { + uint8_t pdu_type; + uint32_t tlli; + uint8_t qos_profile[3]; + uint8_t data[0]; /* TLV's */ +} __attribute__((packed)); + +struct bssgp_normal_hdr { + uint8_t pdu_type; + uint8_t data[0]; /* TLV's */ +}; + +enum bssgp_iei_type { + BSSGP_IE_ALIGNMENT = 0x00, + BSSGP_IE_BMAX_DEFAULT_MS = 0x01, + BSSGP_IE_BSS_AREA_ID = 0x02, + BSSGP_IE_BUCKET_LEAK_RATE = 0x03, + BSSGP_IE_BVCI = 0x04, + BSSGP_IE_BVC_BUCKET_SIZE = 0x05, + BSSGP_IE_BVC_MEASUREMENT = 0x06, + BSSGP_IE_CAUSE = 0x07, + BSSGP_IE_CELL_ID = 0x08, + BSSGP_IE_CHAN_NEEDED = 0x09, + BSSGP_IE_DRX_PARAMS = 0x0a, + BSSGP_IE_EMLPP_PRIO = 0x0b, + BSSGP_IE_FLUSH_ACTION = 0x0c, + BSSGP_IE_IMSI = 0x0d, + BSSGP_IE_LLC_PDU = 0x0e, + BSSGP_IE_LLC_FRAMES_DISCARDED = 0x0f, + BSSGP_IE_LOCATION_AREA = 0x10, + BSSGP_IE_MOBILE_ID = 0x11, + BSSGP_IE_MS_BUCKET_SIZE = 0x12, + BSSGP_IE_MS_RADIO_ACCESS_CAP = 0x13, + BSSGP_IE_OMC_ID = 0x14, + BSSGP_IE_PDU_IN_ERROR = 0x15, + BSSGP_IE_PDU_LIFETIME = 0x16, + BSSGP_IE_PRIORITY = 0x17, + BSSGP_IE_QOS_PROFILE = 0x18, + BSSGP_IE_RADIO_CAUSE = 0x19, + BSSGP_IE_RA_CAP_UPD_CAUSE = 0x1a, + BSSGP_IE_ROUTEING_AREA = 0x1b, + BSSGP_IE_R_DEFAULT_MS = 0x1c, + BSSGP_IE_SUSPEND_REF_NR = 0x1d, + BSSGP_IE_TAG = 0x1e, + BSSGP_IE_TLLI = 0x1f, + BSSGP_IE_TMSI = 0x20, + BSSGP_IE_TRACE_REFERENC = 0x21, + BSSGP_IE_TRACE_TYPE = 0x22, + BSSGP_IE_TRANSACTION_ID = 0x23, + BSSGP_IE_TRIGGER_ID = 0x24, + BSSGP_IE_NUM_OCT_AFF = 0x25, + BSSGP_IE_LSA_ID_LIST = 0x26, + BSSGP_IE_LSA_INFORMATION = 0x27, + BSSGP_IE_PACKET_FLOW_ID = 0x28, + BSSGP_IE_PACKET_FLOW_TIMER = 0x29, + BSSGP_IE_AGG_BSS_QOS_PROFILE = 0x3a, + BSSGP_IE_FEATURE_BITMAP = 0x3b, + BSSGP_IE_BUCKET_FULL_RATIO = 0x3c, + BSSGP_IE_SERVICE_UTRAN_CCO = 0x3d, +}; + +/* Section 11.3.8 / Table 11.10: Cause coding */ +enum gprs_bssgp_cause { + BSSGP_CAUSE_PROC_OVERLOAD = 0x00, + BSSGP_CAUSE_EQUIP_FAIL = 0x01, + BSSGP_CAUSE_TRASIT_NET_FAIL = 0x02, + BSSGP_CAUSE_CAPA_GREATER_0KPBS = 0x03, + BSSGP_CAUSE_UNKNOWN_MS = 0x04, + BSSGP_CAUSE_UNKNOWN_BVCI = 0x05, + BSSGP_CAUSE_CELL_TRAF_CONG = 0x06, + BSSGP_CAUSE_SGSN_CONG = 0x07, + BSSGP_CAUSE_OML_INTERV = 0x08, + BSSGP_CAUSE_BVCI_BLOCKED = 0x09, + BSSGP_CAUSE_PFC_CREATE_FAIL = 0x0a, + BSSGP_CAUSE_SEM_INCORR_PDU = 0x20, + BSSGP_CAUSE_INV_MAND_INF = 0x21, + BSSGP_CAUSE_MISSING_MAND_IE = 0x22, + BSSGP_CAUSE_MISSING_COND_IE = 0x23, + BSSGP_CAUSE_UNEXP_COND_IE = 0x24, + BSSGP_CAUSE_COND_IE_ERR = 0x25, + BSSGP_CAUSE_PDU_INCOMP_STATE = 0x26, + BSSGP_CAUSE_PROTO_ERR_UNSPEC = 0x27, + BSSGP_CAUSE_PDU_INCOMP_FEAT = 0x28, +}; + +/* Our implementation */ + +/* gprs_bssgp_util.c */ +extern struct gprs_ns_inst *bssgp_nsi; +struct msgb *bssgp_msgb_alloc(void); +const char *bssgp_cause_str(enum gprs_bssgp_cause cause); +/* Transmit a simple response such as BLOCK/UNBLOCK/RESET ACK/NACK */ +int bssgp_tx_simple_bvci(uint8_t pdu_type, uint16_t nsei, + uint16_t bvci, uint16_t ns_bvci); +/* Chapter 10.4.14: Status */ +int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg); + +/* gprs_bssgp.c */ + +#define BVC_S_BLOCKED 0x0001 + +/* The per-BTS context that we keep on the SGSN side of the BSSGP link */ +struct bssgp_bvc_ctx { + struct llist_head list; + + /* parsed RA ID and Cell ID of the remote BTS */ + struct gprs_ra_id ra_id; + uint16_t cell_id; + + /* NSEI and BVCI of underlying Gb link. Together they + * uniquely identify a link to a BTS (5.4.4) */ + uint16_t bvci; + uint16_t nsei; + + uint32_t state; + + struct rate_ctr_group *ctrg; + + /* we might want to add this as a shortcut later, avoiding the NSVC + * lookup for every packet, similar to a routing cache */ + //struct gprs_nsvc *nsvc; +}; +extern struct llist_head bssgp_bvc_ctxts; +/* Find a BTS Context based on parsed RA ID and Cell ID */ +struct bssgp_bvc_ctx *btsctx_by_raid_cid(const struct gprs_ra_id *raid, uint16_t cid); +/* Find a BTS context based on BVCI+NSEI tuple */ +struct bssgp_bvc_ctx *btsctx_by_bvci_nsei(uint16_t bvci, uint16_t nsei); + +#include <osmocom/gsm/tlv.h> + +/* BSSGP-UL-UNITDATA.ind */ +int gprs_bssgp_rcvmsg(struct msgb *msg); + +/* BSSGP-DL-UNITDATA.req */ +struct sgsn_mm_ctx; +int gprs_bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx); + +uint16_t bssgp_parse_cell_id(struct gprs_ra_id *raid, const uint8_t *buf); + +/* Wrapper around TLV parser to parse BSSGP IEs */ +static inline int bssgp_tlv_parse(struct tlv_parsed *tp, uint8_t *buf, int len) +{ + return tlv_parse(tp, &tvlv_att_def, buf, len, 0, 0); +} + +enum bssgp_paging_mode { + BSSGP_PAGING_PS, + BSSGP_PAGING_CS, +}; + +enum bssgp_paging_scope { + BSSGP_PAGING_BSS_AREA, /* all cells in BSS */ + BSSGP_PAGING_LOCATION_AREA, /* all cells in LA */ + BSSGP_PAGING_ROUTEING_AREA, /* all cells in RA */ + BSSGP_PAGING_BVCI, /* one cell */ +}; + +struct bssgp_paging_info { + enum bssgp_paging_mode mode; + enum bssgp_paging_scope scope; + struct gprs_ra_id raid; + uint16_t bvci; + const char *imsi; + uint32_t *ptmsi; + uint16_t drx_params; + uint8_t qos[3]; +}; + +/* Send a single GMM-PAGING.req to a given NSEI/NS-BVCI */ +int gprs_bssgp_tx_paging(uint16_t nsei, uint16_t ns_bvci, + struct bssgp_paging_info *pinfo); + +/* gprs_bssgp_vty.c */ +int gprs_bssgp_vty_init(void); + +#endif /* _GPRS_BSSGP_H */ diff --git a/openbsc/include/openbsc/libgb/gprs_ns.h b/openbsc/include/openbsc/libgb/gprs_ns.h new file mode 100644 index 0000000..8f28d46 --- /dev/null +++ b/openbsc/include/openbsc/libgb/gprs_ns.h @@ -0,0 +1,232 @@ +#ifndef _GPRS_NS_H +#define _GPRS_NS_H + +#include <stdint.h> + +/* GPRS Networks Service (NS) messages on the Gb interface + * 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) + * 3GPP TS 48.016 version 6.5.0 Release 6 / ETSI TS 148 016 V6.5.0 (2005-11) */ + +struct gprs_ns_hdr { + uint8_t pdu_type; + uint8_t data[0]; +} __attribute__((packed)); + +/* TS 08.16, Section 10.3.7, Table 14 */ +enum ns_pdu_type { + NS_PDUT_UNITDATA = 0x00, + NS_PDUT_RESET = 0x02, + NS_PDUT_RESET_ACK = 0x03, + NS_PDUT_BLOCK = 0x04, + NS_PDUT_BLOCK_ACK = 0x05, + NS_PDUT_UNBLOCK = 0x06, + NS_PDUT_UNBLOCK_ACK = 0x07, + NS_PDUT_STATUS = 0x08, + NS_PDUT_ALIVE = 0x0a, + NS_PDUT_ALIVE_ACK = 0x0b, + /* TS 48.016 Section 10.3.7, Table 10.3.7.1 */ + SNS_PDUT_ACK = 0x0c, + SNS_PDUT_ADD = 0x0d, + SNS_PDUT_CHANGE_WEIGHT = 0x0e, + SNS_PDUT_CONFIG = 0x0f, + SNS_PDUT_CONFIG_ACK = 0x10, + SNS_PDUT_DELETE = 0x11, + SNS_PDUT_SIZE = 0x12, + SNS_PDUT_SIZE_ACK = 0x13, +}; + +/* TS 08.16, Section 10.3, Table 12 */ +enum ns_ctrl_ie { + NS_IE_CAUSE = 0x00, + NS_IE_VCI = 0x01, + NS_IE_PDU = 0x02, + NS_IE_BVCI = 0x03, + NS_IE_NSEI = 0x04, + /* TS 48.016 Section 10.3, Table 10.3.1 */ + NS_IE_IPv4_LIST = 0x05, + NS_IE_IPv6_LIST = 0x06, + NS_IE_MAX_NR_NSVC = 0x07, + NS_IE_IPv4_EP_NR = 0x08, + NS_IE_IPv6_EP_NR = 0x09, + NS_IE_RESET_FLAG = 0x0a, + NS_IE_IP_ADDR = 0x0b, +}; + +/* TS 08.16, Section 10.3.2, Table 13 */ +enum ns_cause { + NS_CAUSE_TRANSIT_FAIL = 0x00, + NS_CAUSE_OM_INTERVENTION = 0x01, + NS_CAUSE_EQUIP_FAIL = 0x02, + NS_CAUSE_NSVC_BLOCKED = 0x03, + NS_CAUSE_NSVC_UNKNOWN = 0x04, + NS_CAUSE_BVCI_UNKNOWN = 0x05, + NS_CAUSE_SEM_INCORR_PDU = 0x08, + NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a, + NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b, + NS_CAUSE_INVAL_ESSENT_IE = 0x0c, + NS_CAUSE_MISSING_ESSENT_IE = 0x0d, + /* TS 48.016 Section 10.3.2, Table 10.3.2.1 */ + NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e, + NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f, + NS_CAUSE_INVAL_NR_NS_VC = 0x10, + NS_CAUSE_INVAL_WEIGH = 0x11, + NS_CAUSE_UNKN_IP_EP = 0x12, + NS_CAUSE_UNKN_IP_ADDR = 0x13, + NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14, +}; + +/* Our Implementation */ +#include <netinet/in.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/select.h> + +#define NS_TIMERS_COUNT 7 +#define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries)" +#define NS_TIMERS_HELP \ + "(un)blocking Timer (Tns-block) timeout\n" \ + "(un)blocking Timer (Tns-block) number of retries\n" \ + "Reset Timer (Tns-reset) timeout\n" \ + "Reset Timer (Tns-reset) number of retries\n" \ + "Test Timer (Tns-test) timeout\n" \ + +enum ns_timeout { + NS_TOUT_TNS_BLOCK, + NS_TOUT_TNS_BLOCK_RETRIES, + NS_TOUT_TNS_RESET, + NS_TOUT_TNS_RESET_RETRIES, + NS_TOUT_TNS_TEST, + NS_TOUT_TNS_ALIVE, + NS_TOUT_TNS_ALIVE_RETRIES, +}; + +#define NSE_S_BLOCKED 0x0001 +#define NSE_S_ALIVE 0x0002 + +enum gprs_ns_ll { + GPRS_NS_LL_UDP, + GPRS_NS_LL_E1, + GPRS_NS_LL_FR_GRE, +}; + +enum gprs_ns_evt { + GPRS_NS_EVT_UNIT_DATA, +}; + +struct gprs_nsvc; +typedef int gprs_ns_cb_t(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, + struct msgb *msg, uint16_t bvci); + +/* An instance of the NS protocol stack */ +struct gprs_ns_inst { + /* callback to the user for incoming UNIT DATA IND */ + gprs_ns_cb_t *cb; + + /* linked lists of all NSVC in this instance */ + struct llist_head gprs_nsvcs; + + /* a NSVC object that's needed to deal with packets for unknown NSVC */ + struct gprs_nsvc *unknown_nsvc; + + uint16_t timeout[NS_TIMERS_COUNT]; + + /* NS-over-IP specific bits */ + struct { + struct osmo_fd fd; + uint32_t local_ip; + uint16_t local_port; + } nsip; + /* NS-over-FR-over-GRE-over-IP specific bits */ + struct { + struct osmo_fd fd; + uint32_t local_ip; + int enabled:1; + } frgre; +}; + +enum nsvc_timer_mode { + /* standard timers */ + NSVC_TIMER_TNS_TEST, + NSVC_TIMER_TNS_ALIVE, + NSVC_TIMER_TNS_RESET, + _NSVC_TIMER_NR, +}; + +struct gprs_nsvc { + struct llist_head list; + struct gprs_ns_inst *nsi; + + uint16_t nsei; /* end-to-end significance */ + uint16_t nsvci; /* uniquely identifies NS-VC at SGSN */ + + uint32_t state; + uint32_t remote_state; + + struct osmo_timer_list timer; + enum nsvc_timer_mode timer_mode; + int alive_retries; + + unsigned int remote_end_is_sgsn:1; + unsigned int persistent:1; + + struct rate_ctr_group *ctrg; + + /* which link-layer are we based on? */ + enum gprs_ns_ll ll; + + union { + struct { + struct sockaddr_in bts_addr; + } ip; + struct { + struct sockaddr_in bts_addr; + } frgre; + }; +}; + +/* Create a new NS protocol instance */ +struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb); + +/* Destroy a NS protocol instance */ +void gprs_ns_destroy(struct gprs_ns_inst *nsi); + +/* Listen for incoming GPRS packets via NS/UDP */ +int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi); + +struct sockaddr_in; + +/* main function for higher layers (BSSGP) to send NS messages */ +int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg); + +int gprs_ns_tx_reset(struct gprs_nsvc *nsvc, uint8_t cause); +int gprs_ns_tx_block(struct gprs_nsvc *nsvc, uint8_t cause); +int gprs_ns_tx_unblock(struct gprs_nsvc *nsvc); + +/* Listen for incoming GPRS packets via NS/FR/GRE */ +int gprs_ns_frgre_listen(struct gprs_ns_inst *nsi); + +/* Establish a connection (from the BSS) to the SGSN */ +struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi, + struct sockaddr_in *dest, uint16_t nsei, + uint16_t nsvci); + +struct gprs_nsvc *nsvc_create(struct gprs_ns_inst *nsi, uint16_t nsvci); +void nsvc_delete(struct gprs_nsvc *nsvc); +struct gprs_nsvc *nsvc_by_nsei(struct gprs_ns_inst *nsi, uint16_t nsei); +struct gprs_nsvc *nsvc_by_nsvci(struct gprs_ns_inst *nsi, uint16_t nsvci); + +/* Initiate a RESET procedure (including timer start, ...)*/ +void gprs_nsvc_reset(struct gprs_nsvc *nsvc, uint8_t cause); + +/* Add NS-specific VTY stuff */ +int gprs_ns_vty_init(struct gprs_ns_inst *nsi); + +#define NS_ALLOC_SIZE 2048 +#define NS_ALLOC_HEADROOM 20 +static inline struct msgb *gprs_ns_msgb_alloc(void) +{ + return msgb_alloc_headroom(NS_ALLOC_SIZE, NS_ALLOC_HEADROOM, "GPRS/NS"); +} + +#endif diff --git a/openbsc/include/openbsc/libgb/gprs_ns_frgre.h b/openbsc/include/openbsc/libgb/gprs_ns_frgre.h new file mode 100644 index 0000000..abcd43f --- /dev/null +++ b/openbsc/include/openbsc/libgb/gprs_ns_frgre.h @@ -0,0 +1,6 @@ +#ifndef _GPRS_NS_FRGRE_H +#define _GPRS_NS_FRGRE_H + +int gprs_ns_frgre_sendmsg(struct gprs_nsvc *nsvc, struct msgb *msg); + +#endif diff --git a/openbsc/include/openbsc/libmsc/auth.h b/openbsc/include/openbsc/libmsc/auth.h new file mode 100644 index 0000000..2364fb3 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/auth.h @@ -0,0 +1,17 @@ +#ifndef _AUTH_H +#define _AUTH_H + +struct gsm_auth_tuple; +struct gsm_subscriber; + +enum auth_action { + AUTH_NOT_AVAIL = 0, /* No auth tuple available */ + AUTH_DO_AUTH_THAN_CIPH = 1, /* Firsth authenticate, then cipher */ + AUTH_DO_CIPH = 2, /* Only ciphering */ + AUTH_DO_AUTH = 3, /* Only authentication, no ciphering */ +}; + +int auth_get_tuple_for_subscr(struct gsm_auth_tuple *atuple, + struct gsm_subscriber *subscr, int key_seq); + +#endif /* _AUTH_H */ diff --git a/openbsc/include/openbsc/libmsc/db.h b/openbsc/include/openbsc/libmsc/db.h new file mode 100644 index 0000000..d0c85ea --- /dev/null +++ b/openbsc/include/openbsc/libmsc/db.h @@ -0,0 +1,81 @@ +/* (C) 2008 by Jan Luebbe jluebbe@debian.org + * (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef _DB_H +#define _DB_H + +#include "gsm_subscriber.h" + +struct gsm_equipment; +struct gsm_network; +struct gsm_auth_info; +struct gsm_auth_tuple; +struct gsm_sms; +struct gsm_subscriber; + +/* one time initialisation */ +int db_init(const char *name); +int db_prepare(void); +int db_fini(void); + +/* subscriber management */ +struct gsm_subscriber *db_create_subscriber(struct gsm_network *net, + char *imsi); +struct gsm_subscriber *db_get_subscriber(struct gsm_network *net, + enum gsm_subscriber_field field, + const char *subscr); +int db_sync_subscriber(struct gsm_subscriber *subscriber); +int db_subscriber_alloc_tmsi(struct gsm_subscriber *subscriber); +int db_subscriber_alloc_exten(struct gsm_subscriber *subscriber); +int db_subscriber_alloc_token(struct gsm_subscriber *subscriber, uint32_t* token); +int db_subscriber_assoc_imei(struct gsm_subscriber *subscriber, char *imei); +int db_sync_equipment(struct gsm_equipment *equip); +int db_subscriber_update(struct gsm_subscriber *subscriber); + +/* auth info */ +int db_get_authinfo_for_subscr(struct gsm_auth_info *ainfo, + struct gsm_subscriber *subscr); +int db_sync_authinfo_for_subscr(struct gsm_auth_info *ainfo, + struct gsm_subscriber *subscr); +int db_get_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple, + struct gsm_subscriber *subscr); +int db_sync_lastauthtuple_for_subscr(struct gsm_auth_tuple *atuple, + struct gsm_subscriber *subscr); + +/* SMS store-and-forward */ +int db_sms_store(struct gsm_sms *sms); +struct gsm_sms *db_sms_get(struct gsm_network *net, unsigned long long id); +struct gsm_sms *db_sms_get_unsent(struct gsm_network *net, unsigned long long min_id); +struct gsm_sms *db_sms_get_unsent_by_subscr(struct gsm_network *net, unsigned long long min_subscr_id, unsigned int failed); +struct gsm_sms *db_sms_get_unsent_for_subscr(struct gsm_subscriber *subscr); +int db_sms_mark_sent(struct gsm_sms *sms); +int db_sms_inc_deliver_attempts(struct gsm_sms *sms); + +/* APDU blob storage */ +int db_apdu_blob_store(struct gsm_subscriber *subscr, + uint8_t apdu_id_flags, uint8_t len, + uint8_t *apdu); + +/* Statistics counter storage */ +struct osmo_counter; +int db_store_counter(struct osmo_counter *ctr); +struct rate_ctr_group; +int db_store_rate_ctr_group(struct rate_ctr_group *ctrg); + +#endif /* _DB_H */ diff --git a/openbsc/include/openbsc/libmsc/gsm_04_08.h b/openbsc/include/openbsc/libmsc/gsm_04_08.h new file mode 100644 index 0000000..ec6c2c0 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/gsm_04_08.h @@ -0,0 +1,72 @@ +#ifndef _GSM_04_08_H +#define _GSM_04_08_H + +#include <osmocom/gsm/gsm48.h> +#include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/protocol/gsm_04_08.h> + +#include <openbsc/meas_rep.h> + +struct msgb; +struct gsm_bts; +struct gsm_subscriber; +struct gsm_network; +struct gsm_trans; +struct gsm_subscriber_connection; + +#define GSM48_ALLOC_SIZE 2048 +#define GSM48_ALLOC_HEADROOM 256 + +static inline struct msgb *gsm48_msgb_alloc(void) +{ + return msgb_alloc_headroom(GSM48_ALLOC_SIZE, GSM48_ALLOC_HEADROOM, + "GSM 04.08"); +} + +/* config options controlling the behaviour of the lower leves */ +void gsm0408_allow_everyone(int allow); +void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause); +void gsm0408_clear_all_trans(struct gsm_network *net, int protocol); +int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg); + +int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id); +int gsm0408_new_conn(struct gsm_subscriber_connection *conn); +enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra); +/* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */ +int get_reason_by_chreq(uint8_t ra, int neci); +void gsm_net_update_ctype(struct gsm_network *net); + +int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn); +int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, int key_seq); +int gsm48_tx_mm_auth_rej(struct gsm_subscriber_connection *conn); +int gsm48_send_rr_release(struct gsm_lchan *lchan); +int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); +int gsm48_send_rr_app_info(struct gsm_subscriber_connection *conn, uint8_t apdu_id, + uint8_t apdu_len, const uint8_t *apdu); +int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_class); +int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, + uint8_t power_command, uint8_t ho_ref); + +int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg); + +/* convert a ASCII phone number to call-control BCD */ +int encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, + int h_len, const char *input); +int decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv, + int h_len); + +int send_siemens_mrpci(struct gsm_lchan *lchan, uint8_t *classmark2_lv); +int gsm48_extract_mi(uint8_t *classmark2, int length, char *mi_string, uint8_t *mi_type); +int gsm48_paging_extract_mi(struct gsm48_pag_resp *pag, int length, char *mi_string, uint8_t *mi_type); +int gsm48_handle_paging_resp(struct gsm_subscriber_connection *conn, struct msgb *msg, struct gsm_subscriber *subscr); + +int gsm48_lchan_modify(struct gsm_lchan *lchan, uint8_t lchan_mode); +int gsm48_rx_rr_modif_ack(struct msgb *msg); +int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); + +struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); +struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); +void gsm48_lchan2chan_desc(struct gsm48_chan_desc *cd, + const struct gsm_lchan *lchan); + +#endif diff --git a/openbsc/include/openbsc/libmsc/gsm_04_11.h b/openbsc/include/openbsc/libmsc/gsm_04_11.h new file mode 100644 index 0000000..2abe3e2 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/gsm_04_11.h @@ -0,0 +1,40 @@ +#ifndef _GSM_04_11_H +#define _GSM_04_11_H + +#include <osmocom/gsm/protocol/gsm_04_11.h> + +#define UM_SAPI_SMS 3 /* See GSM 04.05/04.06 */ + +/* SMS deliver PDU */ +struct sms_deliver { + uint8_t mti:2; /* message type indicator */ + uint8_t mms:1; /* more messages to send */ + uint8_t rp:1; /* reply path */ + uint8_t udhi:1; /* user data header indicator */ + uint8_t sri:1; /* status report indication */ + uint8_t *orig_addr; /* originating address */ + uint8_t pid; /* protocol identifier */ + uint8_t dcs; /* data coding scheme */ + /* service centre time stamp */ + uint8_t ud_len; /* user data length */ + uint8_t *user_data; /* user data */ + + uint8_t msg_ref; /* message reference */ + uint8_t *smsc; +}; + +struct msgb; + +int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn, struct msgb *msg); + +struct gsm_sms *sms_alloc(void); +void sms_free(struct gsm_sms *sms); +struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver, int dcs, const char *text); + +void _gsm411_sms_trans_free(struct gsm_trans *trans); +int gsm411_send_sms_subscr(struct gsm_subscriber *subscr, + struct gsm_sms *sms); +int gsm411_send_sms(struct gsm_subscriber_connection *conn, + struct gsm_sms *sms); +void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn); +#endif diff --git a/openbsc/include/openbsc/libmsc/gsm_04_80.h b/openbsc/include/openbsc/libmsc/gsm_04_80.h new file mode 100644 index 0000000..0a60652 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/gsm_04_80.h @@ -0,0 +1,20 @@ +#ifndef _GSM_04_80_H +#define _GSM_04_80_H + +#include <osmocom/core/msgb.h> +#include <osmocom/gsm/protocol/gsm_04_80.h> +#include <osmocom/gsm/gsm0480.h> + +struct gsm_subscriber_connection; + +int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn, + const struct msgb *in_msg, const char* response_text, + const struct ussd_request *req); +int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn, + const struct msgb *msg, + const struct ussd_request *request); + +int gsm0480_send_ussdNotify(struct gsm_subscriber_connection *conn, int level, const char *text); +int gsm0480_send_releaseComplete(struct gsm_subscriber_connection *conn); + +#endif diff --git a/openbsc/include/openbsc/libmsc/gsm_subscriber.h b/openbsc/include/openbsc/libmsc/gsm_subscriber.h new file mode 100644 index 0000000..6cf8573 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/gsm_subscriber.h @@ -0,0 +1,106 @@ +#ifndef _GSM_SUBSCR_H +#define _GSM_SUBSCR_H + +#include "gsm_data.h" +#include <osmocom/core/linuxlist.h> + +#define GSM_IMEI_LENGTH 17 +#define GSM_IMSI_LENGTH 17 +#define GSM_NAME_LENGTH 160 + +#define GSM_EXTENSION_LENGTH 15 /* MSISDN can only be 15 digits length */ +#define GSM_MIN_EXTEN 20000 +#define GSM_MAX_EXTEN 49999 + +#define GSM_SUBSCRIBER_FIRST_CONTACT 0x00000001 +#define tmsi_from_string(str) strtoul(str, NULL, 10) + +struct vty; + +struct gsm_equipment { + long long unsigned int id; + char imei[GSM_IMEI_LENGTH]; + char name[GSM_NAME_LENGTH]; + + struct gsm48_classmark1 classmark1; + uint8_t classmark2_len; + uint8_t classmark2[3]; + uint8_t classmark3_len; + uint8_t classmark3[14]; +}; + +struct gsm_subscriber { + struct gsm_network *net; + long long unsigned int id; + char imsi[GSM_IMSI_LENGTH]; + uint32_t tmsi; + uint16_t lac; + char name[GSM_NAME_LENGTH]; + char extension[GSM_EXTENSION_LENGTH]; + int authorized; + + /* Temporary field which is not stored in the DB/HLR */ + uint32_t flags; + + /* Every user can only have one equipment in use at any given + * point in time */ + struct gsm_equipment equipment; + + /* for internal management */ + int use_count; + struct llist_head entry; + + /* pending requests */ + int in_callback; + struct llist_head requests; +}; + +enum gsm_subscriber_field { + GSM_SUBSCRIBER_IMSI, + GSM_SUBSCRIBER_TMSI, + GSM_SUBSCRIBER_EXTENSION, + GSM_SUBSCRIBER_ID, +}; + +enum gsm_subscriber_update_reason { + GSM_SUBSCRIBER_UPDATE_ATTACHED, + GSM_SUBSCRIBER_UPDATE_DETACHED, + GSM_SUBSCRIBER_UPDATE_EQUIPMENT, +}; + +struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr); +struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr); +struct gsm_subscriber *subscr_get_by_tmsi(struct gsm_network *net, + uint32_t tmsi); +struct gsm_subscriber *subscr_get_by_imsi(struct gsm_network *net, + const char *imsi); +struct gsm_subscriber *subscr_get_by_extension(struct gsm_network *net, + const char *ext); +struct gsm_subscriber *subscr_get_by_id(struct gsm_network *net, + unsigned long long id); +struct gsm_subscriber *subscr_get_or_create(struct gsm_network *net, + const char *imsi); +int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason); +void subscr_put_channel(struct gsm_subscriber *subscr); +void subscr_get_channel(struct gsm_subscriber *subscr, + int type, gsm_cbfn *cbfn, void *param); +struct gsm_subscriber *subscr_active_by_tmsi(struct gsm_network *net, + uint32_t tmsi); +struct gsm_subscriber *subscr_active_by_imsi(struct gsm_network *net, + const char *imsi); + +int subscr_pending_requests(struct gsm_subscriber *subscr); +int subscr_pending_clear(struct gsm_subscriber *subscr); +int subscr_pending_dump(struct gsm_subscriber *subscr, struct vty *vty); +int subscr_pending_kick(struct gsm_subscriber *subscr); + +char *subscr_name(struct gsm_subscriber *subscr); + +int subscr_purge_inactive(struct gsm_network *net); +void subscr_update_from_db(struct gsm_subscriber *subscr); + +/* internal */ +struct gsm_subscriber *subscr_alloc(void); +extern struct llist_head active_subscribers; + +#endif /* _GSM_SUBSCR_H */ diff --git a/openbsc/include/openbsc/libmsc/mncc.h b/openbsc/include/openbsc/libmsc/mncc.h new file mode 100644 index 0000000..8c59fe2 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/mncc.h @@ -0,0 +1,173 @@ +/* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface + * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */ + +/* (C) 2008-2009 by Harald Welte laforge@gnumonks.org + * (C) 2008, 2009 by Holger Hans Peter Freyther zecke@selfish.org + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef _MNCC_H +#define _MNCC_H + +#include <osmocom/core/linuxlist.h> +#include <osmocom/gsm/mncc.h> + +#include <stdint.h> + +struct gsm_network; +struct msgb; + + +/* One end of a call */ +struct gsm_call { + struct llist_head entry; + + /* network handle */ + void *net; + + /* the 'local' transaction */ + uint32_t callref; + /* the 'remote' transaction */ + uint32_t remote_ref; +}; + +#define MNCC_SETUP_REQ 0x0101 +#define MNCC_SETUP_IND 0x0102 +#define MNCC_SETUP_RSP 0x0103 +#define MNCC_SETUP_CNF 0x0104 +#define MNCC_SETUP_COMPL_REQ 0x0105 +#define MNCC_SETUP_COMPL_IND 0x0106 +/* MNCC_REJ_* is perfomed via MNCC_REL_* */ +#define MNCC_CALL_CONF_IND 0x0107 +#define MNCC_CALL_PROC_REQ 0x0108 +#define MNCC_PROGRESS_REQ 0x0109 +#define MNCC_ALERT_REQ 0x010a +#define MNCC_ALERT_IND 0x010b +#define MNCC_NOTIFY_REQ 0x010c +#define MNCC_NOTIFY_IND 0x010d +#define MNCC_DISC_REQ 0x010e +#define MNCC_DISC_IND 0x010f +#define MNCC_REL_REQ 0x0110 +#define MNCC_REL_IND 0x0111 +#define MNCC_REL_CNF 0x0112 +#define MNCC_FACILITY_REQ 0x0113 +#define MNCC_FACILITY_IND 0x0114 +#define MNCC_START_DTMF_IND 0x0115 +#define MNCC_START_DTMF_RSP 0x0116 +#define MNCC_START_DTMF_REJ 0x0117 +#define MNCC_STOP_DTMF_IND 0x0118 +#define MNCC_STOP_DTMF_RSP 0x0119 +#define MNCC_MODIFY_REQ 0x011a +#define MNCC_MODIFY_IND 0x011b +#define MNCC_MODIFY_RSP 0x011c +#define MNCC_MODIFY_CNF 0x011d +#define MNCC_MODIFY_REJ 0x011e +#define MNCC_HOLD_IND 0x011f +#define MNCC_HOLD_CNF 0x0120 +#define MNCC_HOLD_REJ 0x0121 +#define MNCC_RETRIEVE_IND 0x0122 +#define MNCC_RETRIEVE_CNF 0x0123 +#define MNCC_RETRIEVE_REJ 0x0124 +#define MNCC_USERINFO_REQ 0x0125 +#define MNCC_USERINFO_IND 0x0126 +#define MNCC_REJ_REQ 0x0127 +#define MNCC_REJ_IND 0x0128 + +#define MNCC_BRIDGE 0x0200 +#define MNCC_FRAME_RECV 0x0201 +#define MNCC_FRAME_DROP 0x0202 +#define MNCC_LCHAN_MODIFY 0x0203 + +#define GSM_TCHF_FRAME 0x0300 +#define GSM_TCHF_FRAME_EFR 0x0301 + +#define GSM_MAX_FACILITY 128 +#define GSM_MAX_SSVERSION 128 +#define GSM_MAX_USERUSER 128 + +#define MNCC_F_BEARER_CAP 0x0001 +#define MNCC_F_CALLED 0x0002 +#define MNCC_F_CALLING 0x0004 +#define MNCC_F_REDIRECTING 0x0008 +#define MNCC_F_CONNECTED 0x0010 +#define MNCC_F_CAUSE 0x0020 +#define MNCC_F_USERUSER 0x0040 +#define MNCC_F_PROGRESS 0x0080 +#define MNCC_F_EMERGENCY 0x0100 +#define MNCC_F_FACILITY 0x0200 +#define MNCC_F_SSVERSION 0x0400 +#define MNCC_F_CCCAP 0x0800 +#define MNCC_F_KEYPAD 0x1000 +#define MNCC_F_SIGNAL 0x2000 + +struct gsm_mncc { + /* context based information */ + uint32_t msg_type; + uint32_t callref; + + /* which fields are present */ + uint32_t fields; + + /* data derived informations (MNCC_F_ based) */ + struct gsm_mncc_bearer_cap bearer_cap; + struct gsm_mncc_number called; + struct gsm_mncc_number calling; + struct gsm_mncc_number redirecting; + struct gsm_mncc_number connected; + struct gsm_mncc_cause cause; + struct gsm_mncc_progress progress; + struct gsm_mncc_useruser useruser; + struct gsm_mncc_facility facility; + struct gsm_mncc_cccap cccap; + struct gsm_mncc_ssversion ssversion; + struct { + int sup; + int inv; + } clir; + int signal; + + /* data derived information, not MNCC_F based */ + int keypad; + int more; + int notify; /* 0..127 */ + int emergency; + char imsi[16]; + + unsigned char lchan_type; + unsigned char lchan_mode; +}; + +struct gsm_data_frame { + uint32_t msg_type; + uint32_t callref; + unsigned char data[0]; +}; + +char *get_mncc_name(int value); +void mncc_set_cause(struct gsm_mncc *data, int loc, int val); +void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg); + +/* input from CC code into mncc_builtin */ +int int_mncc_recv(struct gsm_network *net, struct msgb *msg); + +/* input from CC code into mncc_sock */ +int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg); + +int mncc_sock_init(struct gsm_network *gsmnet); + +#endif diff --git a/openbsc/include/openbsc/libmsc/osmo_msc.h b/openbsc/include/openbsc/libmsc/osmo_msc.h new file mode 100644 index 0000000..beb3f5e --- /dev/null +++ b/openbsc/include/openbsc/libmsc/osmo_msc.h @@ -0,0 +1,11 @@ +/* Routines for the MSC handling */ + +#ifndef OSMO_MSC_H +#define OSMO_MSC_H + +#include "bsc_api.h" + +struct bsc_api *msc_bsc_api(); +void msc_release_connection(struct gsm_subscriber_connection *conn); + +#endif diff --git a/openbsc/include/openbsc/libmsc/silent_call.h b/openbsc/include/openbsc/libmsc/silent_call.h new file mode 100644 index 0000000..2492903 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/silent_call.h @@ -0,0 +1,12 @@ +#ifndef _SILENT_CALL_H +#define _SILENT_CALL_H + +struct gsm_subscriber_connection; + +extern int gsm_silent_call_start(struct gsm_subscriber *subscr, + void *data, int type); +extern int gsm_silent_call_stop(struct gsm_subscriber *subscr); +extern int silent_call_rx(struct gsm_subscriber_connection *conn, struct msgb *msg); +extern int silent_call_reroute(struct gsm_subscriber_connection *conn, struct msgb *msg); + +#endif /* _SILENT_CALL_H */ diff --git a/openbsc/include/openbsc/libmsc/sms_queue.h b/openbsc/include/openbsc/libmsc/sms_queue.h new file mode 100644 index 0000000..2a8bd58 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/sms_queue.h @@ -0,0 +1,17 @@ +#ifndef SMS_QUEUE_H +#define SMS_QUEUE_H + +struct gsm_network; +struct gsm_sms_queue; +struct vty; + +int sms_queue_start(struct gsm_network *, int in_flight); +int sms_queue_trigger(struct gsm_sms_queue *); + +/* vty helper functions */ +int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty); +int sms_queue_set_max_pending(struct gsm_sms_queue *, int max); +int sms_queue_set_max_failure(struct gsm_sms_queue *, int fail); +int sms_queue_clear(struct gsm_sms_queue *); + +#endif diff --git a/openbsc/include/openbsc/libmsc/transaction.h b/openbsc/include/openbsc/libmsc/transaction.h new file mode 100644 index 0000000..acb2e6c --- /dev/null +++ b/openbsc/include/openbsc/libmsc/transaction.h @@ -0,0 +1,76 @@ +#ifndef _TRANSACT_H +#define _TRANSACT_H + +#include <openbsc/gsm_data.h> +#include <openbsc/gsm_subscriber.h> +#include <osmocom/core/linuxlist.h> +#include <openbsc/gsm_04_11.h> +#include <openbsc/mncc.h> + +/* One transaction */ +struct gsm_trans { + /* Entry in list of all transactions */ + struct llist_head entry; + + /* The protocol within which we live */ + uint8_t protocol; + + /* The current transaction ID */ + uint8_t transaction_id; + + /* To whom we belong, unique identifier of remote MM entity */ + struct gsm_subscriber *subscr; + + /* The associated connection we are using to transmit messages */ + struct gsm_subscriber_connection *conn; + + /* reference from MNCC or other application */ + uint32_t callref; + + /* if traffic channel receive was requested */ + int tch_recv; + + /* is thats one paging? */ + struct gsm_network **paging_request; + + union { + struct { + + /* current call state */ + int state; + + /* current timer and message queue */ + int Tcurrent; /* current CC timer */ + int T308_second; /* used to send release again */ + struct osmo_timer_list timer; + struct gsm_mncc msg; /* stores setup/disconnect/release message */ + } cc; + struct { + uint8_t link_id; /* RSL Link ID to be used for this trans */ + int is_mt; /* is this a MO (0) or MT (1) transfer */ + enum gsm411_cp_state cp_state; + struct osmo_timer_list cp_timer; + + enum gsm411_rp_state rp_state; + + struct gsm_sms *sms; + } sms; + }; +}; + + + +struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr, + uint8_t proto, uint8_t trans_id); +struct gsm_trans *trans_find_by_callref(struct gsm_network *net, + uint32_t callref); + +struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, + uint8_t protocol, uint8_t trans_id, + uint32_t callref); +void trans_free(struct gsm_trans *trans); + +int trans_assign_trans_id(struct gsm_subscriber *subscr, + uint8_t protocol, uint8_t ti_flag); + +#endif diff --git a/openbsc/include/openbsc/libmsc/ussd.h b/openbsc/include/openbsc/libmsc/ussd.h new file mode 100644 index 0000000..2665468 --- /dev/null +++ b/openbsc/include/openbsc/libmsc/ussd.h @@ -0,0 +1,10 @@ +#ifndef _USSD_H +#define _USSD_H + +/* Handler function for mobile-originated USSD messages */ + +#include <osmocom/core/msgb.h> + +int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg); + +#endif diff --git a/openbsc/include/openbsc/libtrau/rtp_proxy.h b/openbsc/include/openbsc/libtrau/rtp_proxy.h new file mode 100644 index 0000000..26cac0d --- /dev/null +++ b/openbsc/include/openbsc/libtrau/rtp_proxy.h @@ -0,0 +1,91 @@ +#ifndef _RTP_PROXY_H +#define _RTP_PROXY_H + +/* RTP proxy handling for ip.access nanoBTS */ + +/* (C) 2009 by Harald Welte laforge@gnumonks.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + + +#include <netinet/in.h> + +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/select.h> + +#include <openbsc/mncc.h> + +#define RTP_PT_GSM_FULL 3 +#define RTP_PT_GSM_HALF 96 +#define RTP_PT_GSM_EFR 97 +#define RTP_PT_AMR 98 + +enum rtp_rx_action { + RTP_NONE, + RTP_PROXY, + RTP_RECV_UPSTREAM, +}; + +enum rtp_tx_action { + RTP_SEND_NONE, + RTP_SEND_DOWNSTREAM, +}; + +struct rtp_sub_socket { + struct sockaddr_in sin_local; + struct sockaddr_in sin_remote; + + struct osmo_fd bfd; + /* linked list of to-be-transmitted msgb's */ + struct llist_head tx_queue; +}; + +struct rtp_socket { + struct llist_head list; + + struct rtp_sub_socket rtp; + struct rtp_sub_socket rtcp; + + /* what should we do on receive? */ + enum rtp_rx_action rx_action; + union { + struct { + struct rtp_socket *other_sock; + } proxy; + struct { + struct gsm_network *net; + uint32_t callref; + } receive; + }; + enum rtp_tx_action tx_action; + struct { + uint16_t sequence; + uint32_t timestamp; + uint32_t ssrc; + struct timeval last_tv; + } transmit; +}; + +struct rtp_socket *rtp_socket_create(void); +int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip); +int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port); +int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other); +int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, uint32_t callref); +int rtp_socket_free(struct rtp_socket *rs); +int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame); + +#endif /* _RTP_PROXY_H */ diff --git a/openbsc/include/openbsc/libtrau/trau_mux.h b/openbsc/include/openbsc/libtrau/trau_mux.h new file mode 100644 index 0000000..2c01b06 --- /dev/null +++ b/openbsc/include/openbsc/libtrau/trau_mux.h @@ -0,0 +1,55 @@ +/* Simple TRAU frame reflector to route voice calls */ + +/* (C) 2009 by Harald Welte laforge@gnumonks.org + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +/* The "TRAU mux map" defines which particular 16kbit sub-slot (in which E1 + * timeslot on which E1 interface) should be directly muxed to which other + * sub-slot. Entries in the mux map are always bi-directional. + * + * The idea of all this is to directly switch voice channels in the BSC + * from one phone to another. We do this right now since we don't support + * any external interface for voice channels, and in the future as an + * optimization to routing them externally. + */ + +#include <stdint.h> +#include <openbsc/gsm_data.h> +#include <openbsc/mncc.h> + +/* map a TRAU mux map entry */ +int trau_mux_map(const struct gsm_e1_subslot *src, + const struct gsm_e1_subslot *dst); +int trau_mux_map_lchan(const struct gsm_lchan *src, + const struct gsm_lchan *dst); + +/* unmap a TRAU mux map entry */ +int trau_mux_unmap(const struct gsm_e1_subslot *ss, uint32_t callref); + +/* we get called by subchan_demux */ +int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, + const uint8_t *trau_bits, int num_bits); + +/* add a trau receiver */ +int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref); + +/* send trau from application */ +int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame); + +/* callback invoked if we receive TRAU frames */ +int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv); diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h deleted file mode 100644 index f235df6..0000000 --- a/openbsc/include/openbsc/meas_rep.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _MEAS_REP_H -#define _MEAS_REP_H - -#include <stdint.h> - -#define MRC_F_PROCESSED 0x0001 - -/* extracted from a L3 measurement report IE */ -struct gsm_meas_rep_cell { - uint8_t rxlev; - uint8_t bsic; - uint8_t neigh_idx; - uint16_t arfcn; - unsigned int flags; -}; - -/* RX Level and RX Quality */ -struct gsm_rx_lev_qual { - uint8_t rx_lev; - uint8_t rx_qual; -}; - -/* unidirectional measumrement report */ -struct gsm_meas_rep_unidir { - struct gsm_rx_lev_qual full; - struct gsm_rx_lev_qual sub; -}; - -#define MEAS_REP_F_UL_DTX 0x01 -#define MEAS_REP_F_DL_VALID 0x02 -#define MEAS_REP_F_BA1 0x04 -#define MEAS_REP_F_DL_DTX 0x08 -#define MEAS_REP_F_MS_TO 0x10 -#define MEAS_REP_F_MS_L1 0x20 -#define MEAS_REP_F_FPC 0x40 - -/* parsed uplink and downlink measurement result */ -struct gsm_meas_rep { - /* back-pointer to the logical channel */ - struct gsm_lchan *lchan; - - /* number of the measurement report */ - uint8_t nr; - /* flags, see MEAS_REP_F_* */ - unsigned int flags; - - /* uplink and downlink rxlev, rxqual; full and sub */ - struct gsm_meas_rep_unidir ul; - struct gsm_meas_rep_unidir dl; - - uint8_t bs_power; - uint8_t ms_timing_offset; - struct { - int8_t pwr; /* MS power in dBm */ - uint8_t ta; /* MS timing advance */ - } ms_l1; - - /* neighbor measurement reports for up to 6 cells */ - int num_cell; - struct gsm_meas_rep_cell cell[6]; -}; - -enum meas_rep_field { - MEAS_REP_DL_RXLEV_FULL, - MEAS_REP_DL_RXLEV_SUB, - MEAS_REP_DL_RXQUAL_FULL, - MEAS_REP_DL_RXQUAL_SUB, - MEAS_REP_UL_RXLEV_FULL, - MEAS_REP_UL_RXLEV_SUB, - MEAS_REP_UL_RXQUAL_FULL, - MEAS_REP_UL_RXQUAL_SUB, -}; - -/* obtain an average over the last 'num' fields in the meas reps */ -int get_meas_rep_avg(const struct gsm_lchan *lchan, - enum meas_rep_field field, unsigned int num); - -/* Check if N out of M last values for FIELD are >= bd */ -int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan, - enum meas_rep_field field, - unsigned int n, unsigned int m, int be); - -unsigned int calc_initial_idx(unsigned int array_size, - unsigned int meas_rep_idx, - unsigned int num_values); - -#endif /* _MEAS_REP_H */ diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h deleted file mode 100644 index 8c59fe2..0000000 --- a/openbsc/include/openbsc/mncc.h +++ /dev/null @@ -1,173 +0,0 @@ -/* GSM Mobile Radio Interface Layer 3 messages on the A-bis interface - * 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */ - -/* (C) 2008-2009 by Harald Welte laforge@gnumonks.org - * (C) 2008, 2009 by Holger Hans Peter Freyther zecke@selfish.org - * - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef _MNCC_H -#define _MNCC_H - -#include <osmocom/core/linuxlist.h> -#include <osmocom/gsm/mncc.h> - -#include <stdint.h> - -struct gsm_network; -struct msgb; - - -/* One end of a call */ -struct gsm_call { - struct llist_head entry; - - /* network handle */ - void *net; - - /* the 'local' transaction */ - uint32_t callref; - /* the 'remote' transaction */ - uint32_t remote_ref; -}; - -#define MNCC_SETUP_REQ 0x0101 -#define MNCC_SETUP_IND 0x0102 -#define MNCC_SETUP_RSP 0x0103 -#define MNCC_SETUP_CNF 0x0104 -#define MNCC_SETUP_COMPL_REQ 0x0105 -#define MNCC_SETUP_COMPL_IND 0x0106 -/* MNCC_REJ_* is perfomed via MNCC_REL_* */ -#define MNCC_CALL_CONF_IND 0x0107 -#define MNCC_CALL_PROC_REQ 0x0108 -#define MNCC_PROGRESS_REQ 0x0109 -#define MNCC_ALERT_REQ 0x010a -#define MNCC_ALERT_IND 0x010b -#define MNCC_NOTIFY_REQ 0x010c -#define MNCC_NOTIFY_IND 0x010d -#define MNCC_DISC_REQ 0x010e -#define MNCC_DISC_IND 0x010f -#define MNCC_REL_REQ 0x0110 -#define MNCC_REL_IND 0x0111 -#define MNCC_REL_CNF 0x0112 -#define MNCC_FACILITY_REQ 0x0113 -#define MNCC_FACILITY_IND 0x0114 -#define MNCC_START_DTMF_IND 0x0115 -#define MNCC_START_DTMF_RSP 0x0116 -#define MNCC_START_DTMF_REJ 0x0117 -#define MNCC_STOP_DTMF_IND 0x0118 -#define MNCC_STOP_DTMF_RSP 0x0119 -#define MNCC_MODIFY_REQ 0x011a -#define MNCC_MODIFY_IND 0x011b -#define MNCC_MODIFY_RSP 0x011c -#define MNCC_MODIFY_CNF 0x011d -#define MNCC_MODIFY_REJ 0x011e -#define MNCC_HOLD_IND 0x011f -#define MNCC_HOLD_CNF 0x0120 -#define MNCC_HOLD_REJ 0x0121 -#define MNCC_RETRIEVE_IND 0x0122 -#define MNCC_RETRIEVE_CNF 0x0123 -#define MNCC_RETRIEVE_REJ 0x0124 -#define MNCC_USERINFO_REQ 0x0125 -#define MNCC_USERINFO_IND 0x0126 -#define MNCC_REJ_REQ 0x0127 -#define MNCC_REJ_IND 0x0128 - -#define MNCC_BRIDGE 0x0200 -#define MNCC_FRAME_RECV 0x0201 -#define MNCC_FRAME_DROP 0x0202 -#define MNCC_LCHAN_MODIFY 0x0203 - -#define GSM_TCHF_FRAME 0x0300 -#define GSM_TCHF_FRAME_EFR 0x0301 - -#define GSM_MAX_FACILITY 128 -#define GSM_MAX_SSVERSION 128 -#define GSM_MAX_USERUSER 128 - -#define MNCC_F_BEARER_CAP 0x0001 -#define MNCC_F_CALLED 0x0002 -#define MNCC_F_CALLING 0x0004 -#define MNCC_F_REDIRECTING 0x0008 -#define MNCC_F_CONNECTED 0x0010 -#define MNCC_F_CAUSE 0x0020 -#define MNCC_F_USERUSER 0x0040 -#define MNCC_F_PROGRESS 0x0080 -#define MNCC_F_EMERGENCY 0x0100 -#define MNCC_F_FACILITY 0x0200 -#define MNCC_F_SSVERSION 0x0400 -#define MNCC_F_CCCAP 0x0800 -#define MNCC_F_KEYPAD 0x1000 -#define MNCC_F_SIGNAL 0x2000 - -struct gsm_mncc { - /* context based information */ - uint32_t msg_type; - uint32_t callref; - - /* which fields are present */ - uint32_t fields; - - /* data derived informations (MNCC_F_ based) */ - struct gsm_mncc_bearer_cap bearer_cap; - struct gsm_mncc_number called; - struct gsm_mncc_number calling; - struct gsm_mncc_number redirecting; - struct gsm_mncc_number connected; - struct gsm_mncc_cause cause; - struct gsm_mncc_progress progress; - struct gsm_mncc_useruser useruser; - struct gsm_mncc_facility facility; - struct gsm_mncc_cccap cccap; - struct gsm_mncc_ssversion ssversion; - struct { - int sup; - int inv; - } clir; - int signal; - - /* data derived information, not MNCC_F based */ - int keypad; - int more; - int notify; /* 0..127 */ - int emergency; - char imsi[16]; - - unsigned char lchan_type; - unsigned char lchan_mode; -}; - -struct gsm_data_frame { - uint32_t msg_type; - uint32_t callref; - unsigned char data[0]; -}; - -char *get_mncc_name(int value); -void mncc_set_cause(struct gsm_mncc *data, int loc, int val); -void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg); - -/* input from CC code into mncc_builtin */ -int int_mncc_recv(struct gsm_network *net, struct msgb *msg); - -/* input from CC code into mncc_sock */ -int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg); - -int mncc_sock_init(struct gsm_network *gsmnet); - -#endif diff --git a/openbsc/include/openbsc/network_listen.h b/openbsc/include/openbsc/network_listen.h deleted file mode 100644 index 67d1f4e..0000000 --- a/openbsc/include/openbsc/network_listen.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _OPENBSC_NWL_H -#define _OPENBSC_NWL_H - -#include <stdint.h> -#include <openbsc/gsm_data.h> - -void ipac_nwl_init(void); - -/* Start a NWL test. It will raise the S_IPAC_TEST_COMPLETE signal. */ -int ipac_nwl_test_start(struct gsm_bts_trx *trx, uint8_t testnr, - const uint8_t *phys_conf, unsigned int phys_conf_len); - -int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev, - uint16_t max_num_arfcns); - -#endif /* _OPENBSC_NWL_H */ diff --git a/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h new file mode 100644 index 0000000..45d4db8 --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h @@ -0,0 +1,28 @@ +/* + * (C) 2010 by Holger Hans Peter Freyther zecke@selfish.org + * (C) 2010 by On-Waves + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef OSMO_BSC_GRACE_H +#define OSMO_BSC_GRACE_H + +#include "gsm_data.h" + +int bsc_grace_allow_new_connection(struct gsm_network *network); + +#endif diff --git a/openbsc/include/openbsc/osmo-bsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_rf.h new file mode 100644 index 0000000..6db28cd --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_rf.h @@ -0,0 +1,35 @@ +#ifndef OSMO_BSC_RF +#define OSMO_BSC_RF + +#include <osmocom/core/write_queue.h> +#include <osmocom/core/timer.h> + +struct gsm_network; + +struct osmo_bsc_rf { + /* the value of signal.h */ + int policy; + struct osmo_fd listen; + struct gsm_network *gsm_network; + + const char *last_state_command; + + /* delay the command */ + char last_request; + struct osmo_timer_list delay_cmd; + + /* verify that RF is up as it should be */ + struct osmo_timer_list rf_check; + + /* some handling for the automatic grace switch */ + struct osmo_timer_list grace_timeout; +}; + +struct osmo_bsc_rf_conn { + struct osmo_wqueue queue; + struct osmo_bsc_rf *rf; +}; + +struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net); + +#endif diff --git a/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h b/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h new file mode 100644 index 0000000..b4f07e0 --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h @@ -0,0 +1,437 @@ +/* + * (C) 2010-2011 by Holger Hans Peter Freyther zecke@selfish.org + * (C) 2010-2011 by On-Waves + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#ifndef BSC_NAT_H +#define BSC_NAT_H + +#include "mgcp.h" + + +#include <osmocom/core/select.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/msgfile.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/write_queue.h> +#include <osmocom/core/rate_ctr.h> +#include <osmocom/core/statistics.h> +#include <osmocom/gsm/protocol/gsm_04_08.h> + +#include <regex.h> + +#define DIR_BSC 1 +#define DIR_MSC 2 + +#define PAGIN_GROUP_UNASSIGNED -1 + +struct sccp_source_reference; +struct sccp_connections; +struct bsc_nat_parsed; +struct bsc_nat; +struct bsc_nat_ussd_con; + +enum { + NAT_CON_TYPE_NONE, + NAT_CON_TYPE_LU, + NAT_CON_TYPE_CM_SERV_REQ, + NAT_CON_TYPE_PAG_RESP, + NAT_CON_TYPE_SSA, + NAT_CON_TYPE_LOCAL_REJECT, + NAT_CON_TYPE_OTHER, +}; + +/* + * Is this terminated to the MSC, to the local machine (release + * handling for IMSI filtering) or to a USSD provider? + */ +enum { + NAT_CON_END_MSC, + NAT_CON_END_LOCAL, + NAT_CON_END_USSD, +}; + +/* + * Pending command entry + */ +struct bsc_cmd_list { + struct llist_head list_entry; + + struct osmo_timer_list timeout; + + /* The NATed ID used on the bsc_con*/ + int nat_id; + + /* The control connection from which the command originated */ + struct ctrl_connection *ccon; + + /* The command from the control connection */ + struct ctrl_cmd *cmd; +}; + +/* + * Per BSC data structure + */ +struct bsc_connection { + struct llist_head list_entry; + + /* do we know anything about this BSC? */ + int authenticated; + + /* the fd we use to communicate */ + struct osmo_wqueue write_queue; + + /* the BSS associated */ + struct bsc_config *cfg; + + /* a timeout node */ + struct osmo_timer_list id_timeout; + + /* pong timeout */ + struct osmo_timer_list ping_timeout; + struct osmo_timer_list pong_timeout; + + /* mgcp related code */ + char *_endpoint_status; + int number_multiplexes; + int max_endpoints; + int last_endpoint; + + /* track the pending commands for this BSC */ + struct llist_head cmd_pending; + int last_id; + + /* a back pointer */ + struct bsc_nat *nat; +}; + +/** + * Stats per BSC + */ +struct bsc_config_stats { + struct rate_ctr_group *ctrg; +}; + +enum bsc_cfg_ctr { + BCFG_CTR_SCCP_CONN, + BCFG_CTR_SCCP_CALLS, + BCFG_CTR_NET_RECONN, + BCFG_CTR_DROPPED_SCCP, + BCFG_CTR_DROPPED_CALLS, + BCFG_CTR_REJECTED_CR, + BCFG_CTR_REJECTED_MSG, + BCFG_CTR_ILL_PACKET, + BCFG_CTR_CON_TYPE_LU, + BCFG_CTR_CON_CMSERV_RQ, + BCFG_CTR_CON_PAG_RESP, + BCFG_CTR_CON_SSA, + BCFG_CTR_CON_OTHER, +}; + +/** + * One BSC entry in the config + */ +struct bsc_config { + struct llist_head entry; + + char *token; + int nr; + + char *description; + + /* imsi white and blacklist */ + char *acc_lst_name; + + int forbid_paging; + int paging_group; + + /* audio handling */ + int max_endpoints; + + /* backpointer */ + struct bsc_nat *nat; + + struct bsc_config_stats stats; + + struct llist_head lac_list; +}; + +struct bsc_lac_entry { + struct llist_head entry; + uint16_t lac; +}; + +struct bsc_nat_paging_group { + struct llist_head entry; + + /* list of lac entries */ + struct llist_head lists; + int nr; +}; + +/** + * BSCs point of view of endpoints + */ +struct bsc_endpoint { + /* the operation that is carried out */ + int transaction_state; + /* the pending transaction id */ + char *transaction_id; + /* the bsc we are talking to */ + struct bsc_connection *bsc; +}; + +/** + * Statistic for the nat. + */ +struct bsc_nat_statistics { + struct { + struct osmo_counter *conn; + struct osmo_counter *calls; + } sccp; + + struct { + struct osmo_counter *reconn; + struct osmo_counter *auth_fail; + } bsc; + + struct { + struct osmo_counter *reconn; + } msc; + + struct { + struct osmo_counter *reconn; + } ussd; +}; + +enum bsc_nat_acc_ctr { + ACC_LIST_BSC_FILTER, + ACC_LIST_NAT_FILTER, +}; + +struct bsc_nat_acc_lst { + struct llist_head list; + + /* counter */ + struct rate_ctr_group *stats; + + /* the name of the list */ + const char *name; + struct llist_head fltr_list; +}; + +struct bsc_nat_acc_lst_entry { + struct llist_head list; + + /* the filter */ + char *imsi_allow; + regex_t imsi_allow_re; + char *imsi_deny; + regex_t imsi_deny_re; +}; + +/** + * the structure of the "nat" network + */ +struct bsc_nat { + /* active SCCP connections that need patching */ + struct llist_head sccp_connections; + + /* active BSC connections that need patching */ + struct llist_head bsc_connections; + + /* access lists */ + struct llist_head access_lists; + + /* paging groups */ + struct llist_head paging_groups; + + /* known BSC's */ + struct llist_head bsc_configs; + int num_bsc; + int bsc_ip_dscp; + + /* MGCP config */ + struct mgcp_config *mgcp_cfg; + uint8_t mgcp_msg[4096]; + int mgcp_length; + + /* msc things */ + struct llist_head dests; + struct bsc_msc_dest *main_dest; + struct bsc_msc_connection *msc_con; + char *token; + + /* timeouts */ + int auth_timeout; + int ping_timeout; + int pong_timeout; + + struct bsc_endpoint *bsc_endpoints; + + /* filter */ + char *acc_lst_name; + + /* number rewriting */ + char *num_rewr_name; + struct llist_head num_rewr; + + char *smsc_rewr_name; + struct llist_head smsc_rewr; + char *tpdest_match_name; + struct llist_head tpdest_match; + + /* USSD messages we want to match */ + char *ussd_lst_name; + char *ussd_query; + regex_t ussd_query_re; + char *ussd_token; + char *ussd_local; + struct osmo_fd ussd_listen; + struct bsc_nat_ussd_con *ussd_con; + + /* for maintainenance */ + int blocked; + + /* statistics */ + struct bsc_nat_statistics stats; +}; + +struct bsc_nat_ussd_con { + struct osmo_wqueue queue; + struct bsc_nat *nat; + int authorized; + + struct osmo_timer_list auth_timeout; +}; + +/* create and init the structures */ +struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token); +struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num); +void bsc_config_free(struct bsc_config *); +void bsc_config_add_lac(struct bsc_config *cfg, int lac); +void bsc_config_del_lac(struct bsc_config *cfg, int lac); +int bsc_config_handles_lac(struct bsc_config *cfg, int lac); + +struct bsc_nat *bsc_nat_alloc(void); +struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat); +void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip); + +void sccp_connection_destroy(struct sccp_connections *); +void bsc_close_connection(struct bsc_connection *); + +const char *bsc_con_type_to_string(int type); + +/** + * parse the given message into the above structure + */ +struct bsc_nat_parsed *bsc_nat_parse(struct msgb *msg); + +/** + * filter based on IP Access header in both directions + */ +int bsc_nat_filter_ipa(int direction, struct msgb *msg, struct bsc_nat_parsed *parsed); +int bsc_nat_vty_init(struct bsc_nat *nat); +int bsc_nat_find_paging(struct msgb *msg, const uint8_t **,int *len); + +/** + * Content filtering. + */ +int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg, + struct bsc_nat_parsed *, int *con_type, char **imsi); +int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg, + struct sccp_connections *con, struct bsc_nat_parsed *parsed); + +/** + * SCCP patching and handling + */ +struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed); +int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *parsed); +void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed); +struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *); +struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *); +struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *); + +/** + * MGCP/Audio handling + */ +int bsc_mgcp_nr_multiplexes(int max_endpoints); +int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length); +int bsc_mgcp_assign_patch(struct sccp_connections *, struct msgb *msg); +void bsc_mgcp_init(struct sccp_connections *); +void bsc_mgcp_dlcx(struct sccp_connections *); +void bsc_mgcp_free_endpoints(struct bsc_nat *nat); +int bsc_mgcp_nat_init(struct bsc_nat *nat); + +struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number); +struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port); +void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg); + +void bsc_mgcp_clear_endpoints_for(struct bsc_connection *bsc); +int bsc_mgcp_parse_response(const char *str, int *code, char transaction[60]); +uint32_t bsc_mgcp_extract_ci(const char *resp); + + +int bsc_write(struct bsc_connection *bsc, struct msgb *msg, int id); +int bsc_do_write(struct osmo_wqueue *queue, struct msgb *msg, int id); +int bsc_write_msg(struct osmo_wqueue *queue, struct msgb *msg); +int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg); + +/* IMSI allow/deny handling */ +struct bsc_nat_acc_lst *bsc_nat_acc_lst_find(struct bsc_nat *nat, const char *name); +struct bsc_nat_acc_lst *bsc_nat_acc_lst_get(struct bsc_nat *nat, const char *name); +void bsc_nat_acc_lst_delete(struct bsc_nat_acc_lst *lst); + +struct bsc_nat_acc_lst_entry *bsc_nat_acc_lst_entry_create(struct bsc_nat_acc_lst *); +int bsc_nat_lst_check_allow(struct bsc_nat_acc_lst *lst, const char *imsi); + +int bsc_nat_msc_is_connected(struct bsc_nat *nat); + +int bsc_conn_type_to_ctr(struct sccp_connections *conn); + +struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len); + +/** USSD filtering */ +int bsc_ussd_init(struct bsc_nat *nat); +int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct msgb *msg); +int bsc_close_ussd_connections(struct bsc_nat *nat); + +struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi); + +/** paging group handling */ +struct bsc_nat_paging_group *bsc_nat_paging_group_num(struct bsc_nat *nat, int group); +struct bsc_nat_paging_group *bsc_nat_paging_group_create(struct bsc_nat *nat, int group); +void bsc_nat_paging_group_delete(struct bsc_nat_paging_group *); +void bsc_nat_paging_group_add_lac(struct bsc_nat_paging_group *grp, int lac); +void bsc_nat_paging_group_del_lac(struct bsc_nat_paging_group *grp, int lac); + +/** + * Number rewriting support below + */ +struct bsc_nat_num_rewr_entry { + struct llist_head list; + + regex_t msisdn_reg; + regex_t num_reg; + + char *replace; +}; + +void bsc_nat_num_rewr_entry_adapt(void *ctx, struct llist_head *head, const struct osmo_config_list *); + +#endif diff --git a/openbsc/include/openbsc/osmo_bsc_grace.h b/openbsc/include/openbsc/osmo_bsc_grace.h deleted file mode 100644 index 45d4db8..0000000 --- a/openbsc/include/openbsc/osmo_bsc_grace.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * (C) 2010 by Holger Hans Peter Freyther zecke@selfish.org - * (C) 2010 by On-Waves - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef OSMO_BSC_GRACE_H -#define OSMO_BSC_GRACE_H - -#include "gsm_data.h" - -int bsc_grace_allow_new_connection(struct gsm_network *network); - -#endif diff --git a/openbsc/include/openbsc/osmo_bsc_rf.h b/openbsc/include/openbsc/osmo_bsc_rf.h deleted file mode 100644 index 6db28cd..0000000 --- a/openbsc/include/openbsc/osmo_bsc_rf.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef OSMO_BSC_RF -#define OSMO_BSC_RF - -#include <osmocom/core/write_queue.h> -#include <osmocom/core/timer.h> - -struct gsm_network; - -struct osmo_bsc_rf { - /* the value of signal.h */ - int policy; - struct osmo_fd listen; - struct gsm_network *gsm_network; - - const char *last_state_command; - - /* delay the command */ - char last_request; - struct osmo_timer_list delay_cmd; - - /* verify that RF is up as it should be */ - struct osmo_timer_list rf_check; - - /* some handling for the automatic grace switch */ - struct osmo_timer_list grace_timeout; -}; - -struct osmo_bsc_rf_conn { - struct osmo_wqueue queue; - struct osmo_bsc_rf *rf; -}; - -struct osmo_bsc_rf *osmo_bsc_rf_create(const char *path, struct gsm_network *net); - -#endif diff --git a/openbsc/include/openbsc/osmo_msc.h b/openbsc/include/openbsc/osmo_msc.h deleted file mode 100644 index beb3f5e..0000000 --- a/openbsc/include/openbsc/osmo_msc.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Routines for the MSC handling */ - -#ifndef OSMO_MSC_H -#define OSMO_MSC_H - -#include "bsc_api.h" - -struct bsc_api *msc_bsc_api(); -void msc_release_connection(struct gsm_subscriber_connection *conn); - -#endif diff --git a/openbsc/include/openbsc/paging.h b/openbsc/include/openbsc/paging.h deleted file mode 100644 index e1438ba..0000000 --- a/openbsc/include/openbsc/paging.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Paging helper and manager.... */ -/* (C) 2009 by Holger Hans Peter Freyther zecke@selfish.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -#ifndef PAGING_H -#define PAGING_H - -#include <stdlib.h> -#include <string.h> - -#include <osmocom/core/linuxlist.h> -#include "gsm_data.h" -#include "gsm_subscriber.h" -#include <osmocom/core/timer.h> - -/** - * A pending paging request - */ -struct gsm_paging_request { - /* list_head for list of all paging requests */ - struct llist_head entry; - /* the subscriber which we're paging. Later gsm_paging_request - * should probably become a part of the gsm_subscriber struct? */ - struct gsm_subscriber *subscr; - /* back-pointer to the BTS on which we are paging */ - struct gsm_bts *bts; - /* what kind of channel type do we ask the MS to establish */ - int chan_type; - - /* Timer 3113: how long do we try to page? */ - struct osmo_timer_list T3113; - - /* How often did we ask the BTS to page? */ - int attempts; - - /* callback to be called in case paging completes */ - gsm_cbfn *cbfn; - void *cbfn_param; -}; - -/* schedule paging request */ -int paging_request(struct gsm_network *network, struct gsm_subscriber *subscr, - int type, gsm_cbfn *cbfn, void *data); - -/* stop paging requests */ -void paging_request_stop(struct gsm_bts *bts, struct gsm_subscriber *subscr, - struct gsm_subscriber_connection *conn, - struct msgb *msg); - -/* update paging load */ -void paging_update_buffer_space(struct gsm_bts *bts, uint16_t); - -/* pending paging requests */ -unsigned int paging_pending_requests_nr(struct gsm_bts *bts); - -void *paging_get_data(struct gsm_bts *bts, struct gsm_subscriber *subscr); - -#endif diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h deleted file mode 100644 index 2d16a1f..0000000 --- a/openbsc/include/openbsc/rest_octets.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef _REST_OCTETS_H -#define _REST_OCTETS_H - -#include <openbsc/gsm_04_08.h> - -/* generate SI1 rest octets */ -int rest_octets_si1(uint8_t *data, uint8_t *nch_pos); - -struct gsm48_si_selection_params { - uint16_t penalty_time:5, - temp_offs:3, - cell_resel_off:6, - cbq:1, - present:1; -}; - -struct gsm48_si_power_offset { - uint8_t power_offset:2, - present:1; -}; - -struct gsm48_si3_gprs_ind { - uint8_t si13_position:1, - ra_colour:3, - present:1; -}; - -struct gsm48_lsa_params { - uint32_t prio_thr:3, - lsa_offset:3, - mcc:12, - mnc:12; - unsigned int present; -}; - -struct gsm48_si_ro_info { - struct gsm48_si_selection_params selection_params; - struct gsm48_si_power_offset power_offset; - uint8_t si2ter_indicator; - uint8_t early_cm_ctrl; - struct { - uint8_t where:3, - present:1; - } scheduling; - struct gsm48_si3_gprs_ind gprs_ind; - - /* SI 4 specific */ - struct gsm48_lsa_params lsa_params; - uint16_t cell_id; - uint8_t break_ind; /* do we have SI7 + SI8 ? */ -}; - - -/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ -int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3); - -/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ -int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4); - -enum pbcch_carrier_type { - PBCCH_BCCH, - PBCCH_ARFCN, - PBCCH_MAIO -}; - -/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */ -enum gprs_nmo { - GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */ - GPRS_NMO_II = 1, /* all paging on CCCH */ - GPRS_NMO_III = 2, /* no paging coordination */ -}; - -/* TS 04.60 12.24 */ -struct gprs_cell_options { - enum gprs_nmo nmo; - /* T3168: wait for packet uplink assignment message */ - uint32_t t3168; /* in milliseconds */ - /* T3192: wait for release of the TBF after reception of the final block */ - uint32_t t3192; /* in milliseconds */ - uint32_t drx_timer_max;/* in seconds */ - uint32_t bs_cv_max; - - uint8_t ext_info_present; - struct { - uint8_t egprs_supported; - uint8_t use_egprs_p_ch_req; - uint8_t bep_period; - uint8_t pfc_supported; - uint8_t dtm_supported; - uint8_t bss_paging_coordination; - } ext_info; -}; - -/* TS 04.60 Table 12.9.2 */ -struct gprs_power_ctrl_pars { - uint8_t alpha; - uint8_t t_avg_w; - uint8_t t_avg_t; - uint8_t pc_meas_chan; - uint8_t n_avg_i; -}; - -struct gsm48_si13_info { - struct gprs_cell_options cell_opts; - struct gprs_power_ctrl_pars pwr_ctrl_pars; - uint8_t bcch_change_mark; - uint8_t si_change_field; - uint8_t pbcch_present; - - union { - struct { - uint8_t rac; - uint8_t spgc_ccch_sup; - uint8_t net_ctrl_ord; - uint8_t prio_acc_thr; - } no_pbcch; - struct { - uint8_t psi1_rep_per; - uint8_t pb; - uint8_t tsc; - uint8_t tn; - enum pbcch_carrier_type carrier_type; - uint16_t arfcn; - uint8_t maio; - } pbcch; - }; -}; - -/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ -int rest_octets_si13(uint8_t *data, const struct gsm48_si13_info *si13); - -#endif /* _REST_OCTETS_H */ diff --git a/openbsc/include/openbsc/rtp_proxy.h b/openbsc/include/openbsc/rtp_proxy.h deleted file mode 100644 index 26cac0d..0000000 --- a/openbsc/include/openbsc/rtp_proxy.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _RTP_PROXY_H -#define _RTP_PROXY_H - -/* RTP proxy handling for ip.access nanoBTS */ - -/* (C) 2009 by Harald Welte laforge@gnumonks.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - - -#include <netinet/in.h> - -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/select.h> - -#include <openbsc/mncc.h> - -#define RTP_PT_GSM_FULL 3 -#define RTP_PT_GSM_HALF 96 -#define RTP_PT_GSM_EFR 97 -#define RTP_PT_AMR 98 - -enum rtp_rx_action { - RTP_NONE, - RTP_PROXY, - RTP_RECV_UPSTREAM, -}; - -enum rtp_tx_action { - RTP_SEND_NONE, - RTP_SEND_DOWNSTREAM, -}; - -struct rtp_sub_socket { - struct sockaddr_in sin_local; - struct sockaddr_in sin_remote; - - struct osmo_fd bfd; - /* linked list of to-be-transmitted msgb's */ - struct llist_head tx_queue; -}; - -struct rtp_socket { - struct llist_head list; - - struct rtp_sub_socket rtp; - struct rtp_sub_socket rtcp; - - /* what should we do on receive? */ - enum rtp_rx_action rx_action; - union { - struct { - struct rtp_socket *other_sock; - } proxy; - struct { - struct gsm_network *net; - uint32_t callref; - } receive; - }; - enum rtp_tx_action tx_action; - struct { - uint16_t sequence; - uint32_t timestamp; - uint32_t ssrc; - struct timeval last_tv; - } transmit; -}; - -struct rtp_socket *rtp_socket_create(void); -int rtp_socket_bind(struct rtp_socket *rs, uint32_t ip); -int rtp_socket_connect(struct rtp_socket *rs, uint32_t ip, uint16_t port); -int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other); -int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, uint32_t callref); -int rtp_socket_free(struct rtp_socket *rs); -int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame); - -#endif /* _RTP_PROXY_H */ diff --git a/openbsc/include/openbsc/silent_call.h b/openbsc/include/openbsc/silent_call.h deleted file mode 100644 index 2492903..0000000 --- a/openbsc/include/openbsc/silent_call.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _SILENT_CALL_H -#define _SILENT_CALL_H - -struct gsm_subscriber_connection; - -extern int gsm_silent_call_start(struct gsm_subscriber *subscr, - void *data, int type); -extern int gsm_silent_call_stop(struct gsm_subscriber *subscr); -extern int silent_call_rx(struct gsm_subscriber_connection *conn, struct msgb *msg); -extern int silent_call_reroute(struct gsm_subscriber_connection *conn, struct msgb *msg); - -#endif /* _SILENT_CALL_H */ diff --git a/openbsc/include/openbsc/sms_queue.h b/openbsc/include/openbsc/sms_queue.h deleted file mode 100644 index 2a8bd58..0000000 --- a/openbsc/include/openbsc/sms_queue.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SMS_QUEUE_H -#define SMS_QUEUE_H - -struct gsm_network; -struct gsm_sms_queue; -struct vty; - -int sms_queue_start(struct gsm_network *, int in_flight); -int sms_queue_trigger(struct gsm_sms_queue *); - -/* vty helper functions */ -int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty); -int sms_queue_set_max_pending(struct gsm_sms_queue *, int max); -int sms_queue_set_max_failure(struct gsm_sms_queue *, int fail); -int sms_queue_clear(struct gsm_sms_queue *); - -#endif diff --git a/openbsc/include/openbsc/socket.h b/openbsc/include/openbsc/socket.h deleted file mode 100644 index 0fd85f1..0000000 --- a/openbsc/include/openbsc/socket.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _BSC_SOCKET_H -#define _BSC_SOCKET_H - -#include <osmocom/core/select.h> - -#ifndef IPPROTO_GRE -#define IPPROTO_GRE 47 -#endif - -int make_sock(struct osmo_fd *bfd, int proto, - uint32_t ip, uint16_t port, int priv_nr, - int (*cb)(struct osmo_fd *fd, unsigned int what), void *data); - -#endif /* _BSC_SOCKET_H */ diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h deleted file mode 100644 index 6a56848..0000000 --- a/openbsc/include/openbsc/system_information.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _SYSTEM_INFO_H -#define _SYSTEM_INFO_H - -#include <osmocom/gsm/sysinfo.h> - -struct gsm_bts; - -int gsm_generate_si(struct gsm_bts *bts, enum osmo_sysinfo_type type); - -#endif diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h deleted file mode 100644 index acb2e6c..0000000 --- a/openbsc/include/openbsc/transaction.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _TRANSACT_H -#define _TRANSACT_H - -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <osmocom/core/linuxlist.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/mncc.h> - -/* One transaction */ -struct gsm_trans { - /* Entry in list of all transactions */ - struct llist_head entry; - - /* The protocol within which we live */ - uint8_t protocol; - - /* The current transaction ID */ - uint8_t transaction_id; - - /* To whom we belong, unique identifier of remote MM entity */ - struct gsm_subscriber *subscr; - - /* The associated connection we are using to transmit messages */ - struct gsm_subscriber_connection *conn; - - /* reference from MNCC or other application */ - uint32_t callref; - - /* if traffic channel receive was requested */ - int tch_recv; - - /* is thats one paging? */ - struct gsm_network **paging_request; - - union { - struct { - - /* current call state */ - int state; - - /* current timer and message queue */ - int Tcurrent; /* current CC timer */ - int T308_second; /* used to send release again */ - struct osmo_timer_list timer; - struct gsm_mncc msg; /* stores setup/disconnect/release message */ - } cc; - struct { - uint8_t link_id; /* RSL Link ID to be used for this trans */ - int is_mt; /* is this a MO (0) or MT (1) transfer */ - enum gsm411_cp_state cp_state; - struct osmo_timer_list cp_timer; - - enum gsm411_rp_state rp_state; - - struct gsm_sms *sms; - } sms; - }; -}; - - - -struct gsm_trans *trans_find_by_id(struct gsm_subscriber *subscr, - uint8_t proto, uint8_t trans_id); -struct gsm_trans *trans_find_by_callref(struct gsm_network *net, - uint32_t callref); - -struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr, - uint8_t protocol, uint8_t trans_id, - uint32_t callref); -void trans_free(struct gsm_trans *trans); - -int trans_assign_trans_id(struct gsm_subscriber *subscr, - uint8_t protocol, uint8_t ti_flag); - -#endif diff --git a/openbsc/include/openbsc/trau_mux.h b/openbsc/include/openbsc/trau_mux.h deleted file mode 100644 index 2c01b06..0000000 --- a/openbsc/include/openbsc/trau_mux.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Simple TRAU frame reflector to route voice calls */ - -/* (C) 2009 by Harald Welte laforge@gnumonks.org - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -/* The "TRAU mux map" defines which particular 16kbit sub-slot (in which E1 - * timeslot on which E1 interface) should be directly muxed to which other - * sub-slot. Entries in the mux map are always bi-directional. - * - * The idea of all this is to directly switch voice channels in the BSC - * from one phone to another. We do this right now since we don't support - * any external interface for voice channels, and in the future as an - * optimization to routing them externally. - */ - -#include <stdint.h> -#include <openbsc/gsm_data.h> -#include <openbsc/mncc.h> - -/* map a TRAU mux map entry */ -int trau_mux_map(const struct gsm_e1_subslot *src, - const struct gsm_e1_subslot *dst); -int trau_mux_map_lchan(const struct gsm_lchan *src, - const struct gsm_lchan *dst); - -/* unmap a TRAU mux map entry */ -int trau_mux_unmap(const struct gsm_e1_subslot *ss, uint32_t callref); - -/* we get called by subchan_demux */ -int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, - const uint8_t *trau_bits, int num_bits); - -/* add a trau receiver */ -int trau_recv_lchan(struct gsm_lchan *lchan, uint32_t callref); - -/* send trau from application */ -int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame); - -/* callback invoked if we receive TRAU frames */ -int subch_cb(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv); diff --git a/openbsc/include/openbsc/ussd.h b/openbsc/include/openbsc/ussd.h deleted file mode 100644 index 2665468..0000000 --- a/openbsc/include/openbsc/ussd.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _USSD_H -#define _USSD_H - -/* Handler function for mobile-originated USSD messages */ - -#include <osmocom/core/msgb.h> - -int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg); - -#endif
I'm just wondering if the 'lib' prefix is useful for the 'include' dir as well.
openbsc/include/openbsc/libctrl/control_cmd.h    |  155 +++++  openbsc/include/openbsc/libgb/gprs_bssgp.h     |  232 ++++++++
... [snip]
Cheers,
Sylvain
Hi Sylvain,
On Mon, Sep 05, 2011 at 09:48:15AM +0200, Sylvain Munaut wrote:
I'm just wondering if the 'lib' prefix is useful for the 'include' dir as well.
I'm also not convinced what it would gain us. Those header files are non-public header files, never installed on the system...
So unless there is a really compelling reason to change, I would want to have it stay like it is.
Hi,
I'm also not convinced what it would gain us. Â Those header files are non-public header files, never installed on the system...
So unless there is a really compelling reason to change, I would want to have it stay like it is.
Actually my argument might have been unclear, I meant use 'openbsc/msc/xxx.h' instead of 'openbsc/libmsc/xxx.h' (so literraly the 'lib' prefix :)
But whatever :)
@Alexander: The other fixes about non-declared things would be good though so could you resend a set with just those ?
Cheers,
Sylvain
Hi Harald,
On Mon, Sep 05, 2011 at 11:00:13AM +0200, Harald Welte wrote:
So unless there is a really compelling reason to change, I would want to have it stay like it is.
There is surely no compelling reason to do changes like these. My idea was just to add some structure to the include directory + * it was cheap * I didn't expect much trouble from the change
I have more ideas like this, e.g.: * declaring _all_ defined functions (cproto [1] makes that easy and works quite well) * sorting #include statements in groups were applicable (like in opensolaris code) * ...
Comments welcome.
Kind regards -Alexander Huemer
Hi Alexander,
On Tue, Sep 06, 2011 at 12:21:56AM +0200, Alexander Huemer wrote:
On Mon, Sep 05, 2011 at 11:00:13AM +0200, Harald Welte wrote:
So unless there is a really compelling reason to change, I would want to have it stay like it is.
There is surely no compelling reason to do changes like these. My idea was just to add some structure to the include directory +
- it was cheap
- I didn't expect much trouble from the change
I have more ideas like this, e.g.:
- declaring _all_ defined functions (cproto [1] makes that easy and works quite well)
I'm not sure if that really is good. Some of our 'undeclared functions' are more or less intentional and serve as a reminder that something still has to be cleaned up, i.e. the interface is not as clean as it should be.
- sorting #include statements in groups were applicable (like in opensolaris code)
Not sure if that makes that much sense either.
What I'd appreciate more is patches
* towards completing the recently-introduced doxygen API reference. * first aim for covering all exportet functions of all libraries in a short way * secondly, expand the documentation by making it more verbose * finally, start documenting internal interfaces inside openbsc, osmo-bts, osmocomBB, etc. * introducing EXPORT_SYMBOL() to hide library-internal symbols from applications
Regards, Harald
--- openbsc/configure.ac | 14 ++++++++ openbsc/include/openbsc/Makefile.am | 20 ++--------- openbsc/include/openbsc/gprs/Makefile.am | 1 + openbsc/include/openbsc/gprs/gb_proxy.h | 2 +- openbsc/include/openbsc/gprs/gprs_gmm.h | 2 +- openbsc/include/openbsc/gprs/gprs_llc.h | 2 +- openbsc/include/openbsc/ipaccess.h | 2 +- openbsc/include/openbsc/ipaccess/Makefile.am | 2 + openbsc/include/openbsc/ipaccess/network_listen.h | 2 +- openbsc/include/openbsc/libbsc/Makefile.am | 6 +++ openbsc/include/openbsc/libbsc/bsc_api.h | 2 +- openbsc/include/openbsc/libbsc/bsc_rll.h | 2 +- openbsc/include/openbsc/libbsc/chan_alloc.h | 2 +- openbsc/include/openbsc/libbsc/paging.h | 4 +- openbsc/include/openbsc/libbsc/rest_octets.h | 2 +- openbsc/include/openbsc/libcommon/Makefile.am | 2 + openbsc/include/openbsc/libcommon/gsm_data.h | 4 +- openbsc/include/openbsc/libctrl/Makefile.am | 2 + openbsc/include/openbsc/libgb/Makefile.am | 2 + openbsc/include/openbsc/libmgcp/Makefile.am | 2 + openbsc/include/openbsc/libmsc/Makefile.am | 7 ++++ openbsc/include/openbsc/libmsc/db.h | 2 +- openbsc/include/openbsc/libmsc/gsm_04_08.h | 2 +- openbsc/include/openbsc/libmsc/gsm_subscriber.h | 2 +- openbsc/include/openbsc/libmsc/osmo_msc.h | 2 +- openbsc/include/openbsc/libmsc/transaction.h | 8 ++-- openbsc/include/openbsc/libtrau/Makefile.am | 2 + openbsc/include/openbsc/libtrau/rtp_proxy.h | 2 +- openbsc/include/openbsc/libtrau/trau_mux.h | 4 +- openbsc/include/openbsc/mgcp.h | 2 +- openbsc/include/openbsc/osmo-bsc/Makefile.am | 2 + openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h | 2 +- openbsc/include/openbsc/osmo-bsc_mgcp/Makefile.am | 2 + openbsc/include/openbsc/osmo-bsc_nat/Makefile.am | 2 + openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h | 3 +- openbsc/include/openbsc/osmo-nitb/Makefile.am | 2 + openbsc/include/openbsc/osmo_bsc.h | 2 +- openbsc/include/openbsc/osmo_msc_data.h | 2 +- openbsc/include/openbsc/signal.h | 2 +- openbsc/include/openbsc/utils/Makefile.am | 2 + openbsc/src/gprs/crc24.c | 2 +- openbsc/src/gprs/gb_proxy.c | 8 ++-- openbsc/src/gprs/gb_proxy_main.c | 8 ++-- openbsc/src/gprs/gb_proxy_vty.c | 6 ++-- openbsc/src/gprs/gprs_gmm.c | 22 ++++++------ openbsc/src/gprs/gprs_llc.c | 14 ++++---- openbsc/src/gprs/gprs_llc_vty.c | 6 ++-- openbsc/src/gprs/gprs_sgsn.c | 12 +++--- openbsc/src/gprs/gprs_sndcp.c | 8 ++-- openbsc/src/gprs/gprs_sndcp_vty.c | 6 ++-- openbsc/src/gprs/sgsn_libgtp.c | 10 +++--- openbsc/src/gprs/sgsn_main.c | 8 ++-- openbsc/src/gprs/sgsn_vty.c | 6 ++-- openbsc/src/ipaccess/ipaccess-config.c | 16 +++++----- openbsc/src/ipaccess/ipaccess-find.c | 2 +- openbsc/src/ipaccess/ipaccess-firmware.c | 2 +- openbsc/src/ipaccess/ipaccess-proxy.c | 6 ++-- openbsc/src/ipaccess/network_listen.c | 6 ++-- openbsc/src/libbsc/abis_nm.c | 6 ++-- openbsc/src/libbsc/abis_nm_vty.c | 6 ++-- openbsc/src/libbsc/abis_om2000.c | 8 ++-- openbsc/src/libbsc/abis_om2000_vty.c | 6 ++-- openbsc/src/libbsc/abis_rsl.c | 18 +++++----- openbsc/src/libbsc/bsc_api.c | 16 +++++----- openbsc/src/libbsc/bsc_init.c | 16 +++++----- openbsc/src/libbsc/bsc_msc.c | 4 +- openbsc/src/libbsc/bsc_rll.c | 10 +++--- openbsc/src/libbsc/bsc_vty.c | 24 +++++++------- openbsc/src/libbsc/bts_ericsson_rbs2000.c | 8 ++-- openbsc/src/libbsc/bts_hsl_femtocell.c | 8 ++-- openbsc/src/libbsc/bts_ipaccess_nanobts.c | 12 +++--- openbsc/src/libbsc/bts_nokia_site.c | 6 ++-- openbsc/src/libbsc/bts_siemens_bs11.c | 6 ++-- openbsc/src/libbsc/bts_unknown.c | 4 +- openbsc/src/libbsc/chan_alloc.c | 10 +++--- openbsc/src/libbsc/e1_config.c | 8 ++-- openbsc/src/libbsc/gsm_04_08_utils.c | 10 +++--- openbsc/src/libbsc/gsm_subscriber_base.c | 4 +- openbsc/src/libbsc/handover_decision.c | 6 ++-- openbsc/src/libbsc/handover_logic.c | 16 +++++----- openbsc/src/libbsc/meas_proc.c | 6 ++-- openbsc/src/libbsc/meas_rep.c | 4 +- openbsc/src/libbsc/paging.c | 12 +++--- openbsc/src/libbsc/rest_octets.c | 4 +- openbsc/src/libbsc/system_information.c | 10 +++--- openbsc/src/libcommon/common_vty.c | 8 ++-- openbsc/src/libcommon/debug.c | 6 ++-- openbsc/src/libcommon/gsm_data.c | 4 +- openbsc/src/libcommon/gsm_data_shared.c | 2 +- openbsc/src/libcommon/socket.c | 4 +- openbsc/src/libcommon/talloc_ctx.c | 2 +- openbsc/src/libctrl/control_cmd.c | 4 +- openbsc/src/libctrl/control_if.c | 12 +++--- openbsc/src/libgb/gprs_bssgp.c | 14 ++++---- openbsc/src/libgb/gprs_bssgp_util.c | 8 ++-- openbsc/src/libgb/gprs_bssgp_vty.c | 8 ++-- openbsc/src/libgb/gprs_ns.c | 12 +++--- openbsc/src/libgb/gprs_ns_frgre.c | 6 ++-- openbsc/src/libgb/gprs_ns_vty.c | 8 ++-- openbsc/src/libmsc/auth.c | 8 ++-- openbsc/src/libmsc/db.c | 10 +++--- openbsc/src/libmsc/gsm_04_08.c | 36 ++++++++++---------- openbsc/src/libmsc/gsm_04_11.c | 26 +++++++------- openbsc/src/libmsc/gsm_04_80.c | 10 +++--- openbsc/src/libmsc/gsm_subscriber.c | 10 +++--- openbsc/src/libmsc/mncc.c | 12 +++--- openbsc/src/libmsc/mncc_builtin.c | 12 +++--- openbsc/src/libmsc/mncc_sock.c | 6 ++-- openbsc/src/libmsc/osmo_msc.c | 8 ++-- openbsc/src/libmsc/rrlp.c | 6 ++-- openbsc/src/libmsc/silent_call.c | 14 ++++---- openbsc/src/libmsc/sms_queue.c | 14 ++++---- openbsc/src/libmsc/token_auth.c | 12 +++--- openbsc/src/libmsc/transaction.c | 18 +++++----- openbsc/src/libmsc/ussd.c | 8 ++-- openbsc/src/libmsc/vty_interface_layer3.c | 20 ++++++------ openbsc/src/libtrau/rtp_proxy.c | 8 ++-- openbsc/src/libtrau/trau_mux.c | 6 ++-- openbsc/src/libtrau/trau_upqueue.c | 4 +- openbsc/src/osmo-bsc/osmo_bsc_api.c | 2 +- openbsc/src/osmo-bsc/osmo_bsc_audio.c | 6 ++-- openbsc/src/osmo-bsc/osmo_bsc_bssap.c | 8 ++-- openbsc/src/osmo-bsc/osmo_bsc_filter.c | 8 ++-- openbsc/src/osmo-bsc/osmo_bsc_grace.c | 6 ++-- openbsc/src/osmo-bsc/osmo_bsc_main.c | 8 ++-- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 8 ++-- openbsc/src/osmo-bsc/osmo_bsc_rf.c | 6 ++-- openbsc/src/osmo-bsc/osmo_bsc_sccp.c | 6 ++-- openbsc/src/osmo-bsc/osmo_bsc_vty.c | 2 +- openbsc/src/osmo-bsc_mgcp/mgcp_main.c | 4 +- openbsc/src/osmo-bsc_nat/bsc_filter.c | 4 +- openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c | 6 ++-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 12 +++--- openbsc/src/osmo-bsc_nat/bsc_nat_utils.c | 8 ++-- openbsc/src/osmo-bsc_nat/bsc_nat_vty.c | 8 ++-- openbsc/src/osmo-bsc_nat/bsc_sccp.c | 4 +- openbsc/src/osmo-bsc_nat/bsc_ussd.c | 4 +- openbsc/src/osmo-nitb/bsc_hack.c | 10 +++--- openbsc/src/utils/bs11_config.c | 6 ++-- openbsc/tests/channel/channel_test.c | 4 +- openbsc/tests/db/db_test.c | 4 +- openbsc/tests/debug/debug_test.c | 2 +- openbsc/tests/gsm0408/gsm0408_test.c | 6 ++-- 143 files changed, 526 insertions(+), 489 deletions(-) create mode 100644 openbsc/include/openbsc/gprs/Makefile.am create mode 100644 openbsc/include/openbsc/ipaccess/Makefile.am create mode 100644 openbsc/include/openbsc/libbsc/Makefile.am create mode 100644 openbsc/include/openbsc/libcommon/Makefile.am create mode 100644 openbsc/include/openbsc/libctrl/Makefile.am create mode 100644 openbsc/include/openbsc/libgb/Makefile.am create mode 100644 openbsc/include/openbsc/libmgcp/Makefile.am create mode 100644 openbsc/include/openbsc/libmsc/Makefile.am create mode 100644 openbsc/include/openbsc/libtrau/Makefile.am create mode 100644 openbsc/include/openbsc/osmo-bsc/Makefile.am create mode 100644 openbsc/include/openbsc/osmo-bsc_mgcp/Makefile.am create mode 100644 openbsc/include/openbsc/osmo-bsc_nat/Makefile.am create mode 100644 openbsc/include/openbsc/osmo-nitb/Makefile.am create mode 100644 openbsc/include/openbsc/utils/Makefile.am
diff --git a/openbsc/configure.ac b/openbsc/configure.ac index a8e29b4..ca933dc 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -88,6 +88,20 @@ AM_CONFIG_HEADER(bscconfig.h) AC_OUTPUT( openbsc.pc include/openbsc/Makefile + include/openbsc/gprs/Makefile + include/openbsc/ipaccess/Makefile + include/openbsc/libbsc/Makefile + include/openbsc/libcommon/Makefile + include/openbsc/libctrl/Makefile + include/openbsc/libgb/Makefile + include/openbsc/libmgcp/Makefile + include/openbsc/libmsc/Makefile + include/openbsc/libtrau/Makefile + include/openbsc/osmo-bsc/Makefile + include/openbsc/osmo-bsc_mgcp/Makefile + include/openbsc/osmo-bsc_nat/Makefile + include/openbsc/osmo-nitb/Makefile + include/openbsc/utils/Makefile include/Makefile src/Makefile src/libtrau/Makefile diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index bb78535..779f172 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -1,17 +1,5 @@ -noinst_HEADERS = abis_nm.h abis_rsl.h db.h gsm_04_08.h gsm_data.h \ - gsm_subscriber.h gsm_04_11.h debug.h signal.h \ - misdn.h chan_alloc.h paging.h \ - trau_mux.h rs232.h openbscdefines.h rtp_proxy.h \ - bsc_rll.h mncc.h transaction.h ussd.h gsm_04_80.h \ - silent_call.h mgcp.h meas_rep.h rest_octets.h \ - system_information.h handover.h mgcp_internal.h \ - vty.h socket.h \ - crc24.h gprs_bssgp.h gprs_llc.h gprs_ns.h gprs_gmm.h \ - gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \ - gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \ - osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \ - osmo_msc_data.h osmo_bsc_grace.h sms_queue.h abis_om2000.h \ - bss.h gsm_data_shared.h control_cmd.h ipaccess.h mncc_int.h +noinst_HEADERS = bsc_nat_sccp.h bss.h gsm_04_08_gprs.h handover.h \ + ipaccess.h mgcp.h mgcp_internal.h misdn.h mncc_int.h \ + openbscdefines.h osmo_bsc.h osmo_msc_data.h rs232.h \ + sgsn.h signal.h vty.h
-openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h -openbscdir = $(includedir)/openbsc diff --git a/openbsc/include/openbsc/gprs/Makefile.am b/openbsc/include/openbsc/gprs/Makefile.am new file mode 100644 index 0000000..4f7a1af --- /dev/null +++ b/openbsc/include/openbsc/gprs/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = crc24.h gb_proxy.h gprs_gmm.h gprs_llc.h gprs_sgsn.h diff --git a/openbsc/include/openbsc/gprs/gb_proxy.h b/openbsc/include/openbsc/gprs/gb_proxy.h index c0cdcbf..52f222a 100644 --- a/openbsc/include/openbsc/gprs/gb_proxy.h +++ b/openbsc/include/openbsc/gprs/gb_proxy.h @@ -4,7 +4,7 @@
#include <osmocom/core/msgb.h>
-#include <openbsc/gprs_ns.h> +#include <openbsc/libgb/gprs_ns.h> #include <osmocom/vty/command.h>
struct gbproxy_config { diff --git a/openbsc/include/openbsc/gprs/gprs_gmm.h b/openbsc/include/openbsc/gprs/gprs_gmm.h index f6b3e5e..f1223e8 100644 --- a/openbsc/include/openbsc/gprs/gprs_gmm.h +++ b/openbsc/include/openbsc/gprs/gprs_gmm.h @@ -2,7 +2,7 @@ #define _GPRS_GMM_H
#include <osmocom/core/msgb.h> -#include <openbsc/gprs_sgsn.h> +#include <openbsc/gprs/gprs_sgsn.h>
int gsm48_tx_gsm_deact_pdp_req(struct sgsn_pdp_ctx *pdp, uint8_t sm_cause); int gsm48_tx_gsm_act_pdp_rej(struct sgsn_mm_ctx *mm, uint8_t tid, diff --git a/openbsc/include/openbsc/gprs/gprs_llc.h b/openbsc/include/openbsc/gprs/gprs_llc.h index 9f17605..0408a4d 100644 --- a/openbsc/include/openbsc/gprs/gprs_llc.h +++ b/openbsc/include/openbsc/gprs/gprs_llc.h @@ -2,7 +2,7 @@ #define _GPRS_LLC_H
#include <stdint.h> -#include <openbsc/gprs_sgsn.h> +#include <openbsc/gprs/gprs_sgsn.h>
/* Section 4.7 LLC Layer Structure */ enum gprs_llc_sapi { diff --git a/openbsc/include/openbsc/ipaccess.h b/openbsc/include/openbsc/ipaccess.h index d3c9d1d..a33cd6d 100644 --- a/openbsc/include/openbsc/ipaccess.h +++ b/openbsc/include/openbsc/ipaccess.h @@ -2,7 +2,7 @@ #define _IPACCESS_H
#include <osmocom/abis/e1_input.h> -#include "gsm_subscriber.h" +#include <openbsc/libmsc/gsm_subscriber.h> #include <osmocom/core/linuxlist.h> #include <osmocom/gsm/protocol/ipaccess.h>
diff --git a/openbsc/include/openbsc/ipaccess/Makefile.am b/openbsc/include/openbsc/ipaccess/Makefile.am new file mode 100644 index 0000000..cc1ed16 --- /dev/null +++ b/openbsc/include/openbsc/ipaccess/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = network_listen.h + diff --git a/openbsc/include/openbsc/ipaccess/network_listen.h b/openbsc/include/openbsc/ipaccess/network_listen.h index 67d1f4e..c627dbc 100644 --- a/openbsc/include/openbsc/ipaccess/network_listen.h +++ b/openbsc/include/openbsc/ipaccess/network_listen.h @@ -2,7 +2,7 @@ #define _OPENBSC_NWL_H
#include <stdint.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
void ipac_nwl_init(void);
diff --git a/openbsc/include/openbsc/libbsc/Makefile.am b/openbsc/include/openbsc/libbsc/Makefile.am new file mode 100644 index 0000000..163fa89 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/Makefile.am @@ -0,0 +1,6 @@ +noinst_HEADERS = abis_nm.h abis_om2000.h abis_rsl.h bsc_msc.h bsc_rll.h \ + chan_alloc.h paging.h rest_octets.h system_information.h + +openbsc_HEADERS = meas_rep.h bsc_api.h +openbscdir = $(includedir)/openbsc + diff --git a/openbsc/include/openbsc/libbsc/bsc_api.h b/openbsc/include/openbsc/libbsc/bsc_api.h index 36ec370..ee72af0 100644 --- a/openbsc/include/openbsc/libbsc/bsc_api.h +++ b/openbsc/include/openbsc/libbsc/bsc_api.h @@ -3,7 +3,7 @@ #ifndef OPENBSC_BSC_API_H #define OPENBSC_BSC_API_H
-#include "gsm_data.h" +#include <openbsc/libcommon/gsm_data.h>
#define BSC_API_CONN_POL_ACCEPT 0 #define BSC_API_CONN_POL_REJECT 1 diff --git a/openbsc/include/openbsc/libbsc/bsc_rll.h b/openbsc/include/openbsc/libbsc/bsc_rll.h index 729ba60..9639dc9 100644 --- a/openbsc/include/openbsc/libbsc/bsc_rll.h +++ b/openbsc/include/openbsc/libbsc/bsc_rll.h @@ -1,7 +1,7 @@ #ifndef _BSC_RLL_H #define _BSC_RLL_H
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
enum bsc_rllr_ind { BSC_RLLR_IND_EST_CONF, diff --git a/openbsc/include/openbsc/libbsc/chan_alloc.h b/openbsc/include/openbsc/libbsc/chan_alloc.h index 5eda312..d877da6 100644 --- a/openbsc/include/openbsc/libbsc/chan_alloc.h +++ b/openbsc/include/openbsc/libbsc/chan_alloc.h @@ -20,7 +20,7 @@ #ifndef _CHAN_ALLOC_H #define _CHAN_ALLOC_H
-#include "gsm_data.h" +#include <openbsc/libcommon/gsm_data.h>
struct gsm_subscriber_connection;
diff --git a/openbsc/include/openbsc/libbsc/paging.h b/openbsc/include/openbsc/libbsc/paging.h index e1438ba..2abe290 100644 --- a/openbsc/include/openbsc/libbsc/paging.h +++ b/openbsc/include/openbsc/libbsc/paging.h @@ -24,8 +24,8 @@ #include <string.h>
#include <osmocom/core/linuxlist.h> -#include "gsm_data.h" -#include "gsm_subscriber.h" +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> #include <osmocom/core/timer.h>
/** diff --git a/openbsc/include/openbsc/libbsc/rest_octets.h b/openbsc/include/openbsc/libbsc/rest_octets.h index 2d16a1f..4973366 100644 --- a/openbsc/include/openbsc/libbsc/rest_octets.h +++ b/openbsc/include/openbsc/libbsc/rest_octets.h @@ -1,7 +1,7 @@ #ifndef _REST_OCTETS_H #define _REST_OCTETS_H
-#include <openbsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_04_08.h>
/* generate SI1 rest octets */ int rest_octets_si1(uint8_t *data, uint8_t *nch_pos); diff --git a/openbsc/include/openbsc/libcommon/Makefile.am b/openbsc/include/openbsc/libcommon/Makefile.am new file mode 100644 index 0000000..ea4be7a --- /dev/null +++ b/openbsc/include/openbsc/libcommon/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = debug.h gsm_data.h gsm_data_shared.h socket.h + diff --git a/openbsc/include/openbsc/libcommon/gsm_data.h b/openbsc/include/openbsc/libcommon/gsm_data.h index f74ece8..35c3971 100644 --- a/openbsc/include/openbsc/libcommon/gsm_data.h +++ b/openbsc/include/openbsc/libcommon/gsm_data.h @@ -6,7 +6,7 @@ #include <osmocom/core/timer.h> #include <osmocom/core/select.h>
-#include <openbsc/rest_octets.h> +#include <openbsc/libbsc/rest_octets.h> #include <osmocom/abis/e1_input.h>
#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3] @@ -152,7 +152,7 @@ struct gsm_subscriber_connection {
#define ROLE_BSC -#include "gsm_data_shared.h" +#include <openbsc/libcommon/gsm_data_shared.h>
/* Some statistics of our network */ diff --git a/openbsc/include/openbsc/libctrl/Makefile.am b/openbsc/include/openbsc/libctrl/Makefile.am new file mode 100644 index 0000000..b9da9a9 --- /dev/null +++ b/openbsc/include/openbsc/libctrl/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = control_cmd.h + diff --git a/openbsc/include/openbsc/libgb/Makefile.am b/openbsc/include/openbsc/libgb/Makefile.am new file mode 100644 index 0000000..217b1ee --- /dev/null +++ b/openbsc/include/openbsc/libgb/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = gprs_bssgp.h gprs_ns_frgre.h gprs_ns.h + diff --git a/openbsc/include/openbsc/libmgcp/Makefile.am b/openbsc/include/openbsc/libmgcp/Makefile.am new file mode 100644 index 0000000..3a9887f --- /dev/null +++ b/openbsc/include/openbsc/libmgcp/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = + diff --git a/openbsc/include/openbsc/libmsc/Makefile.am b/openbsc/include/openbsc/libmsc/Makefile.am new file mode 100644 index 0000000..cdc60cf --- /dev/null +++ b/openbsc/include/openbsc/libmsc/Makefile.am @@ -0,0 +1,7 @@ +noinst_HEADERS = auth.h db.h gsm_04_11.h gsm_04_80.h \ + gsm_subscriber.h mncc.h osmo_msc.h silent_call.h \ + sms_queue.h transaction.h ussd.h + +openbsc_HEADERS = gsm_04_08.h +openbscdir = $(includedir)/openbsc + diff --git a/openbsc/include/openbsc/libmsc/db.h b/openbsc/include/openbsc/libmsc/db.h index d0c85ea..1849cdf 100644 --- a/openbsc/include/openbsc/libmsc/db.h +++ b/openbsc/include/openbsc/libmsc/db.h @@ -20,7 +20,7 @@ #ifndef _DB_H #define _DB_H
-#include "gsm_subscriber.h" +#include <openbsc/libmsc/gsm_subscriber.h>
struct gsm_equipment; struct gsm_network; diff --git a/openbsc/include/openbsc/libmsc/gsm_04_08.h b/openbsc/include/openbsc/libmsc/gsm_04_08.h index ec6c2c0..8693ddc 100644 --- a/openbsc/include/openbsc/libmsc/gsm_04_08.h +++ b/openbsc/include/openbsc/libmsc/gsm_04_08.h @@ -5,7 +5,7 @@ #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/protocol/gsm_04_08.h>
-#include <openbsc/meas_rep.h> +#include <openbsc/libbsc/meas_rep.h>
struct msgb; struct gsm_bts; diff --git a/openbsc/include/openbsc/libmsc/gsm_subscriber.h b/openbsc/include/openbsc/libmsc/gsm_subscriber.h index 6cf8573..abd3bdc 100644 --- a/openbsc/include/openbsc/libmsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/libmsc/gsm_subscriber.h @@ -1,7 +1,7 @@ #ifndef _GSM_SUBSCR_H #define _GSM_SUBSCR_H
-#include "gsm_data.h" +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/linuxlist.h>
#define GSM_IMEI_LENGTH 17 diff --git a/openbsc/include/openbsc/libmsc/osmo_msc.h b/openbsc/include/openbsc/libmsc/osmo_msc.h index beb3f5e..59be0a8 100644 --- a/openbsc/include/openbsc/libmsc/osmo_msc.h +++ b/openbsc/include/openbsc/libmsc/osmo_msc.h @@ -3,7 +3,7 @@ #ifndef OSMO_MSC_H #define OSMO_MSC_H
-#include "bsc_api.h" +#include <openbsc/libbsc/bsc_api.h>
struct bsc_api *msc_bsc_api(); void msc_release_connection(struct gsm_subscriber_connection *conn); diff --git a/openbsc/include/openbsc/libmsc/transaction.h b/openbsc/include/openbsc/libmsc/transaction.h index acb2e6c..1363d3f 100644 --- a/openbsc/include/openbsc/libmsc/transaction.h +++ b/openbsc/include/openbsc/libmsc/transaction.h @@ -1,11 +1,11 @@ #ifndef _TRANSACT_H #define _TRANSACT_H
-#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> #include <osmocom/core/linuxlist.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/mncc.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/mncc.h>
/* One transaction */ struct gsm_trans { diff --git a/openbsc/include/openbsc/libtrau/Makefile.am b/openbsc/include/openbsc/libtrau/Makefile.am new file mode 100644 index 0000000..54befc3 --- /dev/null +++ b/openbsc/include/openbsc/libtrau/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = rtp_proxy.h trau_mux.h + diff --git a/openbsc/include/openbsc/libtrau/rtp_proxy.h b/openbsc/include/openbsc/libtrau/rtp_proxy.h index 26cac0d..ce6df63 100644 --- a/openbsc/include/openbsc/libtrau/rtp_proxy.h +++ b/openbsc/include/openbsc/libtrau/rtp_proxy.h @@ -27,7 +27,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/select.h>
-#include <openbsc/mncc.h> +#include <openbsc/libmsc/mncc.h>
#define RTP_PT_GSM_FULL 3 #define RTP_PT_GSM_HALF 96 diff --git a/openbsc/include/openbsc/libtrau/trau_mux.h b/openbsc/include/openbsc/libtrau/trau_mux.h index 2c01b06..5831618 100644 --- a/openbsc/include/openbsc/libtrau/trau_mux.h +++ b/openbsc/include/openbsc/libtrau/trau_mux.h @@ -29,8 +29,8 @@ */
#include <stdint.h> -#include <openbsc/gsm_data.h> -#include <openbsc/mncc.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/mncc.h>
/* map a TRAU mux map entry */ int trau_mux_map(const struct gsm_e1_subslot *src, diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 7c290c7..ba3147a 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -26,7 +26,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/write_queue.h>
-#include "debug.h" +#include <openbsc/libcommon/debug.h>
#include <arpa/inet.h>
diff --git a/openbsc/include/openbsc/osmo-bsc/Makefile.am b/openbsc/include/openbsc/osmo-bsc/Makefile.am new file mode 100644 index 0000000..dcff3ef --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = osmo_bsc_grace.h osmo_bsc_rf.h + diff --git a/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h index 45d4db8..96b823d 100644 --- a/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h +++ b/openbsc/include/openbsc/osmo-bsc/osmo_bsc_grace.h @@ -21,7 +21,7 @@ #ifndef OSMO_BSC_GRACE_H #define OSMO_BSC_GRACE_H
-#include "gsm_data.h" +#include <openbsc/libcommon/gsm_data.h>
int bsc_grace_allow_new_connection(struct gsm_network *network);
diff --git a/openbsc/include/openbsc/osmo-bsc_mgcp/Makefile.am b/openbsc/include/openbsc/osmo-bsc_mgcp/Makefile.am new file mode 100644 index 0000000..3a9887f --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc_mgcp/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = + diff --git a/openbsc/include/openbsc/osmo-bsc_nat/Makefile.am b/openbsc/include/openbsc/osmo-bsc_nat/Makefile.am new file mode 100644 index 0000000..027f338 --- /dev/null +++ b/openbsc/include/openbsc/osmo-bsc_nat/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = bsc_nat.h + diff --git a/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h b/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h index b4f07e0..f79eb50 100644 --- a/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h +++ b/openbsc/include/openbsc/osmo-bsc_nat/bsc_nat.h @@ -21,8 +21,7 @@ #ifndef BSC_NAT_H #define BSC_NAT_H
-#include "mgcp.h" - +#include <openbsc/mgcp.h>
#include <osmocom/core/select.h> #include <osmocom/core/msgb.h> diff --git a/openbsc/include/openbsc/osmo-nitb/Makefile.am b/openbsc/include/openbsc/osmo-nitb/Makefile.am new file mode 100644 index 0000000..3a9887f --- /dev/null +++ b/openbsc/include/openbsc/osmo-nitb/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = + diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h index 2620147..4ecfb2b 100644 --- a/openbsc/include/openbsc/osmo_bsc.h +++ b/openbsc/include/openbsc/osmo_bsc.h @@ -3,7 +3,7 @@ #ifndef OSMO_BSC_H #define OSMO_BSC_H
-#include "bsc_api.h" +#include <openbsc/libbsc/bsc_api.h>
struct sccp_connection;
diff --git a/openbsc/include/openbsc/osmo_msc_data.h b/openbsc/include/openbsc/osmo_msc_data.h index 59b75c3..6d21e9a 100644 --- a/openbsc/include/openbsc/osmo_msc_data.h +++ b/openbsc/include/openbsc/osmo_msc_data.h @@ -23,7 +23,7 @@ #ifndef _OSMO_MSC_DATA_H #define _OSMO_MSC_DATA_H
-#include "bsc_msc.h" +#include <openbsc/libbsc/bsc_msc.h>
#include <osmocom/core/timer.h>
diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 7f30f4f..cf276cb 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -25,7 +25,7 @@ #include <stdlib.h> #include <errno.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
#include <osmocom/core/signal.h>
diff --git a/openbsc/include/openbsc/utils/Makefile.am b/openbsc/include/openbsc/utils/Makefile.am new file mode 100644 index 0000000..3a9887f --- /dev/null +++ b/openbsc/include/openbsc/utils/Makefile.am @@ -0,0 +1,2 @@ +noinst_HEADERS = + diff --git a/openbsc/src/gprs/crc24.c b/openbsc/src/gprs/crc24.c index 1a420ed..9f7b740 100644 --- a/openbsc/src/gprs/crc24.c +++ b/openbsc/src/gprs/crc24.c @@ -19,7 +19,7 @@ * */
-#include <openbsc/crc24.h> +#include <openbsc/gprs/crc24.h>
/* CRC24 table - FCS */ static const uint32_t tbl_crc24[256] = { diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index 1261ccc..f9825fb 100644 --- a/openbsc/src/gprs/gb_proxy.c +++ b/openbsc/src/gprs/gb_proxy.c @@ -33,10 +33,10 @@ #include <osmocom/core/select.h>
#include <openbsc/signal.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gb_proxy.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gb_proxy.h>
struct gbprox_peer { struct llist_head list; diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c index c66350c..23c26de 100644 --- a/openbsc/src/gprs/gb_proxy_main.c +++ b/openbsc/src/gprs/gb_proxy_main.c @@ -38,11 +38,11 @@ #include <osmocom/core/rate_ctr.h>
#include <openbsc/signal.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> #include <openbsc/vty.h> -#include <openbsc/gb_proxy.h> +#include <openbsc/gprs/gb_proxy.h>
#include <osmocom/vty/command.h> #include <osmocom/vty/telnet_interface.h> diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c index 1aa4ff5..ef6b6c0 100644 --- a/openbsc/src/gprs/gb_proxy_vty.c +++ b/openbsc/src/gprs/gb_proxy_vty.c @@ -24,9 +24,9 @@
#include <osmocom/core/talloc.h>
-#include <openbsc/debug.h> -#include <openbsc/gb_proxy.h> -#include <openbsc/gprs_ns.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/gprs/gb_proxy.h> +#include <openbsc/libgb/gprs_ns.h> #include <openbsc/vty.h>
#include <osmocom/vty/command.h> diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index c9fe517..8b65955 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -30,7 +30,7 @@ #include <netinet/in.h> #include <arpa/inet.h>
-#include <openbsc/db.h> +#include <openbsc/libmsc/db.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/gsm/gsm_utils.h> @@ -38,17 +38,17 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_08.h> #include <openbsc/gsm_04_08_gprs.h> -#include <openbsc/paging.h> -#include <openbsc/transaction.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_llc.h> -#include <openbsc/gprs_sgsn.h> -#include <openbsc/gprs_gmm.h> +#include <openbsc/libbsc/paging.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_llc.h> +#include <openbsc/gprs/gprs_sgsn.h> +#include <openbsc/gprs/gprs_gmm.h> #include <openbsc/sgsn.h>
#include <pdp.h> diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c index 7d4ed51..e16a7d5 100644 --- a/openbsc/src/gprs/gprs_llc.c +++ b/openbsc/src/gprs/gprs_llc.c @@ -27,13 +27,13 @@ #include <osmocom/core/timer.h> #include <osmocom/core/talloc.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_sgsn.h> -#include <openbsc/gprs_gmm.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_llc.h> -#include <openbsc/crc24.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/gprs/gprs_sgsn.h> +#include <openbsc/gprs/gprs_gmm.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_llc.h> +#include <openbsc/gprs/crc24.h>
/* Section 8.9.9 LLC layer parameter default values */ static const struct gprs_llc_params llc_default_params[] = { diff --git a/openbsc/src/gprs/gprs_llc_vty.c b/openbsc/src/gprs/gprs_llc_vty.c index ab52699..100b5dd 100644 --- a/openbsc/src/gprs/gprs_llc_vty.c +++ b/openbsc/src/gprs/gprs_llc_vty.c @@ -26,15 +26,15 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/gprs_llc.h> +#include <openbsc/gprs/gprs_llc.h>
#include <osmocom/vty/vty.h> #include <osmocom/vty/command.h> diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index 85f7105..501465a 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -25,14 +25,14 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/timer.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_sgsn.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/gprs/gprs_sgsn.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> #include <openbsc/sgsn.h> #include <openbsc/gsm_04_08_gprs.h> -#include <openbsc/gprs_gmm.h> +#include <openbsc/gprs/gprs_gmm.h>
extern struct sgsn_instance *sgsn;
diff --git a/openbsc/src/gprs/gprs_sndcp.c b/openbsc/src/gprs/gprs_sndcp.c index 1307fe5..dd0b27a 100644 --- a/openbsc/src/gprs/gprs_sndcp.c +++ b/openbsc/src/gprs/gprs_sndcp.c @@ -28,10 +28,10 @@ #include <osmocom/core/timer.h> #include <osmocom/core/talloc.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_llc.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_llc.h> #include <openbsc/sgsn.h>
#include "gprs_sndcp.h" diff --git a/openbsc/src/gprs/gprs_sndcp_vty.c b/openbsc/src/gprs/gprs_sndcp_vty.c index 28fdc63..8ac3840 100644 --- a/openbsc/src/gprs/gprs_sndcp_vty.c +++ b/openbsc/src/gprs/gprs_sndcp_vty.c @@ -26,15 +26,15 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/gprs_llc.h> +#include <openbsc/gprs/gprs_llc.h>
#include "gprs_sndcp.h"
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c index 71694a4..0401e9f 100644 --- a/openbsc/src/gprs/sgsn_libgtp.c +++ b/openbsc/src/gprs/sgsn_libgtp.c @@ -39,12 +39,12 @@ #include <openbsc/gsm_04_08_gprs.h>
#include <openbsc/signal.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/sgsn.h> -#include <openbsc/gprs_llc.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_sgsn.h> -#include <openbsc/gprs_gmm.h> +#include <openbsc/gprs/gprs_llc.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_sgsn.h> +#include <openbsc/gprs/gprs_gmm.h>
#include <gtp.h> #include <pdp.h> diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c index 93ad33a..7506bc7 100644 --- a/openbsc/src/gprs/sgsn_main.c +++ b/openbsc/src/gprs/sgsn_main.c @@ -43,12 +43,12 @@ #include <osmocom/vty/logging.h>
#include <openbsc/signal.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/vty.h> #include <openbsc/sgsn.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_llc.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_llc.h>
#include <gtp.h>
diff --git a/openbsc/src/gprs/sgsn_vty.c b/openbsc/src/gprs/sgsn_vty.c index 4c9cf28..de6da68 100644 --- a/openbsc/src/gprs/sgsn_vty.c +++ b/openbsc/src/gprs/sgsn_vty.c @@ -26,10 +26,10 @@ #include <osmocom/core/utils.h> #include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/sgsn.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_sgsn.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/gprs/gprs_sgsn.h> #include <openbsc/vty.h> #include <openbsc/gsm_04_08_gprs.h>
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index 05fdc14..a170679 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -38,18 +38,18 @@ #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <openbsc/ipaccess.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/abis/e1_input.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> -#include <openbsc/network_listen.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/ipaccess/network_listen.h> #include <osmocom/abis/ipaccess.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> -#include <openbsc/network_listen.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/ipaccess/network_listen.h> #include <osmocom/core/talloc.h> #include <osmocom/abis/abis.h>
diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c index 3f9bf41..0b0cafd 100644 --- a/openbsc/src/ipaccess/ipaccess-find.c +++ b/openbsc/src/ipaccess/ipaccess-find.c @@ -29,7 +29,7 @@ #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <openbsc/ipaccess.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
static int udp_sock(const char *ifname) { diff --git a/openbsc/src/ipaccess/ipaccess-firmware.c b/openbsc/src/ipaccess/ipaccess-firmware.c index 5f55bb5..2149ed0 100644 --- a/openbsc/src/ipaccess/ipaccess-firmware.c +++ b/openbsc/src/ipaccess/ipaccess-firmware.c @@ -18,7 +18,7 @@ * */
-#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/ipaccess.h> #include <osmocom/core/talloc.h>
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index 0f03e4e..ae02d93 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -37,14 +37,14 @@ #define _GNU_SOURCE #include <getopt.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/application.h> #include <osmocom/core/select.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/msgb.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/ipaccess.h> -#include <openbsc/socket.h> +#include <openbsc/libcommon/socket.h> #include <osmocom/core/talloc.h>
/* one instance of an ip.access protocol proxy */ diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c index 6749c4a..b7d03de 100644 --- a/openbsc/src/ipaccess/network_listen.c +++ b/openbsc/src/ipaccess/network_listen.c @@ -33,10 +33,10 @@ #include <osmocom/gsm/rxlev_stat.h> #include <osmocom/gsm/gsm48_ie.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/abis/e1_input.h>
#define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1) diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 027a263..31faa79 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -34,13 +34,13 @@ #include <netinet/in.h> #include <arpa/inet.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/gsm/abis_nm.h> #include <osmocom/core/talloc.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h> #include <openbsc/misdn.h> #include <openbsc/signal.h> #include <osmocom/abis/e1_input.h> diff --git a/openbsc/src/libbsc/abis_nm_vty.c b/openbsc/src/libbsc/abis_nm_vty.c index bcbc92d..5b22c51 100644 --- a/openbsc/src/libbsc/abis_nm_vty.c +++ b/openbsc/src/libbsc/abis_nm_vty.c @@ -28,13 +28,13 @@
#include <osmocom/gsm/abis_nm.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h> #include <openbsc/vty.h>
#include <osmocom/vty/vty.h> diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 2216462..b380525 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -35,10 +35,10 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> -#include <openbsc/abis_nm.h> -#include <openbsc/abis_om2000.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libbsc/abis_om2000.h> #include <openbsc/signal.h> #include <osmocom/abis/e1_input.h>
diff --git a/openbsc/src/libbsc/abis_om2000_vty.c b/openbsc/src/libbsc/abis_om2000_vty.c index 704f955..e3d7ca4 100644 --- a/openbsc/src/libbsc/abis_om2000_vty.c +++ b/openbsc/src/libbsc/abis_om2000_vty.c @@ -26,13 +26,13 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/abis_om2000.h> +#include <openbsc/libbsc/abis_om2000.h> #include <openbsc/vty.h>
#include <osmocom/vty/vty.h> diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index c8bfbb6..1243e74 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -26,18 +26,18 @@ #include <netinet/in.h> #include <arpa/inet.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/gsm_04_08.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_04_08.h> #include <osmocom/gsm/gsm_utils.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/bsc_rll.h> -#include <openbsc/debug.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/bsc_rll.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/gsm/tlv.h> -#include <openbsc/paging.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/signal.h> -#include <openbsc/meas_rep.h> -#include <openbsc/rtp_proxy.h> +#include <openbsc/libbsc/meas_rep.h> +#include <openbsc/libtrau/rtp_proxy.h> #include <osmocom/abis/e1_input.h> #include <osmocom/gsm/rsl.h> #include <osmocom/core/talloc.h> diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index 9504e53..43aeb2f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -21,16 +21,16 @@ * */
-#include <openbsc/bsc_api.h> -#include <openbsc/bsc_rll.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> +#include <openbsc/libbsc/bsc_api.h> +#include <openbsc/libbsc/bsc_rll.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> #include <openbsc/signal.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/chan_alloc.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/chan_alloc.h> #include <openbsc/handover.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_08_08.h>
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 84dfa6e..ae4318b 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -19,18 +19,18 @@ * */
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/gsm/gsm_utils.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/abis_nm.h> -#include <openbsc/debug.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/misdn.h> #include <osmocom/vty/telnet_interface.h> -#include <openbsc/system_information.h> -#include <openbsc/paging.h> +#include <openbsc/libbsc/system_information.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/signal.h> -#include <openbsc/chan_alloc.h> +#include <openbsc/libbsc/chan_alloc.h> #include <osmocom/core/talloc.h> #include <openbsc/ipaccess.h>
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c index 66288a3..29045f6 100644 --- a/openbsc/src/libbsc/bsc_msc.c +++ b/openbsc/src/libbsc/bsc_msc.c @@ -19,8 +19,8 @@ * */
-#include <openbsc/bsc_msc.h> -#include <openbsc/debug.h> +#include <openbsc/libbsc/bsc_msc.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/abis/ipaccess.h>
#include <osmocom/core/write_queue.h> diff --git a/openbsc/src/libbsc/bsc_rll.c b/openbsc/src/libbsc/bsc_rll.c index d12aeee..d417fd2 100644 --- a/openbsc/src/libbsc/bsc_rll.c +++ b/openbsc/src/libbsc/bsc_rll.c @@ -22,14 +22,14 @@
#include <errno.h>
-#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/talloc.h> #include <osmocom/core/timer.h> #include <osmocom/core/linuxlist.h> -#include <openbsc/bsc_rll.h> -#include <openbsc/gsm_data.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libbsc/bsc_rll.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/abis_rsl.h> #include <openbsc/signal.h>
struct bsc_rll_req { diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index a98779d..b5d1541 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -29,26 +29,26 @@ #include <arpa/inet.h>
#include <osmocom/core/linuxlist.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/abis/e1_input.h> -#include <openbsc/abis_nm.h> -#include <openbsc/abis_om2000.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libbsc/abis_om2000.h> #include <osmocom/core/utils.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/abis_nm.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/meas_rep.h> -#include <openbsc/db.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/meas_rep.h> +#include <openbsc/libmsc/db.h> #include <osmocom/core/talloc.h> #include <openbsc/vty.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/system_information.h> -#include <openbsc/debug.h> -#include <openbsc/paging.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libbsc/system_information.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/ipaccess.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libbsc/abis_rsl.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/osmo_bsc_rf.h> +#include <openbsc/osmo-bsc/osmo_bsc_rf.h>
#include "../../bscconfig.h"
diff --git a/openbsc/src/libbsc/bts_ericsson_rbs2000.c b/openbsc/src/libbsc/bts_ericsson_rbs2000.c index 5c75192..1f8bb3c 100644 --- a/openbsc/src/libbsc/bts_ericsson_rbs2000.c +++ b/openbsc/src/libbsc/bts_ericsson_rbs2000.c @@ -22,10 +22,10 @@
#include <osmocom/gsm/tlv.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_om2000.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_om2000.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/abis/e1_input.h> #include <openbsc/signal.h>
diff --git a/openbsc/src/libbsc/bts_hsl_femtocell.c b/openbsc/src/libbsc/bts_hsl_femtocell.c index ebab34a..0ffd0ba 100644 --- a/openbsc/src/libbsc/bts_hsl_femtocell.c +++ b/openbsc/src/libbsc/bts_hsl_femtocell.c @@ -24,11 +24,11 @@ #include <arpa/inet.h>
#include <osmocom/gsm/tlv.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libbsc/abis_rsl.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/logging.h> #include <osmocom/abis/e1_input.h> #include <osmocom/abis/ipaccess.h> diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c index 42ac6b4..2266056 100644 --- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c +++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c @@ -23,17 +23,17 @@
#include <osmocom/gsm/tlv.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/signal.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/abis/e1_input.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/abis/subchan_demux.h> #include <osmocom/abis/ipaccess.h> #include <osmocom/core/logging.h> diff --git a/openbsc/src/libbsc/bts_nokia_site.c b/openbsc/src/libbsc/bts_nokia_site.c index 4b5c50f..9958432 100644 --- a/openbsc/src/libbsc/bts_nokia_site.c +++ b/openbsc/src/libbsc/bts_nokia_site.c @@ -30,9 +30,9 @@
#include <osmocom/gsm/tlv.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/abis/e1_input.h> #include <openbsc/signal.h>
diff --git a/openbsc/src/libbsc/bts_siemens_bs11.c b/openbsc/src/libbsc/bts_siemens_bs11.c index 2514d99..26ec841 100644 --- a/openbsc/src/libbsc/bts_siemens_bs11.c +++ b/openbsc/src/libbsc/bts_siemens_bs11.c @@ -22,9 +22,9 @@
#include <osmocom/gsm/tlv.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/abis/e1_input.h> #include <openbsc/signal.h>
diff --git a/openbsc/src/libbsc/bts_unknown.c b/openbsc/src/libbsc/bts_unknown.c index f113529..5c22810 100644 --- a/openbsc/src/libbsc/bts_unknown.c +++ b/openbsc/src/libbsc/bts_unknown.c @@ -20,9 +20,9 @@ */
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/gsm/tlv.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h>
static struct gsm_bts_model model_unknown = { .type = GSM_BTS_TYPE_UNKNOWN, diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c index 6f4fe20..7487478 100644 --- a/openbsc/src/libbsc/chan_alloc.c +++ b/openbsc/src/libbsc/chan_alloc.c @@ -25,11 +25,11 @@ #include <string.h> #include <errno.h>
-#include <openbsc/gsm_subscriber.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/abis_nm.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/debug.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h>
#include <osmocom/core/talloc.h> diff --git a/openbsc/src/libbsc/e1_config.c b/openbsc/src/libbsc/e1_config.c index cda1318..4f08867 100644 --- a/openbsc/src/libbsc/e1_config.c +++ b/openbsc/src/libbsc/e1_config.c @@ -23,15 +23,15 @@
#include <netinet/in.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/abis/e1_input.h> #include <osmocom/abis/trau_frame.h> -#include <openbsc/trau_mux.h> +#include <openbsc/libtrau/trau_mux.h> #include <openbsc/misdn.h> #include <osmocom/abis/ipaccess.h> #include <osmocom/core/talloc.h> -#include <openbsc/debug.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/abis_rsl.h>
#define SAPI_L2ML 0 #define SAPI_OML 62 diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 968e62e..a4dce14 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -30,11 +30,11 @@ #include <osmocom/core/msgb.h> #include <osmocom/gsm/gsm48.h>
-#include <openbsc/abis_rsl.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/transaction.h> -#include <openbsc/paging.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/signal.h>
/* should ip.access BTS use direct RTP streams between each other (1), diff --git a/openbsc/src/libbsc/gsm_subscriber_base.c b/openbsc/src/libbsc/gsm_subscriber_base.c index 11afb35..624f599 100644 --- a/openbsc/src/libbsc/gsm_subscriber_base.c +++ b/openbsc/src/libbsc/gsm_subscriber_base.c @@ -28,8 +28,8 @@ #include <assert.h>
#include <osmocom/core/talloc.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h>
LLIST_HEAD(active_subscribers); void *tall_subscr_ctx; diff --git a/openbsc/src/libbsc/handover_decision.c b/openbsc/src/libbsc/handover_decision.c index 24c0f79..7937efb 100644 --- a/openbsc/src/libbsc/handover_decision.c +++ b/openbsc/src/libbsc/handover_decision.c @@ -25,9 +25,9 @@ #include <errno.h>
#include <osmocom/core/msgb.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/meas_rep.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/meas_rep.h> #include <openbsc/signal.h> #include <osmocom/core/talloc.h> #include <openbsc/handover.h> diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c index 0f1582e..7bc9c82 100644 --- a/openbsc/src/libbsc/handover_logic.c +++ b/openbsc/src/libbsc/handover_logic.c @@ -29,17 +29,17 @@ #include <netinet/in.h>
#include <osmocom/core/msgb.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/gsm/gsm_utils.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/chan_alloc.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/chan_alloc.h> #include <openbsc/signal.h> #include <osmocom/core/talloc.h> -#include <openbsc/transaction.h> -#include <openbsc/rtp_proxy.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libtrau/rtp_proxy.h>
struct bsc_handover { struct llist_head list; diff --git a/openbsc/src/libbsc/meas_proc.c b/openbsc/src/libbsc/meas_proc.c index 5b97e74..bcc1bf4 100644 --- a/openbsc/src/libbsc/meas_proc.c +++ b/openbsc/src/libbsc/meas_proc.c @@ -24,9 +24,9 @@
#include <osmocom/core/talloc.h> #include <osmocom/core/msgb.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/meas_rep.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/meas_rep.h> #include <openbsc/signal.h>
/* process an already parsed measurement report */ diff --git a/openbsc/src/libbsc/meas_rep.c b/openbsc/src/libbsc/meas_rep.c index 808103d..9bd7a27 100644 --- a/openbsc/src/libbsc/meas_rep.c +++ b/openbsc/src/libbsc/meas_rep.c @@ -20,8 +20,8 @@ */
-#include <openbsc/gsm_data.h> -#include <openbsc/meas_rep.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/meas_rep.h>
static int get_field(const struct gsm_meas_rep *rep, enum meas_rep_field field) diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index fe60e3f..3ffbcb7 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -42,13 +42,13 @@ #include <osmocom/gsm/gsm48.h> #include <osmocom/gsm/gsm0502.h>
-#include <openbsc/paging.h> -#include <openbsc/debug.h> +#include <openbsc/libbsc/paging.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/gsm_data.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/bsc_api.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/bsc_api.h>
void *tall_paging_ctx;
diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 0545426..f96c8cc 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -25,9 +25,9 @@ #include <stdlib.h> #include <errno.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/bitvec.h> -#include <openbsc/rest_octets.h> +#include <openbsc/libbsc/rest_octets.h>
/* generate SI1 rest octets */ int rest_octets_si1(uint8_t *data, uint8_t *nch_pos) diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 5814c76..c6e166a 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -29,11 +29,11 @@ #include <osmocom/core/utils.h> #include <osmocom/gsm/sysinfo.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/gsm_data.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/rest_octets.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/rest_octets.h>
/* Frequency Lists as per TS 04.08 10.5.2.13 */ diff --git a/openbsc/src/libcommon/common_vty.c b/openbsc/src/libcommon/common_vty.c index e8486f4..77158f2 100644 --- a/openbsc/src/libcommon/common_vty.c +++ b/openbsc/src/libcommon/common_vty.c @@ -24,10 +24,10 @@ #include <osmocom/core/talloc.h>
#include <openbsc/vty.h> -#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/bsc_nat.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h>
#include <osmocom/vty/telnet_interface.h> #include <osmocom/vty/command.h> diff --git a/openbsc/src/libcommon/debug.c b/openbsc/src/libcommon/debug.c index e15342b..b8c6a06 100644 --- a/openbsc/src/libcommon/debug.c +++ b/openbsc/src/libcommon/debug.c @@ -30,9 +30,9 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/utils.h> #include <osmocom/core/logging.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h>
/* default categories */ static const struct log_info_cat default_categories[] = { diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index 8327758..d9edf75 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -32,9 +32,9 @@ #include <osmocom/gsm/abis_nm.h> #include <osmocom/core/statistics.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h>
void *tall_bsc_ctx;
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index b52d58a..51e8cf0 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -32,7 +32,7 @@ #include <osmocom/gsm/abis_nm.h> #include <osmocom/core/statistics.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
void gsm_abis_mo_reset(struct gsm_abis_mo *mo) { diff --git a/openbsc/src/libcommon/socket.c b/openbsc/src/libcommon/socket.c index 6c47a8d..a5228ff 100644 --- a/openbsc/src/libcommon/socket.c +++ b/openbsc/src/libcommon/socket.c @@ -35,8 +35,8 @@ #include <osmocom/core/select.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/msgb.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/talloc.h>
int make_sock(struct osmo_fd *bfd, int proto, diff --git a/openbsc/src/libcommon/talloc_ctx.c b/openbsc/src/libcommon/talloc_ctx.c index ae6a156..a34acb0 100644 --- a/openbsc/src/libcommon/talloc_ctx.c +++ b/openbsc/src/libcommon/talloc_ctx.c @@ -1,5 +1,5 @@ #include <osmocom/core/talloc.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h>
extern void *tall_msgb_ctx; extern void *tall_fle_ctx; diff --git a/openbsc/src/libctrl/control_cmd.c b/openbsc/src/libctrl/control_cmd.c index 3c4efc0..6f35022 100644 --- a/openbsc/src/libctrl/control_cmd.c +++ b/openbsc/src/libctrl/control_cmd.c @@ -29,8 +29,8 @@ #include <time.h> #include <unistd.h>
-#include <openbsc/control_cmd.h> -#include <openbsc/debug.h> +#include <openbsc/libctrl/control_cmd.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/vty.h>
#include <osmocom/core/msgb.h> diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index 8198ae6..affa994 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -38,15 +38,15 @@ #include <sys/socket.h> #include <sys/types.h>
-#include <openbsc/control_cmd.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libctrl/control_cmd.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/ipaccess.h> -#include <openbsc/socket.h> +#include <openbsc/libcommon/socket.h> #include <osmocom/abis/subchan_demux.h>
-#include <openbsc/abis_rsl.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/abis_nm.h>
#include <osmocom/core/msgb.h> #include <osmocom/core/rate_ctr.h> diff --git a/openbsc/src/libgb/gprs_bssgp.c b/openbsc/src/libgb/gprs_bssgp.c index 072dff6..4dbc112 100644 --- a/openbsc/src/libgb/gprs_bssgp.c +++ b/openbsc/src/libgb/gprs_bssgp.c @@ -32,14 +32,14 @@ #include <osmocom/core/talloc.h> #include <osmocom/core/rate_ctr.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/gsm_04_08_gprs.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_llc.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_sgsn.h> -#include <openbsc/gprs_gmm.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/gprs/gprs_llc.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/gprs/gprs_sgsn.h> +#include <openbsc/gprs/gprs_gmm.h>
void *bssgp_tall_ctx = NULL;
diff --git a/openbsc/src/libgb/gprs_bssgp_util.c b/openbsc/src/libgb/gprs_bssgp_util.c index a1eb37e..e1c869f 100644 --- a/openbsc/src/libgb/gprs_bssgp_util.c +++ b/openbsc/src/libgb/gprs_bssgp_util.c @@ -28,10 +28,10 @@ #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_ns.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/libgb/gprs_ns.h>
struct gprs_ns_inst *bssgp_nsi;
diff --git a/openbsc/src/libgb/gprs_bssgp_vty.c b/openbsc/src/libgb/gprs_bssgp_vty.c index a0d74ac..5c42310 100644 --- a/openbsc/src/libgb/gprs_bssgp_vty.c +++ b/openbsc/src/libgb/gprs_bssgp_vty.c @@ -26,16 +26,16 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> #include <openbsc/vty.h>
#include <osmocom/vty/vty.h> diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c index dab57e6..e21c75e 100644 --- a/openbsc/src/libgb/gprs_ns.c +++ b/openbsc/src/libgb/gprs_ns.c @@ -58,18 +58,18 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> -#include <openbsc/gprs_ns_frgre.h> -#include <openbsc/socket.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> +#include <openbsc/libgb/gprs_ns_frgre.h> +#include <openbsc/libcommon/socket.h>
static const struct tlv_definition ns_att_tlvdef = { .def = { diff --git a/openbsc/src/libgb/gprs_ns_frgre.c b/openbsc/src/libgb/gprs_ns_frgre.c index 3662572..67c8975 100644 --- a/openbsc/src/libgb/gprs_ns_frgre.c +++ b/openbsc/src/libgb/gprs_ns_frgre.c @@ -35,9 +35,9 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h>
-#include <openbsc/socket.h> -#include <openbsc/debug.h> -#include <openbsc/gprs_ns.h> +#include <openbsc/libcommon/socket.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libgb/gprs_ns.h>
#define GRE_PTYPE_FR 0x6559 #define GRE_PTYPE_IPv4 0x0800 diff --git a/openbsc/src/libgb/gprs_ns_vty.c b/openbsc/src/libgb/gprs_ns_vty.c index 14d7691..82dc6c6 100644 --- a/openbsc/src/libgb/gprs_ns_vty.c +++ b/openbsc/src/libgb/gprs_ns_vty.c @@ -26,16 +26,16 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> #include <osmocom/core/talloc.h> #include <osmocom/core/select.h> #include <osmocom/core/rate_ctr.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h> -#include <openbsc/gprs_ns.h> -#include <openbsc/gprs_bssgp.h> +#include <openbsc/libgb/gprs_ns.h> +#include <openbsc/libgb/gprs_bssgp.h> #include <openbsc/vty.h>
#include <osmocom/vty/vty.h> diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 10d8edf..38a1ac6 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -20,10 +20,10 @@ * */
-#include <openbsc/db.h> -#include <openbsc/debug.h> -#include <openbsc/auth.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/auth.h> +#include <openbsc/libcommon/gsm_data.h>
#include <osmocom/gsm/comp128.h>
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index a7eeda4..b0c0806 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -28,11 +28,11 @@ #include <errno.h> #include <dbi/dbi.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/db.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libcommon/debug.h>
#include <osmocom/core/talloc.h> #include <osmocom/core/statistics.h> diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 0cd707d..13d5938 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -29,26 +29,26 @@ #include <time.h> #include <netinet/in.h>
-#include <openbsc/auth.h> -#include <openbsc/db.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/gsm_04_80.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/paging.h> +#include <openbsc/libmsc/auth.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_04_80.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/signal.h> #include <osmocom/abis/trau_frame.h> -#include <openbsc/trau_mux.h> -#include <openbsc/rtp_proxy.h> -#include <openbsc/transaction.h> -#include <openbsc/ussd.h> -#include <openbsc/silent_call.h> -#include <openbsc/bsc_api.h> -#include <openbsc/osmo_msc.h> +#include <openbsc/libtrau/trau_mux.h> +#include <openbsc/libtrau/rtp_proxy.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libmsc/ussd.h> +#include <openbsc/libmsc/silent_call.h> +#include <openbsc/libbsc/bsc_api.h> +#include <openbsc/libmsc/osmo_msc.h> #include <osmocom/abis/e1_input.h> #include <osmocom/core/bitvec.h>
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index ee7f577..950a2f6 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -34,22 +34,22 @@
#include <osmocom/core/msgb.h> #include <osmocom/gsm/tlv.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/db.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/gsm_04_08.h> #include <osmocom/gsm/gsm_utils.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libbsc/abis_rsl.h> #include <openbsc/signal.h> -#include <openbsc/db.h> +#include <openbsc/libmsc/db.h> #include <osmocom/core/talloc.h> -#include <openbsc/transaction.h> -#include <openbsc/paging.h> -#include <openbsc/bsc_rll.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/bsc_api.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libbsc/paging.h> +#include <openbsc/libbsc/bsc_rll.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libbsc/bsc_api.h>
#define GSM411_ALLOC_SIZE 1024 #define GSM411_ALLOC_HEADROOM 128 diff --git a/openbsc/src/libmsc/gsm_04_80.c b/openbsc/src/libmsc/gsm_04_80.c index 39738a5..22874e8 100644 --- a/openbsc/src/libmsc/gsm_04_80.c +++ b/openbsc/src/libmsc/gsm_04_80.c @@ -28,11 +28,11 @@ #include <string.h> #include <errno.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/gsm_04_80.h> -#include <openbsc/bsc_api.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_04_80.h> +#include <openbsc/libbsc/bsc_api.h>
#include <osmocom/gsm/gsm0480.h> #include <osmocom/gsm/gsm_utils.h> diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index f9eebc8..fa0dbd5 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -30,12 +30,12 @@
#include <osmocom/vty/vty.h>
-#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/debug.h> -#include <openbsc/paging.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/paging.h> #include <openbsc/signal.h> -#include <openbsc/db.h> +#include <openbsc/libmsc/db.h>
void *tall_sub_req_ctx;
diff --git a/openbsc/src/libmsc/mncc.c b/openbsc/src/libmsc/mncc.c index b484772..9e19085 100644 --- a/openbsc/src/libmsc/mncc.c +++ b/openbsc/src/libmsc/mncc.c @@ -26,13 +26,13 @@ #include <string.h> #include <errno.h>
-#include <openbsc/gsm_04_08.h> -#include <openbsc/debug.h> -#include <openbsc/mncc.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/mncc.h> #include <osmocom/core/talloc.h> -#include <openbsc/gsm_data.h> -#include <openbsc/transaction.h> -#include <openbsc/rtp_proxy.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libtrau/rtp_proxy.h>
static struct mncc_names { char *name; diff --git a/openbsc/src/libmsc/mncc_builtin.c b/openbsc/src/libmsc/mncc_builtin.c index 31d9b43..5a44700 100644 --- a/openbsc/src/libmsc/mncc_builtin.c +++ b/openbsc/src/libmsc/mncc_builtin.c @@ -27,14 +27,14 @@ #include <string.h> #include <errno.h>
-#include <openbsc/gsm_04_08.h> -#include <openbsc/debug.h> -#include <openbsc/mncc.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/mncc.h> #include <openbsc/mncc_int.h> #include <osmocom/core/talloc.h> -#include <openbsc/gsm_data.h> -#include <openbsc/transaction.h> -#include <openbsc/rtp_proxy.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libtrau/rtp_proxy.h>
void *tall_call_ctx;
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c index d8caf07..d81de95 100644 --- a/openbsc/src/libmsc/mncc_sock.c +++ b/openbsc/src/libmsc/mncc_sock.c @@ -33,9 +33,9 @@ #include <osmocom/core/select.h> #include <osmocom/gsm/protocol/gsm_04_08.h>
-#include <openbsc/debug.h> -#include <openbsc/mncc.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/mncc.h> +#include <openbsc/libcommon/gsm_data.h>
struct mncc_sock_state { struct gsm_network *net; diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c index 8c86dcc..b8e9de4 100644 --- a/openbsc/src/libmsc/osmo_msc.c +++ b/openbsc/src/libmsc/osmo_msc.c @@ -21,11 +21,11 @@ * */
-#include <openbsc/bsc_api.h> -#include <openbsc/debug.h> -#include <openbsc/transaction.h> +#include <openbsc/libbsc/bsc_api.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/transaction.h>
-#include <openbsc/gsm_04_11.h> +#include <openbsc/libmsc/gsm_04_11.h>
static void msc_sapi_n_reject(struct gsm_subscriber_connection *conn, int dlci) { diff --git a/openbsc/src/libmsc/rrlp.c b/openbsc/src/libmsc/rrlp.c index 161456a..3eae7a9 100644 --- a/openbsc/src/libmsc/rrlp.c +++ b/openbsc/src/libmsc/rrlp.c @@ -21,10 +21,10 @@
-#include <openbsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_04_08.h> #include <openbsc/signal.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/chan_alloc.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libbsc/chan_alloc.h>
/* RRLP msPositionReq, nsBased, * Accuracy=60, Method=gps, ResponseTime=2, oneSet */ diff --git a/openbsc/src/libmsc/silent_call.c b/openbsc/src/libmsc/silent_call.c index 6a188c8..a657404 100644 --- a/openbsc/src/libmsc/silent_call.c +++ b/openbsc/src/libmsc/silent_call.c @@ -26,13 +26,13 @@
#include <osmocom/core/msgb.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> -#include <openbsc/paging.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/osmo_msc.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/paging.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libmsc/osmo_msc.h>
/* paging of the requested subscriber has completed */ static int paging_cb_silent(unsigned int hooknum, unsigned int event, diff --git a/openbsc/src/libmsc/sms_queue.c b/openbsc/src/libmsc/sms_queue.c index e685973..6562527 100644 --- a/openbsc/src/libmsc/sms_queue.c +++ b/openbsc/src/libmsc/sms_queue.c @@ -28,13 +28,13 @@ * things up by collecting data from other parts of the system. */
-#include <openbsc/sms_queue.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/db.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/gsm_subscriber.h> +#include <openbsc/libmsc/sms_queue.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/gsm_subscriber.h> #include <openbsc/signal.h>
#include <osmocom/core/talloc.h> diff --git a/openbsc/src/libmsc/token_auth.c b/openbsc/src/libmsc/token_auth.c index cf26ba8..c3fce53 100644 --- a/openbsc/src/libmsc/token_auth.c +++ b/openbsc/src/libmsc/token_auth.c @@ -22,12 +22,12 @@ #include <stdio.h> #include <osmocom/core/talloc.h> #include <openbsc/signal.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_04_11.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/db.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_04_11.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libmsc/db.h>
#define TOKEN_SMS_TEXT "HAR 2009 GSM. Register at http://har2009.gnumonks.org/ " \ "Your IMSI is %s, auth token is %08X, phone no is %s." diff --git a/openbsc/src/libmsc/transaction.c b/openbsc/src/libmsc/transaction.c index 8a181b7..e480351 100644 --- a/openbsc/src/libmsc/transaction.c +++ b/openbsc/src/libmsc/transaction.c @@ -18,16 +18,16 @@ * */
-#include <openbsc/transaction.h> -#include <openbsc/gsm_data.h> -#include <openbsc/mncc.h> -#include <openbsc/debug.h> +#include <openbsc/libmsc/transaction.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/mncc.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/talloc.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/gsm_04_08.h> -#include <openbsc/mncc.h> -#include <openbsc/paging.h> -#include <openbsc/osmo_msc.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/mncc.h> +#include <openbsc/libbsc/paging.h> +#include <openbsc/libmsc/osmo_msc.h>
void *tall_trans_ctx;
diff --git a/openbsc/src/libmsc/ussd.c b/openbsc/src/libmsc/ussd.c index 72f26bd..c1ee86d 100644 --- a/openbsc/src/libmsc/ussd.c +++ b/openbsc/src/libmsc/ussd.c @@ -29,10 +29,10 @@ #include <string.h> #include <errno.h>
-#include <openbsc/gsm_04_80.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> -#include <openbsc/osmo_msc.h> +#include <openbsc/libmsc/gsm_04_80.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/osmo_msc.h>
/* Declarations of USSD strings to be recognised */ const char USSD_TEXT_OWN_NUMBER[] = "*#100#"; diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index cdda7e4..ebcf44e 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -29,22 +29,22 @@ #include <arpa/inet.h>
#include <osmocom/core/linuxlist.h> -#include <openbsc/gsm_data.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/silent_call.h> -#include <openbsc/gsm_04_11.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libmsc/silent_call.h> +#include <openbsc/libmsc/gsm_04_11.h> #include <osmocom/abis/e1_input.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/core/utils.h> -#include <openbsc/db.h> +#include <openbsc/libmsc/db.h> #include <osmocom/core/talloc.h> #include <openbsc/signal.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/vty.h> -#include <openbsc/gsm_04_80.h> -#include <openbsc/chan_alloc.h> -#include <openbsc/sms_queue.h> +#include <openbsc/libmsc/gsm_04_80.h> +#include <openbsc/libbsc/chan_alloc.h> +#include <openbsc/libmsc/sms_queue.h> #include <openbsc/mncc_int.h>
extern struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 2aa3a1e..11560d2 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -29,12 +29,12 @@ #include <sys/utsname.h> /* uname() */
#include <osmocom/core/talloc.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/core/msgb.h> #include <osmocom/core/select.h> -#include <openbsc/debug.h> -#include <openbsc/rtp_proxy.h> -#include <openbsc/mncc.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libtrau/rtp_proxy.h> +#include <openbsc/libmsc/mncc.h>
/* attempt to determine byte order */ #include <sys/param.h> diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c index 6a6b7c5..b8f4bba 100644 --- a/openbsc/src/libtrau/trau_mux.c +++ b/openbsc/src/libtrau/trau_mux.c @@ -22,12 +22,12 @@ #include <stdlib.h> #include <string.h>
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <osmocom/abis/trau_frame.h> -#include <openbsc/trau_mux.h> +#include <openbsc/libtrau/trau_mux.h> #include <osmocom/abis/subchan_demux.h> #include <osmocom/abis/e1_input.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/talloc.h>
/* this corresponds to teh bit-lengths of the individual codec diff --git a/openbsc/src/libtrau/trau_upqueue.c b/openbsc/src/libtrau/trau_upqueue.c index f8edaf0..d4acabf 100644 --- a/openbsc/src/libtrau/trau_upqueue.c +++ b/openbsc/src/libtrau/trau_upqueue.c @@ -18,8 +18,8 @@ * */
-#include <openbsc/mncc.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libmsc/mncc.h> +#include <openbsc/libcommon/gsm_data.h>
void trau_tx_to_mncc(struct gsm_network *net, struct msgb *msg) { diff --git a/openbsc/src/osmo-bsc/osmo_bsc_api.c b/openbsc/src/osmo-bsc/osmo_bsc_api.c index 2869f47..2cdf01c 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_api.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_api.c @@ -19,7 +19,7 @@
#include <openbsc/osmo_bsc.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h>
#include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm0808.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_audio.c b/openbsc/src/osmo-bsc/osmo_bsc_audio.c index ed0ece7..409a8d6 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_audio.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_audio.c @@ -22,9 +22,9 @@
#include <openbsc/osmo_msc_data.h> #include <openbsc/osmo_bsc.h> -#include <openbsc/abis_rsl.h> -#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> +#include <openbsc/libbsc/abis_rsl.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/signal.h>
#include <arpa/inet.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c index 495a313..7cf7ff8 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c @@ -19,12 +19,12 @@ */
#include <openbsc/osmo_bsc.h> -#include <openbsc/osmo_bsc_grace.h> +#include <openbsc/osmo-bsc/osmo_bsc_grace.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libmsc/gsm_subscriber.h> #include <openbsc/mgcp.h> -#include <openbsc/paging.h> +#include <openbsc/libbsc/paging.h>
#include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm0808.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c index d2735a6..17e5297 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c @@ -19,10 +19,10 @@
#include <openbsc/osmo_bsc.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/gsm_04_80.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> -#include <openbsc/paging.h> +#include <openbsc/libmsc/gsm_04_80.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/paging.h>
#include <stdlib.h>
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_grace.c b/openbsc/src/osmo-bsc/osmo_bsc_grace.c index fbc26ac..c611ef0 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_grace.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_grace.c @@ -18,10 +18,10 @@ * */
-#include <openbsc/osmo_bsc_grace.h> -#include <openbsc/osmo_bsc_rf.h> +#include <openbsc/osmo-bsc/osmo_bsc_grace.h> +#include <openbsc/osmo-bsc/osmo_bsc_rf.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/gsm_04_80.h> +#include <openbsc/libmsc/gsm_04_80.h> #include <openbsc/signal.h>
int bsc_grace_allow_new_connection(struct gsm_network *network) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index 9a799c0..4a13339 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -18,11 +18,11 @@ * */
-#include <openbsc/control_cmd.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libctrl/control_cmd.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/osmo_bsc.h> -#include <openbsc/osmo_bsc_rf.h> +#include <openbsc/osmo-bsc/osmo_bsc_rf.h> #include <openbsc/osmo_msc_data.h> #include <openbsc/signal.h> #include <openbsc/vty.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index 04cfb99..39d2298 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -20,10 +20,10 @@ * */
-#include <openbsc/bsc_nat.h> -#include <openbsc/control_cmd.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> +#include <openbsc/libctrl/control_cmd.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/ipaccess.h> #include <openbsc/osmo_msc_data.h> #include <openbsc/signal.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_rf.c b/openbsc/src/osmo-bsc/osmo_bsc_rf.c index 64cab5d..2b093f9 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_rf.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_rf.c @@ -20,9 +20,9 @@ * */
-#include <openbsc/osmo_bsc_rf.h> -#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/osmo-bsc/osmo_bsc_rf.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/signal.h> #include <openbsc/osmo_msc_data.h> #include <openbsc/ipaccess.h> diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c index 4f03b52..cba37eb 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_sccp.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_sccp.c @@ -19,11 +19,11 @@ * */
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/osmo_bsc.h> -#include <openbsc/osmo_bsc_grace.h> +#include <openbsc/osmo-bsc/osmo_bsc_grace.h> #include <openbsc/osmo_msc_data.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/ipaccess.h> #include <openbsc/signal.h>
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c index 0b1698e..46d5731 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c @@ -18,7 +18,7 @@ * */
-#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/osmo_msc_data.h> #include <openbsc/vty.h>
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c index ee1543c..4a2767f 100644 --- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c +++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c @@ -31,8 +31,8 @@
#include <sys/socket.h>
-#include <openbsc/debug.h> -#include <openbsc/gsm_data.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libcommon/gsm_data.h> #include <openbsc/mgcp.h> #include <openbsc/mgcp_internal.h> #include <openbsc/vty.h> diff --git a/openbsc/src/osmo-bsc_nat/bsc_filter.c b/openbsc/src/osmo-bsc_nat/bsc_filter.c index bbbba69..e6dc4ee 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_filter.c +++ b/openbsc/src/osmo-bsc_nat/bsc_filter.c @@ -20,10 +20,10 @@ * */
-#include <openbsc/bsc_nat.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> #include <openbsc/ipaccess.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h>
#include <osmocom/core/talloc.h> #include <osmocom/gsm/protocol/gsm_08_08.h> diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c index 9ac54da..56cc052 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c @@ -18,10 +18,10 @@ * */
-#include <openbsc/bsc_nat.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> -#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/ipaccess.h> #include <openbsc/mgcp.h> #include <openbsc/mgcp_internal.h> diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 295535a..aedeb09 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -35,14 +35,14 @@ #define _GNU_SOURCE #include <getopt.h>
-#include <openbsc/debug.h> -#include <openbsc/bsc_msc.h> -#include <openbsc/bsc_nat.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/libbsc/bsc_msc.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> -#include <openbsc/control_cmd.h> +#include <openbsc/libctrl/control_cmd.h> #include <openbsc/ipaccess.h> -#include <openbsc/abis_nm.h> -#include <openbsc/socket.h> +#include <openbsc/libbsc/abis_nm.h> +#include <openbsc/libcommon/socket.h> #include <openbsc/vty.h>
#include <osmocom/core/application.h> diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c index 0eb8be9..9fea23a 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c @@ -21,11 +21,11 @@ * */
-#include <openbsc/bsc_nat.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> -#include <openbsc/bsc_msc.h> -#include <openbsc/gsm_data.h> -#include <openbsc/debug.h> +#include <openbsc/libbsc/bsc_msc.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libcommon/debug.h> #include <openbsc/ipaccess.h> #include <openbsc/vty.h>
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c index 55b3958..2c72b43 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c @@ -19,11 +19,11 @@ */
#include <openbsc/vty.h> -#include <openbsc/gsm_data.h> -#include <openbsc/bsc_nat.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> -#include <openbsc/bsc_msc.h> -#include <openbsc/gsm_04_08.h> +#include <openbsc/libbsc/bsc_msc.h> +#include <openbsc/libmsc/gsm_04_08.h> #include <openbsc/mgcp.h> #include <openbsc/vty.h>
diff --git a/openbsc/src/osmo-bsc_nat/bsc_sccp.c b/openbsc/src/osmo-bsc_nat/bsc_sccp.c index de6b421..2eaebba 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_sccp.c +++ b/openbsc/src/osmo-bsc_nat/bsc_sccp.c @@ -19,8 +19,8 @@ * */
-#include <openbsc/debug.h> -#include <openbsc/bsc_nat.h> +#include <openbsc/libcommon/debug.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h>
#include <osmocom/sccp/sccp.h> diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c index 80d6e77..2a962dc 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c +++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c @@ -20,10 +20,10 @@ * */
-#include <openbsc/bsc_nat.h> +#include <openbsc/osmo-bsc_nat/bsc_nat.h> #include <openbsc/bsc_nat_sccp.h> #include <openbsc/ipaccess.h> -#include <openbsc/socket.h> +#include <openbsc/libcommon/socket.h>
#include <osmocom/gsm/protocol/gsm_08_08.h> #include <osmocom/gsm/gsm0480.h> diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index b41b808..1150c58 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -29,19 +29,19 @@ #define _GNU_SOURCE #include <getopt.h>
-#include <openbsc/db.h> +#include <openbsc/libmsc/db.h> #include <osmocom/core/application.h> #include <osmocom/core/select.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/abis/abis.h> #include <osmocom/abis/e1_input.h> #include <osmocom/core/talloc.h> #include <openbsc/signal.h> -#include <openbsc/osmo_msc.h> -#include <openbsc/sms_queue.h> +#include <openbsc/libmsc/osmo_msc.h> +#include <openbsc/libmsc/sms_queue.h> #include <openbsc/vty.h> #include <openbsc/bss.h> -#include <openbsc/mncc.h> +#include <openbsc/libmsc/mncc.h>
#include "../../bscconfig.h"
diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c index e8acb46..2d3d842 100644 --- a/openbsc/src/utils/bs11_config.c +++ b/openbsc/src/utils/bs11_config.c @@ -32,12 +32,12 @@
#include <sys/stat.h>
-#include <openbsc/gsm_data.h> -#include <openbsc/abis_nm.h> +#include <openbsc/libcommon/gsm_data.h> +#include <openbsc/libbsc/abis_nm.h> #include <osmocom/core/msgb.h> #include <osmocom/core/utils.h> #include <osmocom/gsm/tlv.h> -#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h> #include <osmocom/core/select.h> #include <openbsc/rs232.h> #include <osmocom/core/application.h> diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 1121dd5..872f200 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -23,8 +23,8 @@ #include <assert.h>
#include <osmocom/core/select.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/abis_rsl.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libbsc/abis_rsl.h>
/* our handler */ static int subscr_cb(unsigned int hook, unsigned int event, struct msgb *msg, void *data, void *param) diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c index 236dc37..ad20d3f 100644 --- a/openbsc/tests/db/db_test.c +++ b/openbsc/tests/db/db_test.c @@ -17,8 +17,8 @@ * */
-#include <openbsc/db.h> -#include <openbsc/gsm_subscriber.h> +#include <openbsc/libmsc/db.h> +#include <openbsc/libmsc/gsm_subscriber.h>
#include <stdio.h> #include <string.h> diff --git a/openbsc/tests/debug/debug_test.c b/openbsc/tests/debug/debug_test.c index fb5ce7a..332bf35 100644 --- a/openbsc/tests/debug/debug_test.c +++ b/openbsc/tests/debug/debug_test.c @@ -18,7 +18,7 @@ * */
-#include <openbsc/debug.h> +#include <openbsc/libcommon/debug.h>
int main(int argc, char **argv) diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 679ce66..87522f1 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -24,9 +24,9 @@
#include <arpa/inet.h>
-#include <openbsc/gsm_04_08.h> -#include <openbsc/gsm_subscriber.h> -#include <openbsc/debug.h> +#include <openbsc/libmsc/gsm_04_08.h> +#include <openbsc/libmsc/gsm_subscriber.h> +#include <openbsc/libcommon/debug.h>
#define COMPARE(result, op, value) \ if (!((result) op (value))) {\
--- openbsc/include/openbsc/libbsc/handover_decision.h | 7 +++++++ openbsc/include/openbsc/libctrl/control_if.h | 13 +++++++++++++ openbsc/include/openbsc/libmsc/rrlp.h | 7 +++++++ openbsc/include/openbsc/libmsc/token_auth.h | 7 +++++++ openbsc/src/osmo-nitb/bsc_hack.c | 4 ++++ 5 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 openbsc/include/openbsc/libbsc/handover_decision.h create mode 100644 openbsc/include/openbsc/libctrl/control_if.h create mode 100644 openbsc/include/openbsc/libmsc/rrlp.h create mode 100644 openbsc/include/openbsc/libmsc/token_auth.h
diff --git a/openbsc/include/openbsc/libbsc/handover_decision.h b/openbsc/include/openbsc/libbsc/handover_decision.h new file mode 100644 index 0000000..81078b0 --- /dev/null +++ b/openbsc/include/openbsc/libbsc/handover_decision.h @@ -0,0 +1,7 @@ +#ifndef _HANDOVER_DECISION_H +#define _HANDOVER_DECISION_H + +void on_dso_load_ho_dec(void); + +#endif /* _HANDOVER_DECISION_H */ + diff --git a/openbsc/include/openbsc/libctrl/control_if.h b/openbsc/include/openbsc/libctrl/control_if.h new file mode 100644 index 0000000..59c175b --- /dev/null +++ b/openbsc/include/openbsc/libctrl/control_if.h @@ -0,0 +1,13 @@ +#ifndef _CONTROL_IF_H +#define _CONTROL_IF_H + +#include <osmocom/core/write_queue.h> +#include <openbsc/libctrl/control_cmd.h> +#include <openbsc/libcommon/gsm_data.h> + +int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); +int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data); +int controlif_setup(struct gsm_network *gsmnet, uint16_t port); + +#endif /* _CONTROL_IF_H */ + diff --git a/openbsc/include/openbsc/libmsc/rrlp.h b/openbsc/include/openbsc/libmsc/rrlp.h new file mode 100644 index 0000000..c89402a --- /dev/null +++ b/openbsc/include/openbsc/libmsc/rrlp.h @@ -0,0 +1,7 @@ +#ifndef _RRLP_H +#define _RRLP_H + +void on_dso_load_rrlp(void); + +#endif /* _RRLP_H */ + diff --git a/openbsc/include/openbsc/libmsc/token_auth.h b/openbsc/include/openbsc/libmsc/token_auth.h new file mode 100644 index 0000000..47dc7aa --- /dev/null +++ b/openbsc/include/openbsc/libmsc/token_auth.h @@ -0,0 +1,7 @@ +#ifndef _TOKEN_AUTH_H +#define _TOKEN_AUTH_H + +void on_dso_load_token(void); + +#endif /* _TOKEN_AUTH_H */ + diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 1150c58..dbd01d2 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -42,6 +42,10 @@ #include <openbsc/vty.h> #include <openbsc/bss.h> #include <openbsc/libmsc/mncc.h> +#include <openbsc/libmsc/token_auth.h> +#include <openbsc/libbsc/handover_decision.h> +#include <openbsc/libmsc/rrlp.h> +#include <openbsc/libctrl/control_if.h>
#include "../../bscconfig.h"
--- openbsc/include/openbsc/libtrau/trau_upqueue.h | 6 ++++++ openbsc/src/libtrau/rtp_proxy.c | 1 + openbsc/src/libtrau/trau_mux.c | 1 + 3 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 openbsc/include/openbsc/libtrau/trau_upqueue.h
diff --git a/openbsc/include/openbsc/libtrau/trau_upqueue.h b/openbsc/include/openbsc/libtrau/trau_upqueue.h new file mode 100644 index 0000000..686d796 --- /dev/null +++ b/openbsc/include/openbsc/libtrau/trau_upqueue.h @@ -0,0 +1,6 @@ +#ifndef _TRAU_UPQUEUE_H +#define _TRAU_UPQUEUE_H + +void trau_tx_to_mncc(struct gsm_network *net, struct msgb *msg); + +#endif /* _TRAU_UPQUEUE_H */ diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 11560d2..4e7fe05 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -35,6 +35,7 @@ #include <openbsc/libcommon/debug.h> #include <openbsc/libtrau/rtp_proxy.h> #include <openbsc/libmsc/mncc.h> +#include <openbsc/libtrau/trau_upqueue.h>
/* attempt to determine byte order */ #include <sys/param.h> diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c index b8f4bba..5567b34 100644 --- a/openbsc/src/libtrau/trau_mux.c +++ b/openbsc/src/libtrau/trau_mux.c @@ -29,6 +29,7 @@ #include <osmocom/abis/e1_input.h> #include <openbsc/libcommon/debug.h> #include <osmocom/core/talloc.h> +#include <openbsc/libtrau/trau_upqueue.h>
/* this corresponds to teh bit-lengths of the individual codec * parameters as indicated in Table 1.1 of TS 06.10 */
--- openbsc/include/openbsc/libbsc/e1_config.h | 11 +++++++++++ openbsc/src/libbsc/bsc_init.c | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-) create mode 100644 openbsc/include/openbsc/libbsc/e1_config.h
diff --git a/openbsc/include/openbsc/libbsc/e1_config.h b/openbsc/include/openbsc/libbsc/e1_config.h new file mode 100644 index 0000000..6cf455c --- /dev/null +++ b/openbsc/include/openbsc/libbsc/e1_config.h @@ -0,0 +1,11 @@ +#ifndef _E1_CONFIG_H +#define _E1_CONFIG_H + +#include <openbsc/libcommon/gsm_data_shared.h> + +int e1_reconfig_ts(struct gsm_bts_trx_ts *ts); +int e1_reconfig_trx(struct gsm_bts_trx *trx); +int e1_reconfig_bts(struct gsm_bts *bts); + +#endif /* _E1_CONFIG_H */ + diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index ae4318b..77fa53f 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -33,6 +33,8 @@ #include <openbsc/libbsc/chan_alloc.h> #include <osmocom/core/talloc.h> #include <openbsc/ipaccess.h> +#include <osmocom/gsm/sysinfo.h> +#include <openbsc/libbsc/e1_config.h>
/* global pointer to the gsm network data structure */ extern struct gsm_network *bsc_gsmnet;
--- openbsc/src/osmo-bsc_mgcp/mgcp_main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c index 4a2767f..2a2ebc7 100644 --- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c +++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c @@ -156,8 +156,8 @@ static int read_call_agent(struct osmo_fd *fd, unsigned int what) perror("Gateway failed to read"); return -1; } else if (slen > sizeof(addr)) { - fprintf(stderr, "Gateway received message from outerspace: %lu %d\n", - slen, sizeof(addr)); + fprintf(stderr, "Gateway received message from outerspace: %lu %lu\n", + (unsigned long int)slen, sizeof(addr)); return -1; }