From gus at bourg.net Thu Sep 1 18:17:07 2011 From: gus at bourg.net (Gus Bourg) Date: Thu, 1 Sep 2011 11:17:07 -0700 Subject: In-Call Handover not working? Message-ID: Hello List, I've noticed that In-Call Handover doesn't work on my Nokia InSites. OpenBSC attempts the handover but as far as I can tell the device never moves to the new channel.? E.g. <000d> handover_decision.c:203 (bts=2,trx=0,ts=1): Cell on ARFCN XXX is better: <000d> handover_logic.c:97 (old_lchan on BTS 2, new BTS 1) Starting handover <0004> abis_rsl.c:1059 (bts=1,trx=0,ts=1,ss=0) CHANNEL ACTIVATE ACK <000d> handover_logic.c:206 handover activate ack, send HO Command <0004> abis_rsl.c:1032 (bts=1,trx=0,ts=1,ss=0) HANDOVER DETECT access delay = 0 <0000> abis_rsl.c:1481 (bts=1,trx=0,ts=1,ss=0) SAPI=0 ESTABLISH INDICATION <0000> abis_rsl.c:1481 (bts=1,trx=0,ts=1,ss=0) SAPI=0 DATA INDICATION <0003> gsm_04_08.c:1196 HANDOVER COMPLETE cause = Normal event <000d> handover_logic.c:263 Subscriber AAABBBC00000ZZZZ HO from BTS 2->1 on ARFCN YYY->XXX <0000> chan_alloc.c:421 (bts=2,trx=0,ts=1,ss=0) starting release sequence Here it seems to get measurement results, because the device is still on BTS2 (never moved?) <0004> abis_rsl.c:967 (bts=2,trx=0,ts=1,ss=0): MEAS RES for inactive channel <0004> abis_rsl.c:967 (bts=2,trx=0,ts=1,ss=0): MEAS RES for inactive channel <0004> abis_rsl.c:967 (bts=2,trx=0,ts=1,ss=0): MEAS RES for inactive channel After sometime things start to go crazy and the log fills up with messages like: illegal trau (C1-C5) 00 00 01 01 00 Thanks, Gus From laforge at gnumonks.org Thu Sep 1 23:53:27 2011 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 2 Sep 2011 01:53:27 +0200 Subject: In-Call Handover not working? In-Reply-To: References: Message-ID: <20110901235327.GP13522@prithivi.gnumonks.org> On Thu, Sep 01, 2011 at 11:17:07AM -0700, Gus Bourg wrote: > Hello List, > > I've noticed that In-Call Handover doesn't work on my Nokia InSites. > OpenBSC attempts the handover but as far as I can tell the device > never moves to the new channel.? E.g. yes, there seem to be some problems, at least with nokia BTSs. We've seen them on the camp, too. Guess it needs to be re-tested with nanoBTS + BS-11 to see if it's a nokia specific or a generic problem. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From carcellelist at free.fr Sun Sep 4 11:46:06 2011 From: carcellelist at free.fr (carcellelist) Date: Sun, 4 Sep 2011 13:46:06 +0200 Subject: question about "auth token" policy and adaptation of hlrsync.py Message-ID: <20110904114606.GB20041@massoud> Dear openbsc folks, I am trying to use "auth token" policy for registration of new imsi subscribing with : src/libmsc/token_auth.c and hrlsync.py (used at har2009) Missing the "web token" db schema and the web-cgi used at har2009 to fully understand the "auth token", i am trying to do it from the hlr db by updating the "authorized" field to 1 but MS can receive calls but not calling. Does anyone remember the web-db/cgi from har2009 or could head to a hack from hlrsync.py to do it manually ? Many thanks. Cheers. Xavier. From alexander.huemer at xx.vu Sun Sep 4 22:30:15 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:30:15 +0200 Subject: [PATCH 0/2] some minor updates and fixes for libosmocore (master) Message-ID: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> These patches for libosmocore do a trivial update of .gitignore and correct a function declaration that caused an implicit declaration in openbsc. If the patches seem useful, please merge them to master. From alexander.huemer at xx.vu Sun Sep 4 22:30:16 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:30:16 +0200 Subject: [PATCH 1/2] correct declaration of osmo_sitype2rsl In-Reply-To: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> References: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175417-18871-2-git-send-email-alexander.huemer@xx.vu> --- include/osmocom/gsm/sysinfo.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/osmocom/gsm/sysinfo.h b/include/osmocom/gsm/sysinfo.h index b808d6f..06feb1d 100644 --- a/include/osmocom/gsm/sysinfo.h +++ b/include/osmocom/gsm/sysinfo.h @@ -37,7 +37,7 @@ typedef uint8_t sysinfo_buf_t[GSM_MACBLOCK_LEN]; extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE]; -uint8_t gsm_sitype2rsl(enum osmo_sysinfo_type si_type); +uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type); enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si); #endif /* _OSMO_GSM_SYSINFO_H */ -- 1.7.6.1 From alexander.huemer at xx.vu Sun Sep 4 22:30:17 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:30:17 +0200 Subject: [PATCH 2/2] update .gitignore In-Reply-To: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> References: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175417-18871-3-git-send-email-alexander.huemer@xx.vu> --- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index b4d657f..d3315c9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ tests/timer/timer_test tests/msgfile/msgfile_test tests/ussd/ussd_test tests/smscb/smscb_test +tests/bits/bitrev_test utils/osmo-arfcn -- 1.7.6.1 From 246tnt at gmail.com Mon Sep 5 07:53:06 2011 From: 246tnt at gmail.com (Sylvain Munaut) Date: Mon, 5 Sep 2011 09:53:06 +0200 Subject: [PATCH 0/2] some minor updates and fixes for libosmocore (master) In-Reply-To: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> References: <1315175417-18871-1-git-send-email-alexander.huemer@xx.vu> Message-ID: I applied your patches on libosmocore. As I said on IRC, I'd wait for Harald or Holger's view on the include dir "lib" prefix ( /include/openbsc/libmsc vs include/openbsc/msc ) for openbsc. Cheers, Sylvain From alexander.huemer at xx.vu Sun Sep 4 22:32:32 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:32 +0200 Subject: [PATCH 0/6] some minor updates and fixes for openbsc (master) Message-ID: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> 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. From alexander.huemer at xx.vu Sun Sep 4 22:32:33 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:33 +0200 Subject: =?UTF-8?q?=5BPATCH=201/6=5D=20move=20header=20files=20in=20according=20directories?= In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> --- 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 - * 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 . - * - */ - -#ifndef _NM_H -#define _NM_H - -#include -#include -#include - -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 - * - * 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 . - * - */ - -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 - * 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 . - * - */ - -#ifndef _RSL_H -#define _RSL_H - -#include - -#include - -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 - * (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 . - * - */ - -#ifndef BSC_MSC_H -#define BSC_MSC_H - -#include -#include - -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 - * (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 . - * - */ - -#ifndef BSC_NAT_H -#define BSC_NAT_H - -#include "mgcp.h" - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#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 - -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 - * (C) 2009 by Holger Hans Peter Freyther - * 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 . - * - */ -#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 -#include - -#include - -#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 - -#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 - * (C) 2009 by Holger Hans Peter Freyther - * 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 . - * - */ - -#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 -#include - -#define DEBUG -#include - -/* 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 - -#include -#include - -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 + +#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 + +#include +#include + +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 +#include + +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 +#include + +/* 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 +#include + +#include + +#include + +#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 - -/* 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 - -/* 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 -#include - -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 -#include - -/* 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 - -/* 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 -#include -#include -#include -#include - -#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 -#include - -#include - -#include - -#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 -#include -#include - -#include - -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 - -#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 -#include -#include - -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 - -#include -#include - -#include -#include - -#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 -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -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 - -#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 +#include + +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 + * 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 . + * + */ + +#ifndef _NM_H +#define _NM_H + +#include +#include +#include + +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 + * + * 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 . + * + */ + +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 + * 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 . + * + */ + +#ifndef _RSL_H +#define _RSL_H + +#include + +#include + +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 + * (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 . + * + */ + +#ifndef BSC_MSC_H +#define BSC_MSC_H + +#include +#include + +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 + +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 + * (C) 2009 by Holger Hans Peter Freyther + * 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 . + * + */ +#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 + +#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 + * 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 . + * + */ + +#ifndef PAGING_H +#define PAGING_H + +#include +#include + +#include +#include "gsm_data.h" +#include "gsm_subscriber.h" +#include + +/** + * 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 + +/* 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 + +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 +#include + +#define DEBUG +#include + +/* 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 + +#include +#include + +#include +#include + +#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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +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 + +#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 +#include + +#include + +#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 + +/* 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 + +/* 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 + +/* 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 +#include +#include +#include +#include + +#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 + * (C) 2009 by Holger Hans Peter Freyther + * 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 . + * + */ + +#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 +#include +#include + +#include + +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 + +#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 +#include +#include + +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 + +#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 + * (C) 2008, 2009 by Holger Hans Peter Freyther + * + * 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 . + * + */ + +#ifndef _MNCC_H +#define _MNCC_H + +#include +#include + +#include + +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 +#include +#include +#include +#include + +/* 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 + +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 + * 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 . + * + */ + + +#include + +#include +#include + +#include + +#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 + * 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 . + * + */ + +/* 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 +#include +#include + +/* 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 - -#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 - * (C) 2008, 2009 by Holger Hans Peter Freyther - * - * 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 . - * - */ - -#ifndef _MNCC_H -#define _MNCC_H - -#include -#include - -#include - -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 -#include - -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 + * (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 . + * + */ + +#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 +#include + +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 + * (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 . + * + */ + +#ifndef BSC_NAT_H +#define BSC_NAT_H + +#include "mgcp.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#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 - * (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 . - * - */ - -#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 -#include - -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 - * 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 . - * - */ - -#ifndef PAGING_H -#define PAGING_H - -#include -#include - -#include -#include "gsm_data.h" -#include "gsm_subscriber.h" -#include - -/** - * 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 - -/* 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 - * 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 . - * - */ - - -#include - -#include -#include - -#include - -#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 - -#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 - -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 -#include -#include -#include -#include - -/* 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 - * 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 . - * - */ - -/* 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 -#include -#include - -/* 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 - -int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg); - -#endif -- 1.7.6.1 From 246tnt at gmail.com Mon Sep 5 07:48:15 2011 From: 246tnt at gmail.com (Sylvain Munaut) Date: Mon, 5 Sep 2011 09:48:15 +0200 Subject: [PATCH 1/6] move header files in according directories In-Reply-To: <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> Message-ID: 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 From laforge at gnumonks.org Mon Sep 5 09:00:13 2011 From: laforge at gnumonks.org (Harald Welte) Date: Mon, 5 Sep 2011 11:00:13 +0200 Subject: [PATCH 1/6] move header files in according directories In-Reply-To: References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> Message-ID: <20110905090013.GK11927@prithivi.gnumonks.org> 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. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From 246tnt at gmail.com Mon Sep 5 09:08:21 2011 From: 246tnt at gmail.com (Sylvain Munaut) Date: Mon, 5 Sep 2011 11:08:21 +0200 Subject: [PATCH 1/6] move header files in according directories In-Reply-To: <20110905090013.GK11927@prithivi.gnumonks.org> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> <20110905090013.GK11927@prithivi.gnumonks.org> Message-ID: 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 From alexander.huemer at xx.vu Mon Sep 5 22:21:56 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:21:56 +0200 Subject: [PATCH 1/6] move header files in according directories In-Reply-To: <20110905090013.GK11927@prithivi.gnumonks.org> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> <20110905090013.GK11927@prithivi.gnumonks.org> Message-ID: <20110905222156.GC11992@de.xx.vu> 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 [1] http://invisible-island.net/cproto/ From laforge at gnumonks.org Thu Sep 8 07:17:23 2011 From: laforge at gnumonks.org (Harald Welte) Date: Thu, 8 Sep 2011 09:17:23 +0200 Subject: [PATCH 1/6] move header files in according directories In-Reply-To: <20110905222156.GC11992@de.xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> <1315175558-18700-2-git-send-email-alexander.huemer@xx.vu> <20110905090013.GK11927@prithivi.gnumonks.org> <20110905222156.GC11992@de.xx.vu> Message-ID: <20110908071723.GD30888@prithivi.gnumonks.org> 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 -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.huemer at xx.vu Sun Sep 4 22:32:34 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:34 +0200 Subject: [PATCH 2/6] substitute #include statements to match former commit In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-3-git-send-email-alexander.huemer@xx.vu> --- 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 -#include +#include #include 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 -#include +#include 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 -#include +#include /* 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 -#include "gsm_subscriber.h" +#include #include #include 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 -#include +#include 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 #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 +#include 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 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 #include -#include "gsm_data.h" -#include "gsm_subscriber.h" +#include +#include #include /** 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 +#include /* 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 #include -#include +#include #include #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 /* 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 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 #include -#include +#include 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 #include #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 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 -#include +#include +#include #include -#include -#include +#include +#include /* 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 #include -#include +#include #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 -#include -#include +#include +#include /* 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 #include -#include "debug.h" +#include #include 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 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 #include #include 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 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 #include 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 #include -#include +#include #include 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 +#include /* 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 #include -#include -#include -#include -#include +#include +#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include 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 -#include -#include -#include +#include +#include +#include #include #include 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 #include -#include +#include #include #include #include @@ -38,17 +38,17 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include 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 #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include /* 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 -#include +#include #include #include #include #include #include -#include +#include #include -#include +#include #include #include 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 #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include +#include 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include #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 -#include +#include #include #include #include #include #include -#include +#include #include -#include +#include #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 #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include 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 #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include #include 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 #include -#include +#include #include -#include -#include +#include +#include #include #include 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 #include #include -#include +#include #include -#include +#include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include #include 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 #include #include -#include +#include 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 +#include #include #include 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 -#include +#include #include #include #include #include -#include +#include #include -#include +#include #include /* 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 #include -#include -#include +#include +#include #include -#include +#include #include #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 #include -#include -#include +#include +#include #include #include #include #include -#include +#include #include #include #include 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 -#include +#include #include #include #include -#include +#include #include -#include +#include #include #include 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include 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 -#include +#include #include #include #include -#include +#include #include -#include +#include #include #include 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 #include -#include -#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include #include -#include -#include +#include +#include #include #include #include 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 -#include -#include -#include +#include +#include +#include +#include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include 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 +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include #include -#include +#include #include #include 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 -#include +#include +#include #include #include 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 -#include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include 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 #include -#include +#include #include -#include -#include +#include +#include #include #include #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include #include -#include +#include #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 -#include -#include -#include -#include +#include +#include +#include +#include #include #include 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 #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include #include 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 -#include +#include #include -#include +#include #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include 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 -#include -#include -#include +#include +#include +#include #include #include 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 -#include -#include -#include +#include +#include +#include #include #include 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 +#include #include -#include +#include 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 #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include 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 -#include +#include #include #include -#include +#include #include #include #include -#include -#include +#include +#include #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 #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include /* 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 #include -#include -#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include #include #include #include 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 #include -#include -#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include -#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include #include /* 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 -#include +#include +#include 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 #include -#include -#include +#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include 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 #include -#include +#include #include -#include +#include /* 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 #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include /* 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include 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 #include #include -#include -#include -#include +#include +#include +#include /* 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 #include -#include +#include #include -#include +#include 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 #include -#include +#include 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 #include #include -#include -#include +#include +#include #include 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 -#include +#include 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 #include -#include -#include +#include +#include #include #include 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 #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include -#include -#include +#include +#include #include #include 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 #include -#include -#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include 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 #include -#include -#include -#include -#include +#include +#include +#include +#include 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 -#include +#include #include #include #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include 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 -#include +#include #include #include #include #include #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include #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 -#include +#include #include #include #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include 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 -#include -#include -#include +#include +#include +#include +#include #include 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 #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include 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 #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include 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 #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include -#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #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 #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include 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 -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include 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 #include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include 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 #include -#include -#include -#include +#include +#include +#include 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 -#include -#include +#include +#include +#include -#include +#include 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 +#include #include -#include -#include +#include +#include /* 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 #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include /* 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 -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include 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 #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #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 -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include 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 #include -#include -#include -#include -#include +#include +#include +#include +#include /* 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include +#include #include #include -#include +#include #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include 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 /* uname() */ #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include /* attempt to determine byte order */ #include 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 #include -#include +#include #include -#include +#include #include #include -#include +#include #include /* 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 -#include +#include +#include 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 #include -#include +#include #include #include 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 #include -#include -#include -#include +#include +#include +#include #include #include 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 -#include +#include #include -#include -#include +#include +#include #include -#include +#include #include #include 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include 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 -#include +#include +#include #include -#include +#include #include 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 -#include -#include +#include +#include +#include #include -#include +#include #include #include #include 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 -#include -#include -#include +#include +#include +#include +#include #include #include #include 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 -#include -#include +#include +#include +#include #include #include #include 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 +#include #include -#include +#include #include -#include +#include #include #include 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 +#include #include #include 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 -#include -#include +#include +#include #include #include #include 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 +#include #include #include -#include +#include #include #include 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 +#include #include -#include -#include +#include +#include #include #include #include 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 -#include -#include -#include +#include +#include +#include #include -#include +#include #include -#include -#include +#include +#include #include #include 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 +#include #include -#include -#include -#include +#include +#include +#include #include #include 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 -#include -#include +#include +#include #include -#include -#include +#include +#include #include #include 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 -#include +#include +#include #include #include 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 +#include #include #include -#include +#include #include #include 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 -#include +#include #include #include -#include +#include #include #include #include #include -#include -#include +#include +#include #include #include -#include +#include #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 -#include -#include +#include +#include #include #include #include -#include +#include #include #include #include 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 #include -#include -#include +#include +#include /* 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 -#include +#include +#include #include #include 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 +#include 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 -#include -#include -#include +#include +#include +#include #define COMPARE(result, op, value) \ if (!((result) op (value))) {\ -- 1.7.6.1 From alexander.huemer at xx.vu Sun Sep 4 22:32:35 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:35 +0200 Subject: [PATCH 3/6] fix some "implicit declaration" warnings in osmo-nitb In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-4-git-send-email-alexander.huemer@xx.vu> --- 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 +#include +#include + +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 #include #include +#include +#include +#include +#include #include "../../bscconfig.h" -- 1.7.6.1 From alexander.huemer at xx.vu Sun Sep 4 22:32:36 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:36 +0200 Subject: [PATCH 4/6] fix some "implicit declaration" warnings in libtrau In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-5-git-send-email-alexander.huemer@xx.vu> --- 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 #include #include +#include /* attempt to determine byte order */ #include 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 #include #include +#include /* this corresponds to teh bit-lengths of the individual codec * parameters as indicated in Table 1.1 of TS 06.10 */ -- 1.7.6.1 From alexander.huemer at xx.vu Sun Sep 4 22:32:37 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:37 +0200 Subject: [PATCH 5/6] fix some "implicit declaration" warnings in libbsc In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-6-git-send-email-alexander.huemer@xx.vu> --- 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 + +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 #include #include +#include +#include /* global pointer to the gsm network data structure */ extern struct gsm_network *bsc_gsmnet; -- 1.7.6.1 From alexander.huemer at xx.vu Sun Sep 4 22:32:38 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Mon, 5 Sep 2011 00:32:38 +0200 Subject: [PATCH 6/6] fix fprintf format specifiers in osmo-bsc_mgcp In-Reply-To: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> References: <1315175558-18700-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315175558-18700-7-git-send-email-alexander.huemer@xx.vu> --- 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; } -- 1.7.6.1 From jwjohn0 at gmail.com Mon Sep 5 06:23:26 2011 From: jwjohn0 at gmail.com (John Wu) Date: Mon, 5 Sep 2011 14:23:26 +0800 Subject: anyone give me a hint to implement L1 for openbsc Message-ID: Hi list, I want to implement a L1 hardware and software for openbsc. But I am not familiar with openbsc framework. I saw there is a project named osmo-nitb which is a standalone application that implement L2 L3 and some other gsm network function. If I can using my L1 software connect to osmo-nitb through abis-overip? Also I notice another project osmo-bts project which implement BTS-side Layer3 and Layer2 protocol. So can I just implement BTS side L1 then combine with osmo-bts which connect to osmo-nitb? Regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: From laforge at gnumonks.org Mon Sep 5 09:04:26 2011 From: laforge at gnumonks.org (Harald Welte) Date: Mon, 5 Sep 2011 11:04:26 +0200 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: References: Message-ID: <20110905090426.GL11927@prithivi.gnumonks.org> Hi John, yes, the 'osmocom' way to integrate your L1 hardware would be ot use osmo-bts as basis. It already supports one existing L1 (for the upcoming sysmocom BTS), and Andreas has been working on supporting some hacked-up OsmocomBB phones as alternative L1 for it. osmo-bts then connects via Abis/IP to openbsc (osmo-bsc or osmo-nitb). In any case we would love to hear more about your L1 hardware. Can you tell us more about it? Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From jwjohn0 at gmail.com Mon Sep 5 09:20:17 2011 From: jwjohn0 at gmail.com (John Wu) Date: Mon, 5 Sep 2011 17:20:17 +0800 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: <20110905090426.GL11927@prithivi.gnumonks.org> References: <20110905090426.GL11927@prithivi.gnumonks.org> Message-ID: We are just planning on this project which use usb based sdr board and will be open design and source. sounds like sysmocom already working on this. Regards! On Mon, Sep 5, 2011 at 5:04 PM, Harald Welte wrote: > Hi John, > > yes, the 'osmocom' way to integrate your L1 hardware would be ot use > osmo-bts as basis. It already supports one existing L1 (for the > upcoming sysmocom BTS), and Andreas has been working on supporting some > hacked-up OsmocomBB phones as alternative L1 for it. > > osmo-bts then connects via Abis/IP to openbsc (osmo-bsc or osmo-nitb). > > In any case we would love to hear more about your L1 hardware. Can you > tell us more about it? > > Regards, > Harald > > -- > - Harald Welte > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. A6) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From laforge at gnumonks.org Mon Sep 5 11:19:09 2011 From: laforge at gnumonks.org (Harald Welte) Date: Mon, 5 Sep 2011 13:19:09 +0200 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: References: <20110905090426.GL11927@prithivi.gnumonks.org> Message-ID: <20110905111909.GA28810@prithivi.gnumonks.org> Hi John, On Mon, Sep 05, 2011 at 05:20:17PM +0800, John Wu wrote: > We are just planning on this project which use usb based sdr board and > will be open design and source. In that case, what do you plan to use as layer1? A simple SDR board only implements "Layer 0", but what about layer1? osmo-bts and openbsc implement layers >= 2. So what is your plan for L1 ? > sounds like sysmocom already working on this. sysmocom is not building a USB based SDR, but a complete embedded BTS product (picocell). That's quite something different. And while osmo-bts and openbsc are free software available in source code, the sysmoBTS L0 (hardware) and L1 (FPGA+DSP image) are not. So by all means, don't be discouraged from building more hardware that interoperates with GSM related Free and Open Source software! Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From 246tnt at gmail.com Mon Sep 5 11:46:41 2011 From: 246tnt at gmail.com (Sylvain Munaut) Date: Mon, 5 Sep 2011 13:46:41 +0200 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: <20110905111909.GA28810@prithivi.gnumonks.org> References: <20110905090426.GL11927@prithivi.gnumonks.org> <20110905111909.GA28810@prithivi.gnumonks.org> Message-ID: As a quick note, I'm working on the channel coding / decoding for GSM L1 (since we'll need those for osmocom-bb-bts), basically generic routines to go from L2 messages to bursts bits to be modulated. (GSM 05.03 essentially). So if you work on this, I'd suggest starting with getting the part below this working first (tx and rx of bursts).. Cheers, Sylvain From jwjohn0 at gmail.com Fri Sep 16 04:03:45 2011 From: jwjohn0 at gmail.com (John Wu) Date: Fri, 16 Sep 2011 12:03:45 +0800 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: References: <20110905090426.GL11927@prithivi.gnumonks.org> <20110905111909.GA28810@prithivi.gnumonks.org> Message-ID: Hi Sylvain, I also need to implement channel coding / decoding and modulate / demodulate for my L1 implement. can you explain how osmocom-bb-bts works, what kind of data receive from and send to the hardware? Regards! On Mon, Sep 5, 2011 at 7:46 PM, Sylvain Munaut <246tnt at gmail.com> wrote: > As a quick note, I'm working on the channel coding / decoding for GSM > L1 (since we'll need those for osmocom-bb-bts), basically generic > routines to go from L2 messages to bursts bits to be modulated. (GSM > 05.03 essentially). > > So if you work on this, I'd suggest starting with getting the part > below this working first (tx and rx of bursts).. > > Cheers, > > Sylvain > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwjohn0 at gmail.com Fri Sep 16 03:58:34 2011 From: jwjohn0 at gmail.com (John Wu) Date: Fri, 16 Sep 2011 11:58:34 +0800 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: <20110905111909.GA28810@prithivi.gnumonks.org> References: <20110905090426.GL11927@prithivi.gnumonks.org> <20110905111909.GA28810@prithivi.gnumonks.org> Message-ID: Hi Harald, yeah, the hardware is layer0, then I will also implement L1 code in PC side. I have download osmo-bts source but I dont very understand the source architecture. can you introduce the architecture or if there is a design document. I need to know where should I implement my L1 code. and the interface with higher layer. On Mon, Sep 5, 2011 at 7:19 PM, Harald Welte wrote: > Hi John, > > On Mon, Sep 05, 2011 at 05:20:17PM +0800, John Wu wrote: > > > We are just planning on this project which use usb based sdr board and > > will be open design and source. > > In that case, what do you plan to use as layer1? A simple SDR board > only implements "Layer 0", but what about layer1? > > osmo-bts and openbsc implement layers >= 2. > > So what is your plan for L1 ? > > > sounds like sysmocom already working on this. > > sysmocom is not building a USB based SDR, but a complete embedded BTS > product (picocell). That's quite something different. > > And while osmo-bts and openbsc are free software available in source > code, the sysmoBTS L0 (hardware) and L1 (FPGA+DSP image) are not. > > So by all means, don't be discouraged from building more hardware that > interoperates with GSM related Free and Open Source software! > Regards, > Harald > -- > - Harald Welte > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. A6) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwjohn0 at gmail.com Wed Sep 21 01:14:58 2011 From: jwjohn0 at gmail.com (John Wu) Date: Wed, 21 Sep 2011 09:14:58 +0800 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: References: <20110905090426.GL11927@prithivi.gnumonks.org> <20110905111909.GA28810@prithivi.gnumonks.org> Message-ID: Hi Harald, Can you suggest how do I implement the L1 source? Regards On Fri, Sep 16, 2011 at 11:58 AM, John Wu wrote: > Hi Harald, > yeah, the hardware is layer0, then I will also implement L1 code in PC > side. > I have download osmo-bts source but I dont very understand the source > architecture. can you introduce the architecture or if there is a design > document. > I need to know where should I implement my L1 code. and the interface with > higher layer. > > > On Mon, Sep 5, 2011 at 7:19 PM, Harald Welte wrote: > >> Hi John, >> >> On Mon, Sep 05, 2011 at 05:20:17PM +0800, John Wu wrote: >> >> > We are just planning on this project which use usb based sdr board and >> > will be open design and source. >> >> In that case, what do you plan to use as layer1? A simple SDR board >> only implements "Layer 0", but what about layer1? >> >> osmo-bts and openbsc implement layers >= 2. >> >> So what is your plan for L1 ? >> > >> > sounds like sysmocom already working on this. >> >> sysmocom is not building a USB based SDR, but a complete embedded BTS >> product (picocell). That's quite something different. >> >> And while osmo-bts and openbsc are free software available in source >> code, the sysmoBTS L0 (hardware) and L1 (FPGA+DSP image) are not. >> >> So by all means, don't be discouraged from building more hardware that >> interoperates with GSM related Free and Open Source software! > > >> Regards, >> Harald >> -- >> - Harald Welte >> http://laforge.gnumonks.org/ >> >> ============================================================================ >> "Privacy in residential applications is a desirable marketing option." >> (ETSI EN 300 175-7 Ch. >> A6) >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas at eversberg.eu Mon Sep 5 16:58:51 2011 From: andreas at eversberg.eu (Andreas Eversberg) Date: Mon, 05 Sep 2011 18:58:51 +0200 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: References: Message-ID: <4E64FFCB.50004@eversberg.eu> I > Also notice another project osmo-bts project which implement BTS-side > Layer3 and Layer2 protocol. So can I > just implement BTS side L1 then combine with osmo-bts which connect to > osmo-nitb? hi john, i like to note: the "jolly/bts" branch of osmocombb is an obsolete. if you check out osmo-bts.git, you will get the current stage. see "jolly" branch for work on osmocombb-bts (>layer1), as well as "master" branch for current work on sysmo-bts. you can take this for a basis to implement your own bts support. regards, andreas From jwjohn0 at gmail.com Fri Sep 16 04:05:00 2011 From: jwjohn0 at gmail.com (John Wu) Date: Fri, 16 Sep 2011 12:05:00 +0800 Subject: anyone give me a hint to implement L1 for openbsc In-Reply-To: <4E64FFCB.50004@eversberg.eu> References: <4E64FFCB.50004@eversberg.eu> Message-ID: Andreas thanks. On Tue, Sep 6, 2011 at 12:58 AM, Andreas Eversberg wrote: > I > > Also notice another project osmo-bts project which implement BTS-side > > Layer3 and Layer2 protocol. So can I > > just implement BTS side L1 then combine with osmo-bts which connect to > > osmo-nitb? > hi john, > > i like to note: the "jolly/bts" branch of osmocombb is an obsolete. if > you check out osmo-bts.git, you will get the current stage. see "jolly" > branch for work on osmocombb-bts (>layer1), as well as "master" branch > for current work on sysmo-bts. you can take this for a basis to > implement your own bts support. > > regards, > > andreas > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.huemer at xx.vu Mon Sep 5 22:09:47 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:09:47 +0200 Subject: [PATCH 0/4] some minor updates and fixes for openbsc (master) v2 Message-ID: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> These patches for openbsc * 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. From alexander.huemer at xx.vu Mon Sep 5 22:09:48 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:09:48 +0200 Subject: [PATCH 1/4] fix some "implicit declaration" warnings in osmo-nitb In-Reply-To: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> References: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315260591-29050-2-git-send-email-alexander.huemer@xx.vu> --- openbsc/include/openbsc/control_if.h | 13 +++++++++++++ openbsc/include/openbsc/handover_decision.h | 7 +++++++ openbsc/include/openbsc/rrlp.h | 7 +++++++ openbsc/include/openbsc/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/control_if.h create mode 100644 openbsc/include/openbsc/handover_decision.h create mode 100644 openbsc/include/openbsc/rrlp.h create mode 100644 openbsc/include/openbsc/token_auth.h diff --git a/openbsc/include/openbsc/control_if.h b/openbsc/include/openbsc/control_if.h new file mode 100644 index 0000000..96fbf6b --- /dev/null +++ b/openbsc/include/openbsc/control_if.h @@ -0,0 +1,13 @@ +#ifndef _CONTROL_IF_H +#define _CONTROL_IF_H + +#include +#include +#include + +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/handover_decision.h b/openbsc/include/openbsc/handover_decision.h new file mode 100644 index 0000000..81078b0 --- /dev/null +++ b/openbsc/include/openbsc/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/rrlp.h b/openbsc/include/openbsc/rrlp.h new file mode 100644 index 0000000..c89402a --- /dev/null +++ b/openbsc/include/openbsc/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/token_auth.h b/openbsc/include/openbsc/token_auth.h new file mode 100644 index 0000000..47dc7aa --- /dev/null +++ b/openbsc/include/openbsc/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 b41b808..001d8f9 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -42,6 +42,10 @@ #include #include #include +#include +#include +#include +#include #include "../../bscconfig.h" -- 1.7.6.1 From alexander.huemer at xx.vu Mon Sep 5 22:09:49 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:09:49 +0200 Subject: [PATCH 2/4] fix some "implicit declaration" warnings in libtrau In-Reply-To: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> References: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315260591-29050-3-git-send-email-alexander.huemer@xx.vu> --- openbsc/include/openbsc/trau_upqueue.h | 7 +++++++ openbsc/src/libtrau/rtp_proxy.c | 1 + openbsc/src/libtrau/trau_mux.c | 1 + 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 openbsc/include/openbsc/trau_upqueue.h diff --git a/openbsc/include/openbsc/trau_upqueue.h b/openbsc/include/openbsc/trau_upqueue.h new file mode 100644 index 0000000..ecc7658 --- /dev/null +++ b/openbsc/include/openbsc/trau_upqueue.h @@ -0,0 +1,7 @@ +#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 2aa3a1e..3d34ac6 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -35,6 +35,7 @@ #include #include #include +#include /* attempt to determine byte order */ #include diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c index 6a6b7c5..3260ff5 100644 --- a/openbsc/src/libtrau/trau_mux.c +++ b/openbsc/src/libtrau/trau_mux.c @@ -29,6 +29,7 @@ #include #include #include +#include /* this corresponds to teh bit-lengths of the individual codec * parameters as indicated in Table 1.1 of TS 06.10 */ -- 1.7.6.1 From alexander.huemer at xx.vu Mon Sep 5 22:09:50 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:09:50 +0200 Subject: [PATCH 3/4] fix some "implicit declaration" warnings in libbsc In-Reply-To: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> References: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315260591-29050-4-git-send-email-alexander.huemer@xx.vu> --- openbsc/include/openbsc/e1_config.h | 11 +++++++++++ openbsc/src/libbsc/bsc_init.c | 2 ++ 2 files changed, 13 insertions(+), 0 deletions(-) create mode 100644 openbsc/include/openbsc/e1_config.h diff --git a/openbsc/include/openbsc/e1_config.h b/openbsc/include/openbsc/e1_config.h new file mode 100644 index 0000000..538c0b0 --- /dev/null +++ b/openbsc/include/openbsc/e1_config.h @@ -0,0 +1,11 @@ +#ifndef _E1_CONFIG_H +#define _E1_CONFIG_H + +#include + +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 84dfa6e..28f32cc 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include /* global pointer to the gsm network data structure */ extern struct gsm_network *bsc_gsmnet; -- 1.7.6.1 From alexander.huemer at xx.vu Mon Sep 5 22:09:51 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Tue, 6 Sep 2011 00:09:51 +0200 Subject: [PATCH 4/4] fix fprintf format specifiers in osmo-bsc_mgcp In-Reply-To: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> References: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315260591-29050-5-git-send-email-alexander.huemer@xx.vu> --- 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 ee1543c..b334b06 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; } -- 1.7.6.1 From laforge at gnumonks.org Tue Sep 6 07:33:08 2011 From: laforge at gnumonks.org (Harald Welte) Date: Tue, 6 Sep 2011 09:33:08 +0200 Subject: [PATCH 0/4] some minor updates and fixes for openbsc (master) v2 In-Reply-To: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> References: <1315260591-29050-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <20110906073308.GS28810@prithivi.gnumonks.org> On Tue, Sep 06, 2011 at 12:09:47AM +0200, Alexander Huemer wrote: > These patches for openbsc > * fix some implicit declarations of functions > * fix a non-critical mismatch in fprintf format specifiers thanks, applying them right now. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From dakota at dragonfli.org Tue Sep 6 04:19:03 2011 From: dakota at dragonfli.org (Dakota C) Date: Tue, 6 Sep 2011 00:19:03 -0400 Subject: SysmoBTS? Message-ID: I've noticed in the osmo-bts project a lot of references to this 'sysmobts' product and I'm /really/ curious. Now, I know that not a lot will probably be able to be discussed for a bit of time, but for those involved, what can we know /right now/ about it? Any ideal target price? Availability? What it can handle? What it can do? I've also wondered how the 'experimental' work of using OsmocomBB phones as a BTS was ever going - did that ever work? Cheers, -from the desk of Dakota C Support technology in education - because Stone Age administrators never will. From 246tnt at gmail.com Tue Sep 6 07:04:15 2011 From: 246tnt at gmail.com (Sylvain Munaut) Date: Tue, 6 Sep 2011 09:04:15 +0200 Subject: SysmoBTS? In-Reply-To: References: Message-ID: > I've also wondered how the 'experimental' work of using OsmocomBB > phones as a BTS was ever going - did that ever work? It's a work-in-progress, but we're fairly confident that yes it will work. Cheers, Sylvain From admin at manateeshome.com Tue Sep 6 15:09:46 2011 From: admin at manateeshome.com (Seungju Kim) Date: Wed, 7 Sep 2011 00:09:46 +0900 Subject: OpenBSC behind NAT Message-ID: <622EFB36-2863-4B3D-AD65-A7C9146AECBB@kandinsky.mananet.net> Hello, i am trying to set up an openbsc network behind NAT. So far i can run the bts with oml/rsl. But the bts fails to connect to the sgsn. I think it is because of the ports. What ports shall i open in order to get it work? And the encalsulation settings could not be matched because the sgsn is behind the nat. Is there a workaround for this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From laforge at gnumonks.org Tue Sep 6 16:35:00 2011 From: laforge at gnumonks.org (Harald Welte) Date: Tue, 6 Sep 2011 18:35:00 +0200 Subject: OpenBSC behind NAT In-Reply-To: <622EFB36-2863-4B3D-AD65-A7C9146AECBB@kandinsky.mananet.net> References: <622EFB36-2863-4B3D-AD65-A7C9146AECBB@kandinsky.mananet.net> Message-ID: <20110906163500.GG6415@prithivi.gnumonks.org> On Wed, Sep 07, 2011 at 12:09:46AM +0900, Seungju Kim wrote: > Hello, i am trying to set up an openbsc network behind NAT. So far i > can run the bts with oml/rsl. But the bts fails to connect to the > sgsn. I think it is because of the ports. What ports shall i open in > order to get it work? And the encalsulation settings could not be > matched because the sgsn is behind the nat. Is there a workaround for > this? If you have a 'proper' NAT implementation + configuration, it shoulnd't really matter. My guess is that you are experiencing some restrictions in your packet filter rules. Which ports you should open? That depends on what you have configured in the openbsc and osmosgsn config files. Also, I guess it is not too much to ask you to open wireshark and analyze the packet streams before and after your nat, figuring out which messages are dropped by it and which not... -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.huemer at xx.vu Wed Sep 7 09:17:13 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Wed, 7 Sep 2011 11:17:13 +0200 Subject: autoconf fix for libosmo-abis (master) Message-ID: <1315387034-30883-1-git-send-email-alexander.huemer@xx.vu> This patch adds a version check for ortp, needed because of an upstream API change. libosmo-abis fails to build with ortp <0.15.0. From alexander.huemer at xx.vu Wed Sep 7 09:17:14 2011 From: alexander.huemer at xx.vu (Alexander Huemer) Date: Wed, 7 Sep 2011 11:17:14 +0200 Subject: [PATCH] request ortp >=0.15.0 In-Reply-To: <1315387034-30883-1-git-send-email-alexander.huemer@xx.vu> References: <1315387034-30883-1-git-send-email-alexander.huemer@xx.vu> Message-ID: <1315387034-30883-2-git-send-email-alexander.huemer@xx.vu> build fails with ortp <0.15.0 because of incompatible API. --- configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index ec5086d..1ab807b 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ AM_CONFIG_HEADER(config.h) PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.0) -PKG_CHECK_MODULES(ORTP, ortp) +PKG_CHECK_MODULES(ORTP, ortp >= 0.15.0) AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built)) -- 1.7.6.1 From laforge at gnumonks.org Wed Sep 7 19:01:18 2011 From: laforge at gnumonks.org (Harald Welte) Date: Wed, 7 Sep 2011 21:01:18 +0200 Subject: [osmocom-announce] patched wireshark now on git.osmocom.org Message-ID: <20110907190118.GO6415@prithivi.gnumonks.org> Hi all, we have accumulated a number of wireshark patches, and by far not all of them have been merged into mainline wireshark so far (volunteers, anyone?) Some people have complained that it is hard to build them, as you first have to find a wireshark version to which they apply, etc. We have now created a wireshark.git repository at git.osmocom.org in which you will be able to find the latest mainline wireshark version ('trunk' branch) as well as our patches in 'master': http://cgit.osmocom.org/cgit/wireshark/ the read-onIy clone url is 'git://git.osmocom.org/wireshark' So the recommended option for everyone needing patched wireshark for one or the other reason (e.g. simtrace) now is to clone that wireshark.git repository and build from there. Like before, we will rebase our patches in irregular intervals, so you may have to do a 'pull -f' instead of 'pull' at that time. Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From alexander.chemeris at gmail.com Thu Sep 8 16:38:11 2011 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Thu, 8 Sep 2011 20:38:11 +0400 Subject: New open hardware for OpenBTS Message-ID: Hi all, (and sorry to those who receive this twice) At Sept 15th I will speak at the Open Hardware Summit at the breakout session "Open Hardware in Voice Telecommunications" and there I will present Fairwaves project to create an open hardware transceiver for OpenBTS. Someone may recall I proposed similar project about 1.5 years ago, but then abandoned due to lack of interest from the community. Now it was revived on a new level, thanks to financial and motivational support from Jean-Samuel Najnudel of BJT Partners SARL. As an experiment this project will be completely open-sourced in an open-source hardware way. Project is in active development, so just to give you an idea of what we're aiming: * Targeted for rural installations. * CAPEX and OPEX optimized. * 2 TRX per sector. Each TRX connected to its own antenna with its own saturated (=cheap) power amplifier on Tx side. On Rx side both antennas are used to provide diversity receive. * Reference clock synchronized to GPS for accurate timing. * Based on USRP N200, but with Xilinx Spartan 6 and LimeMicro LMS6002D. Which means it's actually design is much more capable then just GSM. More details, web-site, schematics, etc will be available after OHS. First samples of the hardware we hope to have at the end of this year. If you're going to OHS - come to our breakout session to discuss the project and share your ideas! -- Regards, Alexander Chemeris. From kheimerl at cs.berkeley.edu Thu Sep 8 17:17:09 2011 From: kheimerl at cs.berkeley.edu (Kurtis Heimerl) Date: Thu, 8 Sep 2011 10:17:09 -0700 Subject: [Openbts-discuss] New open hardware for OpenBTS In-Reply-To: References: Message-ID: This is awesome Alexander. Please keep the list (and me personally) informed, I'd love to help in whatever context I can. On Thu, Sep 8, 2011 at 9:38 AM, Alexander Chemeris wrote: > Hi all, (and sorry to those who receive this twice) > > At Sept 15th I will speak at the Open Hardware Summit at the breakout > session "Open Hardware in Voice Telecommunications" and there I will > present Fairwaves project to create an open hardware transceiver for > OpenBTS. Someone may recall I proposed similar project about 1.5 years > ago, but then abandoned due to lack of interest from the community. > Now it was revived on a new level, thanks to financial and > motivational support from Jean-Samuel Najnudel of BJT Partners SARL. > As an experiment this project will be completely open-sourced in an > open-source hardware way. > > Project is in active development, so just to give you an idea of what > we're aiming: > ?* Targeted for rural installations. > ?* CAPEX and OPEX optimized. > ?* 2 TRX per sector. Each TRX connected to its own antenna with its > own saturated (=cheap) power amplifier on Tx side. On Rx side both > antennas are used to provide diversity receive. > ?* Reference clock synchronized to GPS for accurate timing. > ?* Based on USRP N200, but with Xilinx Spartan 6 and LimeMicro > LMS6002D. Which means it's actually design is much more capable then > just GSM. > > More details, web-site, schematics, etc will be available after OHS. > First samples of the hardware we hope to have at the end of this year. > > If you're going to OHS - come to our breakout session to discuss the > project and share your ideas! > > -- > Regards, > Alexander Chemeris. > > ------------------------------------------------------------------------------ > Doing More with Less: The Next Generation Virtual Desktop > What are the key obstacles that have prevented many mid-market businesses > from deploying virtual desktops? ? How do next-generation virtual desktops > provide companies an easier-to-deploy, easier-to-manage and more affordable > virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ > _______________________________________________ > Openbts-discuss mailing list > Openbts-discuss at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbts-discuss > From alexander.chemeris at gmail.com Thu Sep 8 17:29:10 2011 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Thu, 8 Sep 2011 21:29:10 +0400 Subject: [Openbts-discuss] New open hardware for OpenBTS In-Reply-To: References: Message-ID: Kurtis, I will. And thank you for your interest. On Thu, Sep 8, 2011 at 21:17, Kurtis Heimerl wrote: > This is awesome Alexander. Please keep the list (and me personally) > informed, I'd love to help in whatever context I can. > > On Thu, Sep 8, 2011 at 9:38 AM, Alexander Chemeris > wrote: >> Hi all, (and sorry to those who receive this twice) >> >> At Sept 15th I will speak at the Open Hardware Summit at the breakout >> session "Open Hardware in Voice Telecommunications" and there I will >> present Fairwaves project to create an open hardware transceiver for >> OpenBTS. Someone may recall I proposed similar project about 1.5 years >> ago, but then abandoned due to lack of interest from the community. >> Now it was revived on a new level, thanks to financial and >> motivational support from Jean-Samuel Najnudel of BJT Partners SARL. >> As an experiment this project will be completely open-sourced in an >> open-source hardware way. >> >> Project is in active development, so just to give you an idea of what >> we're aiming: >> ?* Targeted for rural installations. >> ?* CAPEX and OPEX optimized. >> ?* 2 TRX per sector. Each TRX connected to its own antenna with its >> own saturated (=cheap) power amplifier on Tx side. On Rx side both >> antennas are used to provide diversity receive. >> ?* Reference clock synchronized to GPS for accurate timing. >> ?* Based on USRP N200, but with Xilinx Spartan 6 and LimeMicro >> LMS6002D. Which means it's actually design is much more capable then >> just GSM. >> >> More details, web-site, schematics, etc will be available after OHS. >> First samples of the hardware we hope to have at the end of this year. >> >> If you're going to OHS - come to our breakout session to discuss the >> project and share your ideas! >> >> -- >> Regards, >> Alexander Chemeris. >> >> ------------------------------------------------------------------------------ >> Doing More with Less: The Next Generation Virtual Desktop >> What are the key obstacles that have prevented many mid-market businesses >> from deploying virtual desktops? ? How do next-generation virtual desktops >> provide companies an easier-to-deploy, easier-to-manage and more affordable >> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ >> _______________________________________________ >> Openbts-discuss mailing list >> Openbts-discuss at lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/openbts-discuss >> > -- Regards, Alexander Chemeris. From ashwin.lists at gmail.com Fri Sep 9 15:05:06 2011 From: ashwin.lists at gmail.com (Ashwin Mansinghka) Date: Fri, 09 Sep 2011 20:35:06 +0530 Subject: New open hardware for OpenBTS In-Reply-To: References: Message-ID: <4E6A2B22.8030801@gmail.com> Hi, What is the Tx power being aimed for 1W & 5W or more ? with Regards, Ashwin On Thursday 08 September 2011 10:08 PM, Alexander Chemeris wrote: > Hi all, (and sorry to those who receive this twice) > > At Sept 15th I will speak at the Open Hardware Summit at the breakout > session "Open Hardware in Voice Telecommunications" and there I will > present Fairwaves project to create an open hardware transceiver for > OpenBTS. Someone may recall I proposed similar project about 1.5 years > ago, but then abandoned due to lack of interest from the community. > Now it was revived on a new level, thanks to financial and > motivational support from Jean-Samuel Najnudel of BJT Partners SARL. > As an experiment this project will be completely open-sourced in an > open-source hardware way. > > Project is in active development, so just to give you an idea of what > we're aiming: > * Targeted for rural installations. > * CAPEX and OPEX optimized. > * 2 TRX per sector. Each TRX connected to its own antenna with its > own saturated (=cheap) power amplifier on Tx side. On Rx side both > antennas are used to provide diversity receive. > * Reference clock synchronized to GPS for accurate timing. > * Based on USRP N200, but with Xilinx Spartan 6 and LimeMicro > LMS6002D. Which means it's actually design is much more capable then > just GSM. > > More details, web-site, schematics, etc will be available after OHS. > First samples of the hardware we hope to have at the end of this year. > > If you're going to OHS - come to our breakout session to discuss the > project and share your ideas! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.chemeris at gmail.com Fri Sep 9 19:53:03 2011 From: alexander.chemeris at gmail.com (Alexander Chemeris) Date: Fri, 9 Sep 2011 23:53:03 +0400 Subject: New open hardware for OpenBTS In-Reply-To: <4E6A2B22.8030801@gmail.com> References: <4E6A2B22.8030801@gmail.com> Message-ID: Standard output power of the transceiver will be 3mW, which is a common output power for GSM transceivers. You could connect an external GSM PA to get any power you need. We may provide an option for integrated 1-3W power amplifier, but we haven't decided yet. Note, that if you install a PA for Tx, you should also install appropriate LNA for Rx and duplexer to separate them. -- Alexander Chemeris Sent from my Android device. Sorry for my brevity. On Sep 9, 2011 9:03 PM, "Ashwin Mansinghka" wrote: Hi, What is the Tx power being aimed for 1W & 5W or more ? with Regards, Ashwin On Thursday 08 September 2011 10:08 PM, Alexander Chemeris wrote: > > Hi all, (and sorry to those ... -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwjohn0 at gmail.com Wed Sep 21 01:36:06 2011 From: jwjohn0 at gmail.com (John Wu) Date: Wed, 21 Sep 2011 09:36:06 +0800 Subject: [Openbts-discuss] New open hardware for OpenBTS In-Reply-To: References: Message-ID: Hi Alexander Great, you have done it. On Fri, Sep 9, 2011 at 12:38 AM, Alexander Chemeris < alexander.chemeris at gmail.com> wrote: > Hi all, (and sorry to those who receive this twice) > > At Sept 15th I will speak at the Open Hardware Summit at the breakout > session "Open Hardware in Voice Telecommunications" and there I will > present Fairwaves project to create an open hardware transceiver for > OpenBTS. Someone may recall I proposed similar project about 1.5 years > ago, but then abandoned due to lack of interest from the community. > Now it was revived on a new level, thanks to financial and > motivational support from Jean-Samuel Najnudel of BJT Partners SARL. > As an experiment this project will be completely open-sourced in an > open-source hardware way. > > Project is in active development, so just to give you an idea of what > we're aiming: > * Targeted for rural installations. > * CAPEX and OPEX optimized. > * 2 TRX per sector. Each TRX connected to its own antenna with its > own saturated (=cheap) power amplifier on Tx side. On Rx side both > antennas are used to provide diversity receive. > * Reference clock synchronized to GPS for accurate timing. > * Based on USRP N200, but with Xilinx Spartan 6 and LimeMicro > LMS6002D. Which means it's actually design is much more capable then > just GSM. > > More details, web-site, schematics, etc will be available after OHS. > First samples of the hardware we hope to have at the end of this year. > > If you're going to OHS - come to our breakout session to discuss the > project and share your ideas! > > -- > Regards, > Alexander Chemeris. > > > ------------------------------------------------------------------------------ > Doing More with Less: The Next Generation Virtual Desktop > What are the key obstacles that have prevented many mid-market businesses > from deploying virtual desktops? How do next-generation virtual desktops > provide companies an easier-to-deploy, easier-to-manage and more affordable > virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ > _______________________________________________ > Openbts-discuss mailing list > Openbts-discuss at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/openbts-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pablo at gnumonks.org Fri Sep 9 00:36:54 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:54 +0200 Subject: [PATCH 0/7] libosmo-abis: updates for generic IPA infrastructure Message-ID: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Hi! This patchset contains several updates for the generic IPA infrastructure which provides an abstraction upon the generic socket infrastructure for IPA traffic. After this patchset, it will follow up one patch to use it in openBSC. You can find these changes in the pablo/ipa-updates branch of libosmo-abis. Please, merge them. Pablo Neira Ayuso (7): ipa: remove bogus driver_name parameter from ipa_client_create ipa: rename all reference to ipa_*_peer to ipa_*_conn tests: remove reference to internal headers in ipa_proxy_test ipa: use default write callback in ipa_client_conn_create if not specified ipa: fix segfault in ipa_client_conn_create if no E1 timeslot is specified ipa: better log error messages for ipa_msg_recv() ipa: use DEBUG level instead of NOTICE for debugging log messages include/osmocom/abis/ipa.h | 34 +++++----- src/input/hsl.c | 22 +++--- src/input/ipa.c | 153 ++++++++++++++++++++++---------------------- src/input/ipaccess.c | 26 ++++---- src/ipa_proxy.c | 22 +++--- tests/ipa_proxy_test.c | 4 +- 6 files changed, 128 insertions(+), 133 deletions(-) -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:36:55 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:55 +0200 Subject: [PATCH 1/7] ipa: remove bogus driver_name parameter from ipa_client_create In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-2-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This parameter is not required since the line that we pass as parameter already has one driver attached. --- include/osmocom/abis/ipa.h | 2 +- src/input/hsl.c | 2 +- src/input/ipa.c | 8 ++------ src/input/ipaccess.c | 4 ++-- src/ipa_proxy.c | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 1a10ba9..1c6be15 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -54,7 +54,7 @@ struct ipa_client_link { void *data; }; -struct ipa_client_link *ipa_client_link_create(void *ctx, struct e1inp_ts *ts, const char *driver_name, int priv_nr, const char *addr, uint16_t port, int (*connect)(struct ipa_client_link *link), int (*read_cb)(struct ipa_client_link *link, struct msgb *msgb), int (*write_cb)(struct ipa_client_link *link), void *data); +struct ipa_client_link *ipa_client_link_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, int (*connect)(struct ipa_client_link *link), int (*read_cb)(struct ipa_client_link *link, struct msgb *msgb), int (*write_cb)(struct ipa_client_link *link), void *data); void ipa_client_link_destroy(struct ipa_client_link *link); int ipa_client_write_default_cb(struct ipa_client_link *link); diff --git a/src/input/hsl.c b/src/input/hsl.c index 60eea17..040dbce 100644 --- a/src/input/hsl.c +++ b/src/input/hsl.c @@ -507,7 +507,7 @@ static int hsl_line_update(struct e1inp_line *line) link = ipa_client_link_create(tall_hsl_ctx, &line->ts[E1INP_SIGN_OML-1], - "hsl", E1INP_SIGN_OML, + E1INP_SIGN_OML, line->ops->cfg.ipa.addr, HSL_TCP_PORT, hsl_bts_connect, diff --git a/src/input/ipa.c b/src/input/ipa.c index b9bde68..83863f5 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -205,7 +205,7 @@ static int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what) static void ipa_link_timer_cb(void *data); struct ipa_client_link * -ipa_client_link_create(void *ctx, struct e1inp_ts *ts, const char *driver_name, +ipa_client_link_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, int (*connect_cb)(struct ipa_client_link *link), int (*read_cb)(struct ipa_client_link *link, @@ -220,14 +220,10 @@ ipa_client_link_create(void *ctx, struct e1inp_ts *ts, const char *driver_name, return NULL; if (ts) { - struct e1inp_driver *driver; - - driver = e1inp_driver_find(driver_name); - if (driver == NULL) { + if (ts->line->driver == NULL) { talloc_free(ipa_link); return NULL; } - ts->line->driver = driver; ipa_link->ofd = &ts->driver.ipaccess.fd; } else { ipa_link->ofd = talloc_zero(ctx, struct osmo_fd); diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index ea04e8d..3163a8c 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -881,7 +881,7 @@ static int ipaccess_line_update(struct e1inp_line *line) link = ipa_client_link_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_OML-1], - "ipa", E1INP_SIGN_OML, + E1INP_SIGN_OML, line->ops->cfg.ipa.addr, IPA_TCP_PORT_OML, NULL, @@ -902,7 +902,7 @@ static int ipaccess_line_update(struct e1inp_line *line) } rsl_link = ipa_client_link_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_RSL-1], - "ipa", E1INP_SIGN_RSL, + E1INP_SIGN_RSL, line->ops->cfg.ipa.addr, IPA_TCP_PORT_RSL, NULL, diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c index 53da996..dadfd2f 100644 --- a/src/ipa_proxy.c +++ b/src/ipa_proxy.c @@ -185,7 +185,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) LOGP(DLINP, LOGL_NOTICE, "now trying to connect to destination\n"); - conn->dst = ipa_client_link_create(NULL, NULL, NULL, 0, + conn->dst = ipa_client_link_create(NULL, NULL, 0, route->shared->dst.inst->net.addr, route->shared->dst.inst->net.port, NULL, -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:36:56 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:56 +0200 Subject: [PATCH 2/7] ipa: rename all reference to ipa_*_peer to ipa_*_conn In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-3-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This patch is a cleanup. It renames several function from _peer to _conn which seems to me like a more logical name. There are no clients of this code out of the libosmo-abis tree so far, so this shouldn't break anything. --- include/osmocom/abis/ipa.h | 34 ++++++------ src/input/hsl.c | 20 ++++---- src/input/ipa.c | 118 ++++++++++++++++++++++---------------------- src/input/ipaccess.c | 22 ++++---- src/ipa_proxy.c | 20 ++++---- 5 files changed, 107 insertions(+), 107 deletions(-) diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 1c6be15..fdf4b66 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -20,49 +20,49 @@ void ipa_server_link_destroy(struct ipa_server_link *link); int ipa_server_link_open(struct ipa_server_link *link); void ipa_server_link_close(struct ipa_server_link *link); -struct ipa_server_peer { +struct ipa_server_conn { struct ipa_server_link *server; struct osmo_fd ofd; struct llist_head tx_queue; - int (*cb)(struct ipa_server_peer *peer, struct msgb *msg); + int (*cb)(struct ipa_server_conn *peer, struct msgb *msg); void *data; }; -struct ipa_server_peer *ipa_server_peer_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_peer *peer, struct msgb *msg), void *data); -void ipa_server_peer_destroy(struct ipa_server_peer *peer); +struct ipa_server_conn *ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_conn *peer, struct msgb *msg), void *data); +void ipa_server_conn_destroy(struct ipa_server_conn *peer); -void ipa_server_peer_send(struct ipa_server_peer *peer, struct msgb *msg); +void ipa_server_conn_send(struct ipa_server_conn *peer, struct msgb *msg); -enum ipa_client_link_state { +enum ipa_client_conn_state { IPA_CLIENT_LINK_STATE_NONE = 0, IPA_CLIENT_LINK_STATE_CONNECTING = 1, IPA_CLIENT_LINK_STATE_CONNECTED = 2, IPA_CLIENT_LINK_STATE_MAX }; -struct ipa_client_link { +struct ipa_client_conn { struct e1inp_line *line; struct osmo_fd *ofd; struct llist_head tx_queue; struct osmo_timer_list timer; - enum ipa_client_link_state state; + enum ipa_client_conn_state state; const char *addr; uint16_t port; - int (*connect_cb)(struct ipa_client_link *link); - int (*read_cb)(struct ipa_client_link *link, struct msgb *msg); - int (*write_cb)(struct ipa_client_link *link); + int (*connect_cb)(struct ipa_client_conn *link); + int (*read_cb)(struct ipa_client_conn *link, struct msgb *msg); + int (*write_cb)(struct ipa_client_conn *link); void *data; }; -struct ipa_client_link *ipa_client_link_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, int (*connect)(struct ipa_client_link *link), int (*read_cb)(struct ipa_client_link *link, struct msgb *msgb), int (*write_cb)(struct ipa_client_link *link), void *data); -void ipa_client_link_destroy(struct ipa_client_link *link); +struct ipa_client_conn *ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, int (*connect)(struct ipa_client_conn *link), int (*read_cb)(struct ipa_client_conn *link, struct msgb *msgb), int (*write_cb)(struct ipa_client_conn *link), void *data); +void ipa_client_conn_destroy(struct ipa_client_conn *link); -int ipa_client_write_default_cb(struct ipa_client_link *link); +int ipa_client_write_default_cb(struct ipa_client_conn *link); -int ipa_client_link_open(struct ipa_client_link *link); -void ipa_client_link_close(struct ipa_client_link *link); +int ipa_client_conn_open(struct ipa_client_conn *link); +void ipa_client_conn_close(struct ipa_client_conn *link); -void ipa_client_link_send(struct ipa_client_link *link, struct msgb *msg); +void ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg); int ipa_msg_recv(int fd, struct msgb **rmsg); diff --git a/src/input/hsl.c b/src/input/hsl.c index 040dbce..408228e 100644 --- a/src/input/hsl.c +++ b/src/input/hsl.c @@ -273,7 +273,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) return __handle_ts1_write(bfd, line); } -int hsl_bts_write(struct ipa_client_link *link) +int hsl_bts_write(struct ipa_client_conn *link) { struct e1inp_line *line = link->line; @@ -383,7 +383,7 @@ static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) return ret; } -static int hsl_bts_process(struct ipa_client_link *link, struct msgb *msg) +static int hsl_bts_process(struct ipa_client_conn *link, struct msgb *msg) { struct ipaccess_head *hh; struct e1inp_sign_link *sign_link; @@ -415,7 +415,7 @@ static int hsl_bts_process(struct ipa_client_link *link, struct msgb *msg) return 0; } -static int hsl_bts_connect(struct ipa_client_link *link) +static int hsl_bts_connect(struct ipa_client_conn *link) { struct msgb *msg; uint8_t *serno; @@ -442,7 +442,7 @@ static int hsl_bts_connect(struct ipa_client_link *link) if (!link->line->ops->sign_link_up) { LOGP(DLINP, LOGL_ERROR, "Unable to set signal link, closing socket.\n"); - ipa_client_link_close(link); + ipa_client_conn_close(link); return -EINVAL; } sign_link = link->line->ops->sign_link_up(&unit, @@ -450,7 +450,7 @@ static int hsl_bts_connect(struct ipa_client_link *link) if (sign_link == NULL) { LOGP(DLINP, LOGL_ERROR, "Unable to set signal link, closing socket.\n"); - ipa_client_link_close(link); + ipa_client_conn_close(link); return -EINVAL; } return 0; @@ -501,11 +501,11 @@ static int hsl_line_update(struct e1inp_line *line) } break; case E1INP_LINE_R_BTS: { - struct ipa_client_link *link; + struct ipa_client_conn *link; LOGP(DLINP, LOGL_NOTICE, "enabling hsl BTS mode\n"); - link = ipa_client_link_create(tall_hsl_ctx, + link = ipa_client_conn_create(tall_hsl_ctx, &line->ts[E1INP_SIGN_OML-1], E1INP_SIGN_OML, line->ops->cfg.ipa.addr, @@ -519,11 +519,11 @@ static int hsl_line_update(struct e1inp_line *line) strerror(errno)); return -ENOMEM; } - if (ipa_client_link_open(link) < 0) { + if (ipa_client_conn_open(link) < 0) { LOGP(DLINP, LOGL_ERROR, "cannot open BTS link: %s\n", strerror(errno)); - ipa_client_link_close(link); - ipa_client_link_destroy(link); + ipa_client_conn_close(link); + ipa_client_conn_destroy(link); return -EIO; } ret = 0; diff --git a/src/input/ipa.c b/src/input/ipa.c index 83863f5..020a730 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -90,24 +90,24 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) return ret; } -void ipa_client_link_close(struct ipa_client_link *link); +void ipa_client_conn_close(struct ipa_client_conn *link); -static void ipa_client_retry(struct ipa_client_link *link) +static void ipa_client_retry(struct ipa_client_conn *link) { LOGP(DLINP, LOGL_NOTICE, "connection closed\n"); - ipa_client_link_close(link); + ipa_client_conn_close(link); LOGP(DLINP, LOGL_NOTICE, "retrying in 5 seconds...\n"); osmo_timer_schedule(&link->timer, 5, 0); link->state = IPA_CLIENT_LINK_STATE_CONNECTING; } -void ipa_client_link_close(struct ipa_client_link *link) +void ipa_client_conn_close(struct ipa_client_conn *link) { osmo_fd_unregister(link->ofd); close(link->ofd->fd); } -static void ipa_client_read(struct ipa_client_link *link) +static void ipa_client_read(struct ipa_client_conn *link) { struct osmo_fd *ofd = link->ofd; struct msgb *msg; @@ -133,13 +133,13 @@ static void ipa_client_read(struct ipa_client_link *link) link->read_cb(link, msg); } -static void ipa_client_write(struct ipa_client_link *link) +static void ipa_client_write(struct ipa_client_conn *link) { if (link->write_cb) link->write_cb(link); } -int ipa_client_write_default_cb(struct ipa_client_link *link) +int ipa_client_write_default_cb(struct ipa_client_conn *link) { struct osmo_fd *ofd = link->ofd; struct msgb *msg; @@ -169,7 +169,7 @@ int ipa_client_write_default_cb(struct ipa_client_link *link) static int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what) { - struct ipa_client_link *link = ofd->data; + struct ipa_client_conn *link = ofd->data; int error, ret; socklen_t len = sizeof(error); @@ -204,18 +204,18 @@ static int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what) static void ipa_link_timer_cb(void *data); -struct ipa_client_link * -ipa_client_link_create(void *ctx, struct e1inp_ts *ts, +struct ipa_client_conn * +ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, - int (*connect_cb)(struct ipa_client_link *link), - int (*read_cb)(struct ipa_client_link *link, + int (*connect_cb)(struct ipa_client_conn *link), + int (*read_cb)(struct ipa_client_conn *link, struct msgb *msgb), - int (*write_cb)(struct ipa_client_link *link), + int (*write_cb)(struct ipa_client_conn *link), void *data) { - struct ipa_client_link *ipa_link; + struct ipa_client_conn *ipa_link; - ipa_link = talloc_zero(ctx, struct ipa_client_link); + ipa_link = talloc_zero(ctx, struct ipa_client_conn); if (!ipa_link) return NULL; @@ -252,12 +252,12 @@ ipa_client_link_create(void *ctx, struct e1inp_ts *ts, return ipa_link; } -void ipa_client_link_destroy(struct ipa_client_link *link) +void ipa_client_conn_destroy(struct ipa_client_conn *link) { talloc_free(link); } -int ipa_client_link_open(struct ipa_client_link *link) +int ipa_client_conn_open(struct ipa_client_conn *link) { int ret; @@ -278,20 +278,20 @@ int ipa_client_link_open(struct ipa_client_link *link) static void ipa_link_timer_cb(void *data) { - struct ipa_client_link *link = data; + struct ipa_client_conn *link = data; LOGP(DLINP, LOGL_NOTICE, "reconnecting.\n"); switch(link->state) { case IPA_CLIENT_LINK_STATE_CONNECTING: - ipa_client_link_open(link); + ipa_client_conn_open(link); break; default: break; } } -void ipa_client_link_send(struct ipa_client_link *link, struct msgb *msg) +void ipa_client_conn_send(struct ipa_client_conn *link, struct msgb *msg) { msgb_enqueue(&link->tx_queue, msg); link->ofd->when |= BSC_FD_WRITE; @@ -372,9 +372,9 @@ void ipa_server_link_close(struct ipa_server_link *link) close(link->ofd.fd); } -static void ipa_server_peer_read(struct ipa_server_peer *peer) +static void ipa_server_conn_read(struct ipa_server_conn *conn) { - struct osmo_fd *ofd = &peer->ofd; + struct osmo_fd *ofd = &conn->ofd; struct msgb *msg; int ret; @@ -390,91 +390,91 @@ static void ipa_server_peer_read(struct ipa_server_peer *peer) return; } else if (ret == 0) { LOGP(DLINP, LOGL_ERROR, "connection closed with server\n"); - ipa_server_peer_destroy(peer); + ipa_server_conn_destroy(conn); return; } - if (peer->cb) - peer->cb(peer, msg); + if (conn->cb) + conn->cb(conn, msg); return; } -static void ipa_server_peer_write(struct ipa_server_peer *peer) +static void ipa_server_conn_write(struct ipa_server_conn *conn) { - struct osmo_fd *ofd = &peer->ofd; + struct osmo_fd *ofd = &conn->ofd; struct msgb *msg; struct llist_head *lh; int ret; LOGP(DLINP, LOGL_NOTICE, "sending data\n"); - if (llist_empty(&peer->tx_queue)) { + if (llist_empty(&conn->tx_queue)) { ofd->when &= ~BSC_FD_WRITE; return; } - lh = peer->tx_queue.next; + lh = conn->tx_queue.next; llist_del(lh); msg = llist_entry(lh, struct msgb, list); - ret = send(peer->ofd.fd, msg->data, msg->len, 0); + ret = send(conn->ofd.fd, msg->data, msg->len, 0); if (ret < 0) { LOGP(DLINP, LOGL_ERROR, "error to send\n"); } msgb_free(msg); } -static int ipa_server_peer_cb(struct osmo_fd *ofd, unsigned int what) +static int ipa_server_conn_cb(struct osmo_fd *ofd, unsigned int what) { - struct ipa_server_peer *peer = ofd->data; + struct ipa_server_conn *conn = ofd->data; LOGP(DLINP, LOGL_NOTICE, "connected read/write\n"); if (what & BSC_FD_READ) - ipa_server_peer_read(peer); + ipa_server_conn_read(conn); if (what & BSC_FD_WRITE) - ipa_server_peer_write(peer); + ipa_server_conn_write(conn); return 0; } -struct ipa_server_peer * -ipa_server_peer_create(void *ctx, struct ipa_server_link *link, int fd, - int (*cb)(struct ipa_server_peer *peer, struct msgb *msg), +struct ipa_server_conn * +ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, + int (*cb)(struct ipa_server_conn *conn, struct msgb *msg), void *data) { - struct ipa_server_peer *peer; + struct ipa_server_conn *conn; - peer = talloc_zero(ctx, struct ipa_server_peer); - if (peer == NULL) { + conn = talloc_zero(ctx, struct ipa_server_conn); + if (conn == NULL) { LOGP(DLINP, LOGL_ERROR, "cannot allocate new peer in server, " "reason=`%s'\n", strerror(errno)); return NULL; } - peer->server = link; - peer->ofd.fd = fd; - peer->ofd.data = peer; - peer->ofd.cb = ipa_server_peer_cb; - peer->ofd.when = BSC_FD_READ; - peer->cb = cb; - peer->data = data; - INIT_LLIST_HEAD(&peer->tx_queue); - - if (osmo_fd_register(&peer->ofd) < 0) { + conn->server = link; + conn->ofd.fd = fd; + conn->ofd.data = conn; + conn->ofd.cb = ipa_server_conn_cb; + conn->ofd.when = BSC_FD_READ; + conn->cb = cb; + conn->data = data; + INIT_LLIST_HEAD(&conn->tx_queue); + + if (osmo_fd_register(&conn->ofd) < 0) { LOGP(DLINP, LOGL_ERROR, "could not register FD\n"); - talloc_free(peer); + talloc_free(conn); return NULL; } - return peer; + return conn; } -void ipa_server_peer_destroy(struct ipa_server_peer *peer) +void ipa_server_conn_destroy(struct ipa_server_conn *conn) { - close(peer->ofd.fd); - osmo_fd_unregister(&peer->ofd); - talloc_free(peer); + close(conn->ofd.fd); + osmo_fd_unregister(&conn->ofd); + talloc_free(conn); } -void ipa_server_peer_send(struct ipa_server_peer *peer, struct msgb *msg) +void ipa_server_conn_send(struct ipa_server_conn *conn, struct msgb *msg) { - msgb_enqueue(&peer->tx_queue, msg); - peer->ofd.when |= BSC_FD_WRITE; + msgb_enqueue(&conn->tx_queue, msg); + conn->ofd.when |= BSC_FD_WRITE; } diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c index 3163a8c..9c501de 100644 --- a/src/input/ipaccess.c +++ b/src/input/ipaccess.c @@ -531,7 +531,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) return __handle_ts1_write(bfd, line); } -static int ipaccess_bts_write_cb(struct ipa_client_link *link) +static int ipaccess_bts_write_cb(struct ipa_client_conn *link) { struct e1inp_line *line = link->line; @@ -735,7 +735,7 @@ static struct msgb *ipa_bts_id_ack(void) return nmsg2; } -static int ipaccess_bts_cb(struct ipa_client_link *link, struct msgb *msg) +static int ipaccess_bts_cb(struct ipa_client_conn *link, struct msgb *msg) { struct ipaccess_head *hh = (struct ipaccess_head *) msg->data; struct e1inp_ts *e1i_ts = NULL; @@ -875,11 +875,11 @@ static int ipaccess_line_update(struct e1inp_line *line) break; } case E1INP_LINE_R_BTS: { - struct ipa_client_link *link, *rsl_link; + struct ipa_client_conn *link, *rsl_link; LOGP(DLINP, LOGL_NOTICE, "enabling ipaccess BTS mode\n"); - link = ipa_client_link_create(tall_ipa_ctx, + link = ipa_client_conn_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_OML-1], E1INP_SIGN_OML, line->ops->cfg.ipa.addr, @@ -893,14 +893,14 @@ static int ipaccess_line_update(struct e1inp_line *line) "BTS link: %s\n", strerror(errno)); return -ENOMEM; } - if (ipa_client_link_open(link) < 0) { + if (ipa_client_conn_open(link) < 0) { LOGP(DLINP, LOGL_ERROR, "cannot open OML BTS link: %s\n", strerror(errno)); - ipa_client_link_close(link); - ipa_client_link_destroy(link); + ipa_client_conn_close(link); + ipa_client_conn_destroy(link); return -EIO; } - rsl_link = ipa_client_link_create(tall_ipa_ctx, + rsl_link = ipa_client_conn_create(tall_ipa_ctx, &line->ts[E1INP_SIGN_RSL-1], E1INP_SIGN_RSL, line->ops->cfg.ipa.addr, @@ -914,11 +914,11 @@ static int ipaccess_line_update(struct e1inp_line *line) "BTS link: %s\n", strerror(errno)); return -ENOMEM; } - if (ipa_client_link_open(rsl_link) < 0) { + if (ipa_client_conn_open(rsl_link) < 0) { LOGP(DLINP, LOGL_ERROR, "cannot open RSL BTS link: %s\n", strerror(errno)); - ipa_client_link_close(rsl_link); - ipa_client_link_destroy(rsl_link); + ipa_client_conn_close(rsl_link); + ipa_client_conn_destroy(rsl_link); return -EIO; } ret = 0; diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c index dadfd2f..6f2525a 100644 --- a/src/ipa_proxy.c +++ b/src/ipa_proxy.c @@ -104,15 +104,15 @@ enum ipa_conn_state { struct ipa_proxy_conn { struct llist_head head; - struct ipa_server_peer *src; - struct ipa_client_link *dst; + struct ipa_server_conn *src; + struct ipa_client_conn *dst; struct ipa_proxy_route *route; }; /* * socket callbacks used by IPA VTY commands */ -static int ipa_sock_dst_cb(struct ipa_client_link *link, struct msgb *msg) +static int ipa_sock_dst_cb(struct ipa_client_conn *link, struct msgb *msg) { struct ipaccess_head *hh; struct ipa_proxy_conn *conn = link->data; @@ -132,11 +132,11 @@ static int ipa_sock_dst_cb(struct ipa_client_link *link, struct msgb *msg) /* mangle message, if required. */ hh->proto = conn->route->shared->src.streamid[hh->proto]; - ipa_server_peer_send(conn->src, msg); + ipa_server_conn_send(conn->src, msg); return 0; } -static int ipa_sock_src_cb(struct ipa_server_peer *peer, struct msgb *msg) +static int ipa_sock_src_cb(struct ipa_server_conn *peer, struct msgb *msg) { struct ipaccess_head *hh; struct ipa_proxy_conn *conn = peer->data; @@ -155,7 +155,7 @@ static int ipa_sock_src_cb(struct ipa_server_peer *peer, struct msgb *msg) /* mangle message, if required. */ hh->proto = conn->route->shared->dst.streamid[hh->proto]; - ipa_client_link_send(conn->dst, msg); + ipa_client_conn_send(conn->dst, msg); return 0; } @@ -175,7 +175,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) } conn->route = route; - conn->src = ipa_server_peer_create(tall_ipa_proxy_ctx, link, fd, + conn->src = ipa_server_conn_create(tall_ipa_proxy_ctx, link, fd, ipa_sock_src_cb, conn); if (conn->src == NULL) { LOGP(DLINP, LOGL_ERROR, "could not create server peer: %s\n", @@ -185,7 +185,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) LOGP(DLINP, LOGL_NOTICE, "now trying to connect to destination\n"); - conn->dst = ipa_client_link_create(NULL, NULL, 0, + conn->dst = ipa_client_conn_create(NULL, NULL, 0, route->shared->dst.inst->net.addr, route->shared->dst.inst->net.port, NULL, @@ -197,7 +197,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) strerror(errno)); return -ENOMEM; } - if (ipa_client_link_open(conn->dst) < 0) { + if (ipa_client_conn_open(conn->dst) < 0) { LOGP(DLINP, LOGL_ERROR, "could not start client: %s\n", strerror(errno)); return -ENOMEM; @@ -546,7 +546,7 @@ DEFUN(ipa_route_del, ipa_route_del_cmd, /* nobody else using this route, release all resources. */ llist_for_each_entry_safe(conn, tmp, &matching_route->shared->conn_list, head) { - ipa_server_peer_destroy(conn->src); + ipa_server_conn_destroy(conn->src); llist_del(&conn->head); talloc_free(conn); } -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:36:57 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:57 +0200 Subject: [PATCH 3/7] tests: remove reference to internal headers in ipa_proxy_test In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-4-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This example has to compile out of the tree, including internal.h is not required and using PACKAGE_VERSION here, which is internal to the library, does not seem to me like a good idea. --- tests/ipa_proxy_test.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/tests/ipa_proxy_test.c b/tests/ipa_proxy_test.c index 6288a3a..2ed30ff 100644 --- a/tests/ipa_proxy_test.c +++ b/tests/ipa_proxy_test.c @@ -8,8 +8,6 @@ #include #include #include -#include "internal.h" -#include "config.h" static void *tall_test; @@ -52,7 +50,7 @@ static enum node_type bsc_vty_go_parent(struct vty *vty) static struct vty_app_info vty_info = { .name = "ipa-proxy-test", - .version = PACKAGE_VERSION, + .version = "1.0", .go_parent_cb = bsc_vty_go_parent, .is_config_node = bsc_vty_is_config_node, }; -- 1.7.2.5 From holger at freyther.de Sun Sep 11 21:42:46 2011 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Sun, 11 Sep 2011 23:42:46 +0200 Subject: [PATCH 3/7] tests: remove reference to internal headers in ipa_proxy_test In-Reply-To: <1315528621-12948-4-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> <1315528621-12948-4-git-send-email-pablo@gnumonks.org> Message-ID: <4E6D2B56.3060505@freyther.de> On 09/09/2011 02:36 AM, pablo at gnumonks.org wrote: > From: Pablo Neira Ayuso > > This example has to compile out of the tree, including internal.h > is not required and using PACKAGE_VERSION here, which is internal > to the library, does not seem to me like a good idea. Hi Pablo, why should it compile out of tree? Ideally it would be hooked into make check and use GNU autotest (to match test output with expected results). In case we want to have it as an example, I think we could move it into a/the documentation folder and somehow include it in doxygen documentation? holger From pablo at gnumonks.org Mon Sep 12 08:09:52 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Mon, 12 Sep 2011 10:09:52 +0200 Subject: [PATCH 3/7] tests: remove reference to internal headers in ipa_proxy_test In-Reply-To: <4E6D2B56.3060505@freyther.de> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> <1315528621-12948-4-git-send-email-pablo@gnumonks.org> <4E6D2B56.3060505@freyther.de> Message-ID: <20110912080952.GA1890@1984> Hi Holger, On Sun, Sep 11, 2011 at 11:42:46PM +0200, Holger Hans Peter Freyther wrote: > On 09/09/2011 02:36 AM, pablo at gnumonks.org wrote: > > From: Pablo Neira Ayuso > > > > This example has to compile out of the tree, including internal.h > > is not required and using PACKAGE_VERSION here, which is internal > > to the library, does not seem to me like a good idea. > > why should it compile out of tree? Ideally it would be hooked into make check > and use GNU autotest (to match test output with expected results). Although they are integrated in the build system, they are examples. Thus, someone may take of those files and use part of it to integrate it into the own application. That's why I think it's a good idea that they can be compiled out of tree. > In case we > want to have it as an example, I think we could move it into a/the > documentation folder and somehow include it in doxygen documentation? Probably test is not a good name for the folder, we could rename it to utils/ or examples/. I can add some note in the documentation to tell about these examples. I'll add these to my "to do" list. From pablo at gnumonks.org Fri Sep 9 00:36:58 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:58 +0200 Subject: [PATCH 4/7] ipa: use default write callback in ipa_client_conn_create if not specified In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-5-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso If no write callback is specified, use the default write callback. Thus, we don't need to export ipa_client_write_default_cb. No clients of this function outside libosmo-abis, so no breakages should be expected. --- include/osmocom/abis/ipa.h | 2 -- src/input/ipa.c | 6 ++++-- src/ipa_proxy.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index fdf4b66..43422dc 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -57,8 +57,6 @@ struct ipa_client_conn { struct ipa_client_conn *ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, int priv_nr, const char *addr, uint16_t port, int (*connect)(struct ipa_client_conn *link), int (*read_cb)(struct ipa_client_conn *link, struct msgb *msgb), int (*write_cb)(struct ipa_client_conn *link), void *data); void ipa_client_conn_destroy(struct ipa_client_conn *link); -int ipa_client_write_default_cb(struct ipa_client_conn *link); - int ipa_client_conn_open(struct ipa_client_conn *link); void ipa_client_conn_close(struct ipa_client_conn *link); diff --git a/src/input/ipa.c b/src/input/ipa.c index 020a730..774d578 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -139,7 +139,7 @@ static void ipa_client_write(struct ipa_client_conn *link) link->write_cb(link); } -int ipa_client_write_default_cb(struct ipa_client_conn *link) +static int ipa_client_write_default_cb(struct ipa_client_conn *link) { struct osmo_fd *ofd = link->ofd; struct msgb *msg; @@ -244,7 +244,9 @@ ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, ipa_link->port = port; ipa_link->connect_cb = connect_cb; ipa_link->read_cb = read_cb; - ipa_link->write_cb = write_cb; + /* default to generic write callback if not set. */ + if (write_cb == NULL) + ipa_link->write_cb = ipa_client_write_default_cb; ipa_link->line = ts->line; ipa_link->data = data; INIT_LLIST_HEAD(&ipa_link->tx_queue); diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c index 6f2525a..f4e1df8 100644 --- a/src/ipa_proxy.c +++ b/src/ipa_proxy.c @@ -190,7 +190,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) route->shared->dst.inst->net.port, NULL, ipa_sock_dst_cb, - ipa_client_write_default_cb, + NULL, conn); if (conn->dst == NULL) { LOGP(DLINP, LOGL_ERROR, "could not create client: %s\n", -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:36:59 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:36:59 +0200 Subject: [PATCH 5/7] ipa: fix segfault in ipa_client_conn_create if no E1 timeslot is specified In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-6-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Fix segfault if IPA client is not used as signalling link (in that case E1 timeslot is NULL). --- src/input/ipa.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/input/ipa.c b/src/input/ipa.c index 774d578..4773dff 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -247,7 +247,8 @@ ipa_client_conn_create(void *ctx, struct e1inp_ts *ts, /* default to generic write callback if not set. */ if (write_cb == NULL) ipa_link->write_cb = ipa_client_write_default_cb; - ipa_link->line = ts->line; + if (ts) + ipa_link->line = ts->line; ipa_link->data = data; INIT_LLIST_HEAD(&ipa_link->tx_queue); -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:37:00 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:37:00 +0200 Subject: [PATCH 6/7] ipa: better log error messages for ipa_msg_recv() In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-7-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso More descriptive errors help to debug problems. --- src/input/ipa.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input/ipa.c b/src/input/ipa.c index 4773dff..a519f07 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -63,6 +63,7 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) msgb_free(msg); return ret; } else if (ret != sizeof(*hh)) { + LOGP(DLINP, LOGL_ERROR, "too small message received\n"); msgb_free(msg); return -EIO; } @@ -73,6 +74,8 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) len = ntohs(hh->len); if (len < 0 || IPA_ALLOC_SIZE < len + sizeof(*hh)) { + LOGP(DLINP, LOGL_ERROR, "bad message length of %d bytes, " + "received %d bytes\n", len, ret); msgb_free(msg); return -EIO; } @@ -82,6 +85,7 @@ int ipa_msg_recv(int fd, struct msgb **rmsg) msgb_free(msg); return ret; } else if (ret < len) { + LOGP(DLINP, LOGL_ERROR, "trunked message received\n"); msgb_free(msg); return -EIO; } @@ -119,8 +123,6 @@ static void ipa_client_read(struct ipa_client_conn *link) if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, "lost connection with server\n"); - } else { - LOGP(DLINP, LOGL_ERROR, "unknown error\n"); } ipa_client_retry(link); return; @@ -387,8 +389,6 @@ static void ipa_server_conn_read(struct ipa_server_conn *conn) if (ret < 0) { if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, "lost connection with server\n"); - } else { - LOGP(DLINP, LOGL_ERROR, "unknown error\n"); } return; } else if (ret == 0) { -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 00:37:01 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 02:37:01 +0200 Subject: [PATCH 7/7] ipa: use DEBUG level instead of NOTICE for debugging log messages In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315528621-12948-8-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Use DEBUG instead of NOTICE for several messages that are actually used for debugging purposes. --- src/input/ipa.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/input/ipa.c b/src/input/ipa.c index a519f07..2441de4 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -117,7 +117,7 @@ static void ipa_client_read(struct ipa_client_conn *link) struct msgb *msg; int ret; - LOGP(DLINP, LOGL_NOTICE, "message received\n"); + LOGP(DLINP, LOGL_DEBUG, "message received\n"); ret = ipa_msg_recv(ofd->fd, &msg); if (ret < 0) { @@ -148,7 +148,7 @@ static int ipa_client_write_default_cb(struct ipa_client_conn *link) struct llist_head *lh; int ret; - LOGP(DLINP, LOGL_NOTICE, "sending data\n"); + LOGP(DLINP, LOGL_DEBUG, "sending data\n"); if (llist_empty(&link->tx_queue)) { ofd->when &= ~BSC_FD_WRITE; @@ -190,11 +190,11 @@ static int ipa_client_fd_cb(struct osmo_fd *ofd, unsigned int what) break; case IPA_CLIENT_LINK_STATE_CONNECTED: if (what & BSC_FD_READ) { - LOGP(DLINP, LOGL_NOTICE, "connected read\n"); + LOGP(DLINP, LOGL_DEBUG, "connected read\n"); ipa_client_read(link); } if (what & BSC_FD_WRITE) { - LOGP(DLINP, LOGL_NOTICE, "connected write\n"); + LOGP(DLINP, LOGL_DEBUG, "connected write\n"); ipa_client_write(link); } break; @@ -383,7 +383,7 @@ static void ipa_server_conn_read(struct ipa_server_conn *conn) struct msgb *msg; int ret; - LOGP(DLINP, LOGL_NOTICE, "message received\n"); + LOGP(DLINP, LOGL_DEBUG, "message received\n"); ret = ipa_msg_recv(ofd->fd, &msg); if (ret < 0) { @@ -409,7 +409,7 @@ static void ipa_server_conn_write(struct ipa_server_conn *conn) struct llist_head *lh; int ret; - LOGP(DLINP, LOGL_NOTICE, "sending data\n"); + LOGP(DLINP, LOGL_DEBUG, "sending data\n"); if (llist_empty(&conn->tx_queue)) { ofd->when &= ~BSC_FD_WRITE; @@ -430,7 +430,7 @@ static int ipa_server_conn_cb(struct osmo_fd *ofd, unsigned int what) { struct ipa_server_conn *conn = ofd->data; - LOGP(DLINP, LOGL_NOTICE, "connected read/write\n"); + LOGP(DLINP, LOGL_DEBUG, "connected read/write\n"); if (what & BSC_FD_READ) ipa_server_conn_read(conn); if (what & BSC_FD_WRITE) -- 1.7.2.5 From laforge at gnumonks.org Fri Sep 9 08:33:09 2011 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 9 Sep 2011 10:33:09 +0200 Subject: [PATCH 0/7] libosmo-abis: updates for generic IPA infrastructure In-Reply-To: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> References: <1315528621-12948-1-git-send-email-pablo@gnumonks.org> Message-ID: <20110909083309.GV30888@prithivi.gnumonks.org> Hi Pablo, thanks for your patches On Fri, Sep 09, 2011 at 02:36:54AM +0200, pablo at gnumonks.org wrote: > This patchset contains several updates for the generic IPA > infrastructure which provides an abstraction upon the generic > socket infrastructure for IPA traffic. thanks, merged. (though I think the rename from ipa_socket_peer to ipa_socket_conn was somewhat unneeded). -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From pablo at gnumonks.org Fri Sep 9 01:05:26 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 03:05:26 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates Message-ID: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Hi, These patchset contains the port of libctrl to use the IPA infrastructure available in libosmo-abis. I've also made one small cleanup to bail out in case that we cannot bind to the telnet port. Another patch follows up to avoid disabling nagle (to avoid problems with TCP segmentation, we still have to support this appropriately), I noticed this while doing the port work. Pablo Neira Ayuso (3): ctrl: use generic IPA socket infrastructure available in libosmo-abis src: check for error returned by controlif_setup() ctrl: do not disable nagle algorithm until we fully support segmentation openbsc/include/openbsc/control_cmd.h | 17 +--- openbsc/include/openbsc/control_if.h | 2 +- openbsc/src/libctrl/control_if.c | 153 +++++++-------------------------- openbsc/src/osmo-bsc/osmo_bsc_main.c | 6 +- openbsc/src/osmo-bsc_nat/bsc_nat.c | 6 +- openbsc/src/osmo-nitb/bsc_hack.c | 5 +- 6 files changed, 50 insertions(+), 139 deletions(-) -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 01:05:27 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 03:05:27 +0200 Subject: [PATCH 1/3] ctrl: use generic IPA socket infrastructure available in libosmo-abis In-Reply-To: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315530329-15454-2-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This patch puts libctrl into diet by using the generic IPA socket infrastructure available in libosmo-abis. We save 93 lines of code with this and we remove the use of the deprecated socket infrastructure like make_sock(...). --- openbsc/include/openbsc/control_cmd.h | 17 +---- openbsc/include/openbsc/control_if.h | 2 +- openbsc/src/libctrl/control_if.c | 148 ++++++++------------------------- 3 files changed, 37 insertions(+), 130 deletions(-) diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index 2a5391f..87db33f 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -29,21 +29,8 @@ enum ctrl_type { 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; + struct ipa_server_conn *ipa_link; enum ctrl_type type; char *id; void *node; @@ -74,7 +61,7 @@ struct ctrl_cmd_map { 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); +int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, 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); diff --git a/openbsc/include/openbsc/control_if.h b/openbsc/include/openbsc/control_if.h index 96fbf6b..50ab962 100644 --- a/openbsc/include/openbsc/control_if.h +++ b/openbsc/include/openbsc/control_if.h @@ -5,7 +5,7 @@ #include #include -int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); +int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, struct ctrl_cmd *cmd); int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data); int controlif_setup(struct gsm_network *gsmnet, uint16_t port); diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index 8198ae6..58476ec 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -63,15 +63,14 @@ #include struct ctrl_handle { - struct osmo_fd listen_fd; + struct ipa_server_link *ipa_link; struct gsm_network *gsmnet; }; vector ctrl_node_vec; -int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) +int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, struct ctrl_cmd *cmd) { - int ret; struct msgb *msg; msg = ctrl_cmd_make(cmd); @@ -83,12 +82,8 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) ipaccess_prepend_header_ext(msg, IPAC_PROTO_EXT_CTRL); ipaccess_prepend_header(msg, IPAC_PROTO_OSMO); - ret = osmo_wqueue_enqueue(queue, msg); - if (ret != 0) { - LOGP(DCTRL, LOGL_ERROR, "Failed to enqueue the command.\n"); - msgb_free(msg); - } - return ret; + ipa_server_conn_send(ipa_server_conn, msg); + return 0; } int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data) @@ -192,43 +187,14 @@ err: return ret; } -static void control_close_conn(struct ctrl_connection *ccon) -{ - close(ccon->write_queue.bfd.fd); - osmo_fd_unregister(&ccon->write_queue.bfd); - if (ccon->closed_cb) - ccon->closed_cb(ccon); - talloc_free(ccon); -} - -static int handle_control_read(struct osmo_fd * bfd) +static int +handle_control_read(struct ipa_server_conn *ipa_server_conn, struct msgb *msg) { int ret = -1; - struct osmo_wqueue *queue; - struct ctrl_connection *ccon; struct ipaccess_head *iph; struct ipaccess_head_ext *iph_ext; - struct msgb *msg; struct ctrl_cmd *cmd; - struct ctrl_handle *ctrl = bfd->data; - - queue = container_of(bfd, struct osmo_wqueue, bfd); - ccon = container_of(queue, struct ctrl_connection, write_queue); - - ret = ipa_msg_recv(bfd->fd, &msg); - if (ret <= 0) { - if (ret == 0) - LOGP(DCTRL, LOGL_INFO, "The control connection was closed\n"); - else - LOGP(DCTRL, LOGL_ERROR, "Failed to parse ip access message: %d\n", ret); - - goto err; - } - - if (msg->len < sizeof(*iph) + sizeof(*iph_ext)) { - LOGP(DCTRL, LOGL_ERROR, "The message is too short.\n"); - goto err; - } + struct ctrl_handle *ctrl = ipa_server_conn->data; iph = (struct ipaccess_head *) msg->data; if (iph->proto != IPAC_PROTO_OSMO) { @@ -244,23 +210,23 @@ static int handle_control_read(struct osmo_fd * bfd) msg->l2h = iph_ext->data; - cmd = ctrl_cmd_parse(ccon, msg); + cmd = ctrl_cmd_parse(ipa_server_conn, msg); if (cmd) { - cmd->ccon = ccon; + cmd->ipa_link = ipa_server_conn; if (ctrl_cmd_handle(cmd, ctrl->gsmnet) != CTRL_CMD_HANDLED) { - ctrl_cmd_send(queue, cmd); + ctrl_cmd_send(ipa_server_conn, cmd); talloc_free(cmd); } } else { - cmd = talloc_zero(ccon, struct ctrl_cmd); + cmd = talloc_zero(ipa_server_conn, struct ctrl_cmd); if (!cmd) goto err; LOGP(DCTRL, LOGL_ERROR, "Command parser error.\n"); cmd->type = CTRL_TYPE_ERROR; cmd->id = "err"; cmd->reply = "Command parser error."; - ctrl_cmd_send(queue, cmd); + ctrl_cmd_send(ipa_server_conn, cmd); talloc_free(cmd); } @@ -268,82 +234,31 @@ static int handle_control_read(struct osmo_fd * bfd) return 0; err: - control_close_conn(ccon); + ipa_server_conn_destroy(ipa_server_conn); msgb_free(msg); return ret; } -static int control_write_cb(struct osmo_fd *bfd, struct msgb *msg) -{ - int rc; - - rc = write(bfd->fd, msg->data, msg->len); - if (rc != msg->len) - LOGP(DCTRL, LOGL_ERROR, "Failed to write message to the control connection.\n"); - - return rc; -} - -static struct ctrl_connection *ctrl_connection_alloc(void *ctx) -{ - struct ctrl_connection *ccon = talloc_zero(ctx, struct ctrl_connection); - if (!ccon) - return NULL; - - osmo_wqueue_init(&ccon->write_queue, 100); - /* Error handling here? */ - - INIT_LLIST_HEAD(&ccon->cmds); - return ccon; -} - -static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what) +static int ctrl_accept_cb(struct ipa_server_link *ipa_link, int fd) { - int ret, fd, on; - struct ctrl_connection *ccon; - struct sockaddr_in sa; - socklen_t sa_len = sizeof(sa); - - - if (!(what & BSC_FD_READ)) - return 0; - - fd = accept(listen_bfd->fd, (struct sockaddr *) &sa, &sa_len); - if (fd < 0) { - perror("accept"); - return fd; - } - LOGP(DCTRL, LOGL_INFO, "accept()ed new control connection from %s\n", - inet_ntoa(sa.sin_addr)); + int ret, on = 1; + struct ipa_server_conn *ipa_peer_link; - on = 1; ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); if (ret != 0) { LOGP(DNAT, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno)); close(fd); return ret; } - ccon = ctrl_connection_alloc(listen_bfd->data); - if (!ccon) { - LOGP(DCTRL, LOGL_ERROR, "Failed to allocate.\n"); - close(fd); - return -1; - } - - ccon->write_queue.bfd.data = listen_bfd->data; - ccon->write_queue.bfd.fd = fd; - ccon->write_queue.bfd.when = BSC_FD_READ; - ccon->write_queue.read_cb = handle_control_read; - ccon->write_queue.write_cb = control_write_cb; - - ret = osmo_fd_register(&ccon->write_queue.bfd); - if (ret < 0) { - LOGP(DCTRL, LOGL_ERROR, "Could not register FD.\n"); - close(ccon->write_queue.bfd.fd); - talloc_free(ccon); + ipa_peer_link = ipa_server_conn_create(tall_bsc_ctx, ipa_link, fd, + handle_control_read, + ipa_link->data); + if (!ipa_peer_link) { + LOGP(DCTRL, LOGL_ERROR, "Failed to register peer connection.\n"); + return -ENOMEM; } - return ret; + return 0; } static uint64_t get_rate_ctr_value(const struct rate_ctr *ctr, int intv) @@ -601,7 +516,6 @@ static int verify_counter(struct ctrl_cmd *cmd, const char *value, void *data) int controlif_setup(struct gsm_network *gsmnet, uint16_t port) { - int ret; struct ctrl_handle *ctrl; ctrl = talloc_zero(tall_bsc_ctx, struct ctrl_handle); @@ -615,15 +529,21 @@ int controlif_setup(struct gsm_network *gsmnet, uint16_t port) return -ENOMEM; /* Listen for control connections */ - ret = make_sock(&ctrl->listen_fd, IPPROTO_TCP, INADDR_LOOPBACK, port, - 0, listen_fd_cb, ctrl); - if (ret < 0) { + ctrl->ipa_link = ipa_server_link_create(ctrl, NULL, + "127.0.0.1", port, + ctrl_accept_cb, ctrl); + if (!ctrl->ipa_link) { talloc_free(ctrl); - return ret; + return -ENOMEM; + } + + if (ipa_server_link_open(ctrl->ipa_link) < 0) { + talloc_free(ctrl); + return -EIO; } ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_rate_ctr); ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_counter); - return ret; + return 0; } -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 01:05:28 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 03:05:28 +0200 Subject: [PATCH 2/3] src: check for error returned by controlif_setup() In-Reply-To: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315530329-15454-3-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Bail out in case that we cannot bind the telnet interface. --- openbsc/src/osmo-bsc/osmo_bsc_main.c | 6 +++++- openbsc/src/osmo-bsc_nat/bsc_nat.c | 6 +++++- openbsc/src/osmo-nitb/bsc_hack.c | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index 9a799c0..fe6526d 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -422,7 +422,11 @@ int main(int argc, char **argv) } bsc_api_init(bsc_gsmnet, osmo_bsc_api()); - controlif_setup(bsc_gsmnet, 4249); + if (controlif_setup(bsc_gsmnet, 4249) < 0) { + fprintf(stderr, "CTRL: Cannot bind to port 4249\n"); + exit(1); + } + ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_loc); ctrl_cmd_install(CTRL_NODE_NET, &cmd_net_rf_lock); ctrl_cmd_install(CTRL_NODE_TRX, &cmd_trx_rf_lock); diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 295535a..326d04e 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -1760,7 +1760,11 @@ int main(int argc, char **argv) exit(1); } - controlif_setup(NULL, 4250); + if (controlif_setup(NULL, 4250) < 0) { + fprintf(stderr, "CTRL: Cannot bind to port 4250\n"); + exit(1); + } + ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_fwd_cmd); nat->msc_con->connection_loss = msc_connection_was_lost; diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c index 001d8f9..5f9b7e5 100644 --- a/openbsc/src/osmo-nitb/bsc_hack.c +++ b/openbsc/src/osmo-nitb/bsc_hack.c @@ -254,7 +254,10 @@ int main(int argc, char **argv) exit(1); bsc_api_init(bsc_gsmnet, msc_bsc_api()); - controlif_setup(bsc_gsmnet, 4249); + if (controlif_setup(bsc_gsmnet, 4249) < 0) { + fprintf(stderr, "CTRL: Cannot bind to port 4249\n"); + exit(1); + } /* seed the PRNG */ srand(time(NULL)); -- 1.7.2.5 From pablo at gnumonks.org Fri Sep 9 01:05:29 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Fri, 9 Sep 2011 03:05:29 +0200 Subject: [PATCH 3/3] ctrl: do not disable nagle algorithm until we fully support segmentation In-Reply-To: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> Message-ID: <1315530329-15454-4-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso We shouldn't disable nagle, we have to finish TCP segmentation support appropriately first. --- openbsc/src/libctrl/control_if.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index 58476ec..7e2ae16 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -241,15 +241,8 @@ err: static int ctrl_accept_cb(struct ipa_server_link *ipa_link, int fd) { - int ret, on = 1; struct ipa_server_conn *ipa_peer_link; - ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)); - if (ret != 0) { - LOGP(DNAT, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno)); - close(fd); - return ret; - } ipa_peer_link = ipa_server_conn_create(tall_bsc_ctx, ipa_link, fd, handle_control_read, ipa_link->data); -- 1.7.2.5 From laforge at gnumonks.org Fri Sep 9 08:21:03 2011 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 9 Sep 2011 10:21:03 +0200 Subject: [PATCH 3/3] ctrl: do not disable nagle algorithm until we fully support segmentation In-Reply-To: <1315530329-15454-4-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> <1315530329-15454-4-git-send-email-pablo@gnumonks.org> Message-ID: <20110909082103.GU30888@prithivi.gnumonks.org> Hi Pablo, thanks for your patches. On Fri, Sep 09, 2011 at 03:05:29AM +0200, pablo at gnumonks.org wrote: > We shouldn't disable nagle, we have to finish TCP segmentation > support appropriately first. I would like to hear Daniel's comment on those patches, particularly on the reason he was disabling nagle... -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From pablo at gnumonks.org Fri Sep 9 01:14:00 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Fri, 9 Sep 2011 03:14:00 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> Message-ID: <20110909011400.GA4838@1984> On Fri, Sep 09, 2011 at 03:05:26AM +0200, pablo at gnumonks.org wrote: > From: Pablo Neira Ayuso > > Hi, > > These patchset contains the port of libctrl to use the IPA > infrastructure available in libosmo-abis. > > I've also made one small cleanup to bail out in case that > we cannot bind to the telnet port. Another patch follows up > to avoid disabling nagle (to avoid problems with TCP > segmentation, we still have to support this appropriately), > I noticed this while doing the port work. > > Pablo Neira Ayuso (3): > ctrl: use generic IPA socket infrastructure available in libosmo-abis > src: check for error returned by controlif_setup() > ctrl: do not disable nagle algorithm until we fully support > segmentation I forgot to say that they are available in the pablo/ctrl-updates branch. BTW, I have used the following command line interactive client to test the changes. I made it because I wanted to test the IPA socket infrastructure from the client side. Just in case you find it of any use. You can find it attached. -------------- next part -------------- A non-text attachment was scrubbed... Name: interative-ctrl.c Type: text/x-csrc Size: 3018 bytes Desc: not available URL: From daniel at totalueberwachung.de Fri Sep 9 13:51:08 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Fri, 09 Sep 2011 15:51:08 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: <20110909011400.GA4838@1984> (sfid-20110909_031410_482479_37DFFD12) References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> <20110909011400.GA4838@1984> (sfid-20110909_031410_482479_37DFFD12) Message-ID: Pablo Neira Ayuso wrote: >On Fri, Sep 09, 2011 at 03:05:26AM +0200, pablo at gnumonks.org wrote: >> From: Pablo Neira Ayuso >> >> Hi, >> >> These patchset contains the port of libctrl to use the IPA >> infrastructure available in libosmo-abis. >> >> I've also made one small cleanup to bail out in case that >> we cannot bind to the telnet port. Another patch follows up >> to avoid disabling nagle (to avoid problems with TCP >> segmentation, we still have to support this appropriately), >> I noticed this while doing the port work. Thanks Pablo, I'll take a look at them tonight. Not sure about the nodelay issue, I think it was an issue of doing it similar to other places in the code, but I'll check. Regards, Daniel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. From pablo at gnumonks.org Sat Sep 10 13:57:09 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Sat, 10 Sep 2011 15:57:09 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> <20110909011400.GA4838@1984> Message-ID: <20110910135709.GA18386@1984> On Fri, Sep 09, 2011 at 03:51:08PM +0200, Daniel Willmann wrote: > Pablo Neira Ayuso wrote: > > >On Fri, Sep 09, 2011 at 03:05:26AM +0200, pablo at gnumonks.org wrote: > >> From: Pablo Neira Ayuso > >> > >> Hi, > >> > >> These patchset contains the port of libctrl to use the IPA > >> infrastructure available in libosmo-abis. > >> > >> I've also made one small cleanup to bail out in case that > >> we cannot bind to the telnet port. Another patch follows up > >> to avoid disabling nagle (to avoid problems with TCP > >> segmentation, we still have to support this appropriately), > >> I noticed this while doing the port work. > > Thanks Pablo, I'll take a look at them tonight. Not sure about the nodelay issue, I think it was an issue of doing it similar to other places in the code, but I'll check. The LOGP call in the code to disable nagle was using DNAT logging level, so I guess it's a leftover. I still think we have to remove this option until we fully support TCP segmentation (I'm working on some patches for that, they will come but until that not sure what's the benefit of disabling nagle anyway). Wait for your comments! From holger at freyther.de Sun Sep 11 05:22:14 2011 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Sun, 11 Sep 2011 07:22:14 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: <20110909011400.GA4838@1984> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> <20110909011400.GA4838@1984> Message-ID: <4E6C4586.6080707@freyther.de> On 09/09/2011 03:14 AM, Pablo Neira Ayuso wrote: >> I've also made one small cleanup to bail out in case that >> we cannot bind to the telnet port. Another patch follows up >> to avoid disabling nagle (to avoid problems with TCP >> segmentation, we still have to support this appropriately), >> I noticed this while doing the port work. Hi Pablo, besides having problems with TCP Segmentation in the reading code of the ipaccess socket the NODELAY setsockopt was added to send out messages more quickly. holger From daniel at totalueberwachung.de Sat Sep 10 15:14:58 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Sat, 10 Sep 2011 17:14:58 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> Message-ID: <20110910171458.4f2bc3ed@adrastea.totalueberwachung.de> Hello Pablo, sorry, but this is going to take me longer than I previously thought. Just some short remarks on what I noticed so far. After Tuesday I'll have more time on my hands to help with porting. On Fri, 9 Sep 2011 03:05:26 +0200 pablo at gnumonks.org wrote: > From: Pablo Neira Ayuso > > These patchset contains the port of libctrl to use the IPA > infrastructure available in libosmo-abis. > I've also made one small cleanup to bail out in case that > we cannot bind to the telnet port. Another patch follows up > to avoid disabling nagle (to avoid problems with TCP > segmentation, we still have to support this appropriately), > I noticed this while doing the port work. First of all thanks for starting the port. I had a brief look into that a week ago, but ran into different problems. > Pablo Neira Ayuso (3): > ctrl: use generic IPA socket infrastructure available in > libosmo-abis The control commands need to be sent both over the dedicated control connection as well as between osmo-bsc and nat. It seems that the bsc_msc_connection is still using osmo_wqueues which complicates matters as I originally just used ctrl_cmd_send to send the response to whatever osmo_wqueue the command came in from or forward commands from the nat to the appropriate osmo-bsc. bsc_nat also needs to know if a a control connection is closed so it can remove any commands pending response from the pending list. The list is needed to generate errors if the msc_bsc connection is reset or a timeout occurs while a command is in transit. Could you add a callback to ipa_server_conn that gets called if the connection is closed? > src: check for error returned by controlif_setup() That's certainly useful, thanks. > ctrl: do not disable nagle algorithm until we fully support > segmentation I had a look at commit 4462f8 and I believe I just tried to mimic the behavior of msc_connection_connected() from ./osmo-bsc/osmo_bsc_msc.c at that time. Anyway, I'd be interested in the problems you encountered. I know that ipaccess_read_msg mishandled the case where the data read returned only a partial packet, but shouldn't that only occur if the data to be sent is larger than the current MSS? In any case I would have expected disabling the nagle algorithm to help in that regard... So I guess there's still some work to do. I'll reserve some time on Thursday to look at the issues. Regards, Daniel Willmann From pablo at gnumonks.org Sun Sep 11 11:04:05 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Sun, 11 Sep 2011 13:04:05 +0200 Subject: [PATCH 0/3] openbsc: ctrl updates In-Reply-To: <20110910171458.4f2bc3ed@adrastea.totalueberwachung.de> References: <1315530329-15454-1-git-send-email-pablo@gnumonks.org> <20110910171458.4f2bc3ed@adrastea.totalueberwachung.de> Message-ID: <20110911110405.GA22952@1984> Hi Daniel, On Sat, Sep 10, 2011 at 05:14:58PM +0200, Daniel Willmann wrote: > Hello Pablo, > > sorry, but this is going to take me longer than I previously thought. No problem, we're not in the rush :-). > Just some short remarks on what I noticed so far. After Tuesday I'll > have more time on my hands to help with porting. > > On Fri, 9 Sep 2011 03:05:26 +0200 > pablo at gnumonks.org wrote: > > > From: Pablo Neira Ayuso > > > > These patchset contains the port of libctrl to use the IPA > > infrastructure available in libosmo-abis. > > > I've also made one small cleanup to bail out in case that > > we cannot bind to the telnet port. Another patch follows up > > to avoid disabling nagle (to avoid problems with TCP > > segmentation, we still have to support this appropriately), > > I noticed this while doing the port work. > > First of all thanks for starting the port. I had a brief look into that > a week ago, but ran into different problems. > > > Pablo Neira Ayuso (3): > > ctrl: use generic IPA socket infrastructure available in > > libosmo-abis > > The control commands need to be sent both over the dedicated control > connection as well as between osmo-bsc and nat. It seems that the > bsc_msc_connection is still using osmo_wqueues which complicates > matters as I originally just used ctrl_cmd_send to send the response to > whatever osmo_wqueue the command came in from or forward commands from > the nat to the appropriate osmo-bsc. Can you come with some idea to overcome this situation? Probably we can use osmo_wqueues in the generic IPA infrastructure, let me give it some spins. > bsc_nat also needs to know if a a control connection is closed so it > can remove any commands pending response from the pending list. The > list is needed to generate errors if the msc_bsc connection is reset or > a timeout occurs while a command is in transit. Could you add a > callback to ipa_server_conn that gets called if the connection is > closed? Sure, we can add that. The idea is to make the IPA infrastructure generic enough so we can use in as many places as we can. > > src: check for error returned by controlif_setup() > > That's certainly useful, thanks. > > > ctrl: do not disable nagle algorithm until we fully support > > segmentation > > I had a look at commit 4462f8 and I believe I just tried to mimic the > behavior of msc_connection_connected() from ./osmo-bsc/osmo_bsc_msc.c > at that time. > > Anyway, I'd be interested in the problems you encountered. I know that > ipaccess_read_msg mishandled the case where the data read returned only > a partial packet, but shouldn't that only occur if the data to be sent > is larger than the current MSS? In any case I would have expected > disabling the nagle algorithm to help in that regard... I think disabling nagle in that code is fine. Basically, if we disable nagle we obtain the same behaviour that in UDP sockets, which means that one send() call means one packet, and this is what we have to do by now to avoid TCP segmentation issues (that we don't handle appropriately). Drop the patch. > So I guess there's still some work to do. I'll reserve some time on > Thursday to look at the issues. Fine, count to me if I can be of any help. I'll have a look at the issues that you mentions along this week. From gary at tetrustelecoms.com Mon Sep 12 14:00:08 2011 From: gary at tetrustelecoms.com (gary mcneish) Date: Mon, 12 Sep 2011 21:00:08 +0700 Subject: Hlr openbsc Message-ID: Hi Guys Need someone with inside knowladge who wants some money. Or ideally with a system inplace I can use to perform hlr lookups I want to validate my exsisting uk mobile phone numbers. see if there on or not if there subscribed to a network. If you have a setup I can use contact me with pricing If you can build one for me, I have servers, sip trunks, money, a bit of knowledge in unix networking servers etc. I need a solution asap which Is why im posting this Please send me info gary at tetrustelecoms.com -- *Gary McNeish *Tetrus Telecoms Ltd t: 0161-408-3944 m: +66838273350 e: gary at tetrustelecoms.com w: www.tetrustelecoms.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sws at arbor.net Tue Sep 13 11:43:24 2011 From: sws at arbor.net (Stephen Siadak) Date: Tue, 13 Sep 2011 07:43:24 -0400 Subject: some issues configuring openbsc Message-ID: <4E6F41DC.9020708@arbor.net> While I think I am pretty close to getting my ip.access nanoBTS to communicate with my laptop running osmo-nitb I seem to be running into a problem. I am running openbsc-0.9.13 and using libosmocore-0.1.30 When I start osmo-nitb I see this error: ./osmo-nitb -T -c ./openbsc.cfg DB: Database initialized. DB: Database prepared. Sat Sep 10 17:39:42 2011 <0007> sms_queue.c:223 Attempting to send 20 SMS Sat Sep 10 17:39:45 2011 <000d> input/ipaccess.c:650 accept()ed new OML link from 2.2.2.1 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 8a c4 0b Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 00 00 c0 a8 ea 01 00 00 00 00 00 00 00 00 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 d4 07 c0 a8 ea 01 38 a4 45 00 04 59 40 00 Sat Sep 10 17:39:45 2011 <0005> bsc_init.c:50 Failed to set BTS attributes. That is fatal. Was the bts type and frequency properly specified? I am using one of the stock nitb configuration files with no modifications. openbsc.git/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg My setup is a little odd. I did not do the original configuration for the nanoBTS. I was hoping to just get stuff working with the current configuration before I changed anything. The nanoBTS comes up with an IP of 2.2.2.1 and expects a gateway of 2.2.2.2. So I simply configured the ip eth0 on my laptop to 2.2.2.2. Then annoyingly the nanoBTS starts looking for 3.3.3.3. Now I start getting a little hacky to try and move stuff along: ip addr add 3.3.3.3/24 dev eth0 ip route add 3.3.3.3/32 via 2.2.2.2 I am able to use ipaccess-find: ./ipaccess-find eth0 # finally shows # MAC Address='00:02:95:00:51:83' IP Address='2.2.2.1' Unit ID='1801/0/0' # Location 1='' Location 2='BTS_NBT131G' Equipment Version='165b029_58' # Software Version='168a302_v142b13d0' Unit Name='nbts-00-02-95-00-51-83' # Serial Number='00106317' I am also able to use ipaccess-config: ./ipaccess-config -u 1801/0/0 -o 2.2.2.2 -r 2.2.2.1 # Trying to connect to ip.access BTS ... # <0005> abis_nm.c:537 OC=SITE-MANAGER(00) INST=(ff,ff,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) # <0005> abis_nm.c:537 OC=BTS(01) INST=(00,ff,ff) STATE CHG: OP_STATE=Disabled # AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=BASEBAND-TRANSCEIVER(04) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # OML link established using TRX 0 # setting Unit ID to '1801/0/0' # setting primary OML link IP to '2.2.2.2' # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,00) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,01) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,02) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,03) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,04) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,05) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,06) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,07) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=RADIO-CARRIER(02) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSE(f0) INST=(00,ff,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-CELL(f1) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSVC(f2) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSVC(f2) INST=(00,01,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=BASEBAND-TRANSCEIVER(04) INST=(00,00,ff) # IPACCESS(0xf0): SET NVATTR ACK # Set the NV Attributes. # The BTS has acked the restart. Exiting. At this point I try to start osmo-nitb and receive the error I mentioned earlier: ./osmo-nitb -T -c ./openbsc.cfg DB: Database initialized. DB: Database prepared. Sat Sep 10 17:39:42 2011 <0007> sms_queue.c:223 Attempting to send 20 SMS Sat Sep 10 17:39:45 2011 <000d> input/ipaccess.c:650 accept()ed new OML link from 2.2.2.1 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 8a c4 0b Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 00 00 c0 a8 ea 01 00 00 00 00 00 00 00 00 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 d4 07 c0 a8 ea 01 38 a4 45 00 04 59 40 00 Sat Sep 10 17:39:45 2011 <0005> bsc_init.c:50 Failed to set BTS attributes. That is fatal. Was the bts type and frequency properly specified? I think the bts type is set correct in the configuration file: type nanobts I am not sure what setting actually sets the frequency. I am happy to provide more information and any help is appreciated. Thanks in advance, -Steve From holger at freyther.de Tue Sep 13 12:36:57 2011 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Tue, 13 Sep 2011 14:36:57 +0200 Subject: some issues configuring openbsc In-Reply-To: <4E6F41DC.9020708@arbor.net> References: <4E6F41DC.9020708@arbor.net> Message-ID: <4E6F4E69.1070800@freyther.de> On 09/13/2011 01:43 PM, Stephen Siadak wrote: sure what setting actually sets the frequency. > > I am happy to provide more information and any help is appreciated. arfcn. From cleb at defcon-3.net Tue Sep 13 12:41:09 2011 From: cleb at defcon-3.net (Caleb Pal) Date: Tue, 13 Sep 2011 07:41:09 -0500 Subject: some issues configuring openbsc In-Reply-To: <4E6F41DC.9020708@arbor.net> References: <4E6F41DC.9020708@arbor.net> Message-ID: <001001cc7212$6a0e4680$3e2ad380$@net> Steve, I would strongly suggest you look at your configuration file and http://openbsc.osmocom.org/trac/wiki/osmo-nitb_VTY. There are a few parameters you need to set. It appears from the output you provided that there is a mismatch between the band setting in the configuration file and what the BTS actually supports. In addition to the band setting, I would adjust the max_power_red setting for the TRX. For bench testing this allows you to decrease the TX power and coverage of the BTS so you do not attract unwanted handsets, or worse. Regards, Caleb -----Original Message----- From: openbsc-bounces at lists.osmocom.org [mailto:openbsc-bounces at lists.osmocom.org] On Behalf Of Stephen Siadak Sent: Tuesday, September 13, 2011 0643 To: openbsc at lists.osmocom.org Subject: some issues configuring openbsc While I think I am pretty close to getting my ip.access nanoBTS to communicate with my laptop running osmo-nitb I seem to be running into a problem. I am running openbsc-0.9.13 and using libosmocore-0.1.30 When I start osmo-nitb I see this error: ./osmo-nitb -T -c ./openbsc.cfg DB: Database initialized. DB: Database prepared. Sat Sep 10 17:39:42 2011 <0007> sms_queue.c:223 Attempting to send 20 SMS Sat Sep 10 17:39:45 2011 <000d> input/ipaccess.c:650 accept()ed new OML link from 2.2.2.1 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 8a c4 0b Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 00 00 c0 a8 ea 01 00 00 00 00 00 00 00 00 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 d4 07 c0 a8 ea 01 38 a4 45 00 04 59 40 00 Sat Sep 10 17:39:45 2011 <0005> bsc_init.c:50 Failed to set BTS attributes. That is fatal. Was the bts type and frequency properly specified? I am using one of the stock nitb configuration files with no modifications. openbsc.git/openbsc/doc/examples/osmo-nitb/nanobts/openbsc.cfg My setup is a little odd. I did not do the original configuration for the nanoBTS. I was hoping to just get stuff working with the current configuration before I changed anything. The nanoBTS comes up with an IP of 2.2.2.1 and expects a gateway of 2.2.2.2. So I simply configured the ip eth0 on my laptop to 2.2.2.2. Then annoyingly the nanoBTS starts looking for 3.3.3.3. Now I start getting a little hacky to try and move stuff along: ip addr add 3.3.3.3/24 dev eth0 ip route add 3.3.3.3/32 via 2.2.2.2 I am able to use ipaccess-find: ./ipaccess-find eth0 # finally shows # MAC Address='00:02:95:00:51:83' IP Address='2.2.2.1' Unit ID='1801/0/0' # Location 1='' Location 2='BTS_NBT131G' Equipment Version='165b029_58' # Software Version='168a302_v142b13d0' Unit Name='nbts-00-02-95-00-51-83' # Serial Number='00106317' I am also able to use ipaccess-config: ./ipaccess-config -u 1801/0/0 -o 2.2.2.2 -r 2.2.2.1 # Trying to connect to ip.access BTS ... # <0005> abis_nm.c:537 OC=SITE-MANAGER(00) INST=(ff,ff,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) # <0005> abis_nm.c:537 OC=BTS(01) INST=(00,ff,ff) STATE CHG: OP_STATE=Disabled # AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=BASEBAND-TRANSCEIVER(04) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # OML link established using TRX 0 # setting Unit ID to '1801/0/0' # setting primary OML link IP to '2.2.2.2' # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,00) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,01) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,02) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,03) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,04) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,05) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,06) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=CHANNEL(03) INST=(00,00,07) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=RADIO-CARRIER(02) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSE(f0) INST=(00,ff,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-CELL(f1) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSVC(f2) INST=(00,00,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=GPRS-NSVC(f2) INST=(00,01,ff) STATE CHG: # OP_STATE=Disabled AVAIL=Not installed(07) ADM=Locked # <0005> abis_nm.c:537 OC=BASEBAND-TRANSCEIVER(04) INST=(00,00,ff) # IPACCESS(0xf0): SET NVATTR ACK # Set the NV Attributes. # The BTS has acked the restart. Exiting. At this point I try to start osmo-nitb and receive the error I mentioned earlier: ./osmo-nitb -T -c ./openbsc.cfg DB: Database initialized. DB: Database prepared. Sat Sep 10 17:39:42 2011 <0007> sms_queue.c:223 Attempting to send 20 SMS Sat Sep 10 17:39:45 2011 <000d> input/ipaccess.c:650 accept()ed new OML link from 2.2.2.1 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 8a c4 0b Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 00 00 c0 a8 ea 01 00 00 00 00 00 00 00 00 Sat Sep 10 17:39:45 2011 <0004> e1_input.c:238 rsl_sendmsg: msg->trx->rsl_link == NULL: 81 81 c1 10 02 00 d4 07 c0 a8 ea 01 38 a4 45 00 04 59 40 00 Sat Sep 10 17:39:45 2011 <0005> bsc_init.c:50 Failed to set BTS attributes. That is fatal. Was the bts type and frequency properly specified? I think the bts type is set correct in the configuration file: type nanobts I am not sure what setting actually sets the frequency. I am happy to provide more information and any help is appreciated. Thanks in advance, -Steve From anishachenkunju at gmail.com Wed Sep 14 15:19:12 2011 From: anishachenkunju at gmail.com (anish achenkunju) Date: Wed, 14 Sep 2011 20:49:12 +0530 Subject: Fwd: regarding openBSC In-Reply-To: <20110913141846.GE26435@prithivi.gnumonks.org> References: <20110913141846.GE26435@prithivi.gnumonks.org> Message-ID: Hi Just ran across your blog and was interested in emulating some real traffic to Cisco GGSN code running on dynamips. Could you please provide me some references where I can start with so that i can get openBSC or openSGSN up and running? Also wondering if you have or aware of a code that emulated MS instead of having real BTS up , Thank you v.much in advance. Anish -------------- next part -------------- An HTML attachment was scrubbed... URL: From ammar_naamat1 at yahoo.com Thu Sep 15 10:32:43 2011 From: ammar_naamat1 at yahoo.com (Ammar Naamat Hameed) Date: Thu, 15 Sep 2011 03:32:43 -0700 (PDT) Subject: M3UA SLS Message-ID: <1316082763.87589.YahooMailNeo@web45215.mail.sp1.yahoo.com> Dear All,? I have a question regarding the SLS in M3UA, is the sls number mapped to the sctp stream id? ? for example, lets consider that i have sctp?association with two stream id, 1 and 2, can i send m3ua message with sls 0 mapped to sctp stread id 1, and another m3ua message with sls1 mapped to sctp stream id 2. is this correct? if not can you please help digest this issue :). Appreciate your help, Ammar ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel at totalueberwachung.de Thu Sep 15 10:56:56 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 12:56:56 +0200 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes Message-ID: Hello, attached are two patches I came across while looking at the pablo/ctrl-updates branch in OpenBSC. The first one is just a bugfix for a resource leak and the second one adds a possibility to register a callback that will notify you if the connection is lost. This is needed for the control interface as we'll need to clean up some ctrlif related things if a connection is lost. Be aware that I haven't tested this with the ctrl-updates branch since this doesn't compile yet. I did test that master still compiles and osmo-bsc/nat don't segfault on start (though openbsc doesn't seem to use ipa_server_conn at the moment). The e1inp_ipa_{bsc,bts}_test worked as well. Regards, Daniel Willmann (2): ipa: Fix resource leak if we encounter an error in ipa_server_conn_read ipa: Add a callback to detect if the server_conn was closed include/osmocom/abis/ipa.h | 3 ++- src/input/ipa.c | 6 +++++- src/ipa_proxy.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 10:56:57 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 12:56:57 +0200 Subject: [PATCH 1/2] ipa: Fix resource leak if we encounter an error in ipa_server_conn_read In-Reply-To: References: Message-ID: In case of a connection reset or protocol error we should destroy the connection as well. --- src/input/ipa.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/input/ipa.c b/src/input/ipa.c index 2441de4..c881b22 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -390,6 +390,7 @@ static void ipa_server_conn_read(struct ipa_server_conn *conn) if (errno == EPIPE || errno == ECONNRESET) { LOGP(DLINP, LOGL_ERROR, "lost connection with server\n"); } + ipa_server_conn_destroy(conn); return; } else if (ret == 0) { LOGP(DLINP, LOGL_ERROR, "connection closed with server\n"); -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 10:56:58 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 12:56:58 +0200 Subject: [PATCH 2/2] ipa: Add a callback to detect if the server_conn was closed In-Reply-To: References: Message-ID: <8d46dbd2c4b727772eff85c6a7a0c355924df93c.1316079597.git.daniel@totalueberwachung.de> --- include/osmocom/abis/ipa.h | 3 ++- src/input/ipa.c | 5 ++++- src/ipa_proxy.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 43422dc..397cf9c 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -24,11 +24,12 @@ struct ipa_server_conn { struct ipa_server_link *server; struct osmo_fd ofd; struct llist_head tx_queue; + int (*closed_cb)(struct ipa_server_conn *peer); int (*cb)(struct ipa_server_conn *peer, struct msgb *msg); void *data; }; -struct ipa_server_conn *ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_conn *peer, struct msgb *msg), void *data); +struct ipa_server_conn *ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_conn *peer, struct msgb *msg), int (*closed_cb)(struct ipa_server_conn *peer), void *data); void ipa_server_conn_destroy(struct ipa_server_conn *peer); void ipa_server_conn_send(struct ipa_server_conn *peer, struct msgb *msg); diff --git a/src/input/ipa.c b/src/input/ipa.c index c881b22..a887959 100644 --- a/src/input/ipa.c +++ b/src/input/ipa.c @@ -443,7 +443,7 @@ static int ipa_server_conn_cb(struct osmo_fd *ofd, unsigned int what) struct ipa_server_conn * ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, int (*cb)(struct ipa_server_conn *conn, struct msgb *msg), - void *data) + int (*closed_cb)(struct ipa_server_conn *conn), void *data) { struct ipa_server_conn *conn; @@ -459,6 +459,7 @@ ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, conn->ofd.cb = ipa_server_conn_cb; conn->ofd.when = BSC_FD_READ; conn->cb = cb; + conn->closed_cb = closed_cb; conn->data = data; INIT_LLIST_HEAD(&conn->tx_queue); @@ -474,6 +475,8 @@ void ipa_server_conn_destroy(struct ipa_server_conn *conn) { close(conn->ofd.fd); osmo_fd_unregister(&conn->ofd); + if (conn->closed_cb) + conn->closed_cb(conn); talloc_free(conn); } diff --git a/src/ipa_proxy.c b/src/ipa_proxy.c index f4e1df8..9816d02 100644 --- a/src/ipa_proxy.c +++ b/src/ipa_proxy.c @@ -176,7 +176,7 @@ ipa_sock_src_accept_cb(struct ipa_server_link *link, int fd) conn->route = route; conn->src = ipa_server_conn_create(tall_ipa_proxy_ctx, link, fd, - ipa_sock_src_cb, conn); + ipa_sock_src_cb, NULL, conn); if (conn->src == NULL) { LOGP(DLINP, LOGL_ERROR, "could not create server peer: %s\n", strerror(errno)); -- 1.7.6.1 From pablo at gnumonks.org Thu Sep 15 23:12:18 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Fri, 16 Sep 2011 01:12:18 +0200 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes In-Reply-To: References: Message-ID: <20110915231218.GA30848@1984> On Thu, Sep 15, 2011 at 12:56:56PM +0200, Daniel Willmann wrote: > Hello, > > attached are two patches I came across while looking at the > pablo/ctrl-updates branch in OpenBSC. > > The first one is just a bugfix for a resource leak and the second one > adds a possibility to register a callback that will notify you if the > connection is lost. This is needed for the control interface as we'll > need to clean up some ctrlif related things if a connection is lost. Thanks for the patches, nice catch the leak fix. I'm fine with the API change to add the close callback, I think we're still in time to make this changes without much pain. @Harald: Could you apply these patches? I can do it myself if you want. Let me know. From holger at freyther.de Thu Sep 15 23:20:56 2011 From: holger at freyther.de (Holger Hans Peter Freyther) Date: Fri, 16 Sep 2011 01:20:56 +0200 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes In-Reply-To: <20110915231218.GA30848@1984> References: <20110915231218.GA30848@1984> Message-ID: <4E728858.7070708@freyther.de> On 09/16/2011 01:12 AM, Pablo Neira Ayuso wrote: > On Thu, Sep 15, 2011 at 12:56:56PM +0200, Daniel Willmann wrote: > > Thanks for the patches, nice catch the leak fix. This fix reminded me that we should have some way to test for 'leaks', semi automatically. What I have done so far with On-Waves when deploying/branching was to have a setup with two phones (Motorola A1200, Nokia ...), some crazy chat script to call ATD, AT, send SMS from the Motorola phone, have another script that 'scripts' telnet to either drop OML/RSL and on top of that have another script that is using tcpkill, sending SIGKILL2 to drop the MSC connection... Leak checking was done by using the talloc reporting (it also shows that not every context hangs of the right roots), using top -p `pidof ...`. It would be nice if we could automate this and extend it to the various external interfaces (e.g. CTRL). cheers From pablo at gnumonks.org Mon Sep 19 01:14:45 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Mon, 19 Sep 2011 03:14:45 +0200 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes In-Reply-To: <4E728858.7070708@freyther.de> References: <20110915231218.GA30848@1984> <4E728858.7070708@freyther.de> Message-ID: <20110919011445.GB22717@1984> On Fri, Sep 16, 2011 at 01:20:56AM +0200, Holger Hans Peter Freyther wrote: > On 09/16/2011 01:12 AM, Pablo Neira Ayuso wrote: > > On Thu, Sep 15, 2011 at 12:56:56PM +0200, Daniel Willmann wrote: > > > > > Thanks for the patches, nice catch the leak fix. > > This fix reminded me that we should have some way to test for 'leaks', semi > automatically. What I have done so far with On-Waves when deploying/branching > was to have a setup with two phones (Motorola A1200, Nokia ...), some crazy > chat script to call ATD, AT, send SMS from the Motorola phone, have another > script that 'scripts' telnet to either drop OML/RSL and on top of that have > another script that is using tcpkill, sending SIGKILL2 to drop the MSC > connection... > > Leak checking was done by using the talloc reporting (it also shows that not > every context hangs of the right roots), using top -p `pidof ...`. It would be > nice if we could automate this and extend it to the various external > interfaces (e.g. CTRL). I see, automating leak checking seems hard to achieve. In other tools that I have, I added some command to display something similar to the talloc reporting so I could use it to check if my program was leaking at some pool (and if so, reviewing the code that allocates memory in that pool). Probably we can add that command to display the talloc report to the generic VTY interface in libosmocore. From laforge at gnumonks.org Fri Sep 16 06:58:38 2011 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 16 Sep 2011 07:58:38 +0100 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes In-Reply-To: <20110915231218.GA30848@1984> References: <20110915231218.GA30848@1984> Message-ID: <20110916065837.GI12544@prithivi.gnumonks.org> Hi Pablo and Daniel, On Fri, Sep 16, 2011 at 01:12:18AM +0200, Pablo Neira Ayuso wrote: > I'm fine with the API change to add the close callback, I think we're > still in time to make this changes without much pain. I'm afraid there will be one more round of libosmo-abis related changes in not too distant future, adding (and hiding) support for a new signalling protocol that != ip.access. > @Harald: Could you apply these patches? I can do it myself if you > want. Let me know. I'm fine with the patches, feel free to apply them. -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From pablo at gnumonks.org Mon Sep 19 01:05:17 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Mon, 19 Sep 2011 03:05:17 +0200 Subject: [PATCH/RFC 0/2] libosmo-abis ctrl related fixes In-Reply-To: <20110916065837.GI12544@prithivi.gnumonks.org> References: <20110915231218.GA30848@1984> <20110916065837.GI12544@prithivi.gnumonks.org> Message-ID: <20110919010517.GA22717@1984> On Fri, Sep 16, 2011 at 07:58:38AM +0100, Harald Welte wrote: > On Fri, Sep 16, 2011 at 01:12:18AM +0200, Pablo Neira Ayuso wrote: > > > I'm fine with the API change to add the close callback, I think we're > > still in time to make this changes without much pain. > > I'm afraid there will be one more round of libosmo-abis related changes > in not too distant future, adding (and hiding) support for a new > signalling protocol that != ip.access. Ok, let's see. > > @Harald: Could you apply these patches? I can do it myself if you > > want. Let me know. > > I'm fine with the patches, feel free to apply them. I have applied both patches to libosmo-abis. Thanks! P.S: I still have to take your patches for my openBSC branch, I expect to do it by tomorrow. From daniel at totalueberwachung.de Thu Sep 15 14:04:48 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:48 +0200 Subject: [PATCH 0/5] pablo/ctrl-updates related patches Message-ID: Hello Pablo, attached are patches against the current pablo/ctrl-updates branch that fix the compile issues. It needs the closed callback in libosmo-abis to work. As long as the bsc_msc_connection is still using write_queues I have added the old ctrl_cmd_send function again (under a different name) So we can still send commands over that connection. I've tested the communication/timeout/closed_cb handling and nothing problematic showed up. Having two send commands is unfortunate, but I guess it's okay for the time being. I'm guessing that the other connections will be switching to libosmo-abis as well in the foreseeable future and then this issue will resolve itself. Feel free to squash the patches as you see fit in order to get them merged. Regards, Daniel Willmann (5): libctrl: Catch up with API change for ipa_server_conn_create nat: Use libosmo-abis infrastructure in the pending entries libctrl: Add a new function to send commands through an osmo_wqueue osmo-bsc: Use ctrl_cmd_send_wqueue to send cmds over the nat-bsc link nat: Use ctrl_cmd_send_wqueue to send cmds over the nat-bsc link openbsc/include/openbsc/bsc_nat.h | 2 +- openbsc/include/openbsc/control_cmd.h | 1 + openbsc/src/libctrl/control_if.c | 24 +++++++++++++++++++++++- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 4 ++-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 19 ++++++++++--------- 5 files changed, 37 insertions(+), 13 deletions(-) -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 14:04:49 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:49 +0200 Subject: [PATCH 1/5] libctrl: Catch up with API change for ipa_server_conn_create In-Reply-To: References: Message-ID: --- openbsc/src/libctrl/control_if.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index 7e2ae16..99e4ccf 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -244,7 +244,7 @@ static int ctrl_accept_cb(struct ipa_server_link *ipa_link, int fd) struct ipa_server_conn *ipa_peer_link; ipa_peer_link = ipa_server_conn_create(tall_bsc_ctx, ipa_link, fd, - handle_control_read, + handle_control_read, NULL, ipa_link->data); if (!ipa_peer_link) { LOGP(DCTRL, LOGL_ERROR, "Failed to register peer connection.\n"); -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 14:04:50 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:50 +0200 Subject: [PATCH 2/5] nat: Use libosmo-abis infrastructure in the pending entries In-Reply-To: References: Message-ID: <077d3ce3840b489252559ed049460de59e70dee9.1316094892.git.daniel@totalueberwachung.de> The ctrl_cmds are now using struct ipa_server_conn so the pending entries need to use it as well. This patch needs the closed_cb patch for libosmo-abis to work. --- openbsc/include/openbsc/bsc_nat.h | 2 +- openbsc/src/osmo-bsc_nat/bsc_nat.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index b4f07e0..eca019d 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -78,7 +78,7 @@ struct bsc_cmd_list { int nat_id; /* The control connection from which the command originated */ - struct ctrl_connection *ccon; + struct ipa_server_conn *ipa_link; /* The command from the control connection */ struct ctrl_cmd *cmd; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 326d04e..2753065 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -882,7 +882,7 @@ void bsc_close_connection(struct bsc_connection *connection) llist_for_each_entry_safe(cmd_entry, cmd_tmp, &connection->cmd_pending, list_entry) { cmd_entry->cmd->type = CTRL_TYPE_ERROR; cmd_entry->cmd->reply = "BSC closed the connection"; - ctrl_cmd_send(&cmd_entry->ccon->write_queue, cmd_entry->cmd); + ctrl_cmd_send(cmd_entry->ipa_link, cmd_entry->cmd); bsc_del_pending(cmd_entry); } @@ -1232,7 +1232,7 @@ static int handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg) goto err; } cmd->id = id; - ctrl_cmd_send(&pending->ccon->write_queue, cmd); + ctrl_cmd_send(pending->ipa_link, cmd); bsc_del_pending(pending); } else { /* We need to handle TRAPS here */ @@ -1575,22 +1575,23 @@ static void pending_timeout_cb(void *data) LOGP(DNAT, LOGL_ERROR, "Command timed out\n"); pending->cmd->type = CTRL_TYPE_ERROR; pending->cmd->reply = "Command timed out"; - ctrl_cmd_send(&pending->ccon->write_queue, pending->cmd); + ctrl_cmd_send(pending->ipa_link, pending->cmd); bsc_del_pending(pending); } -static void ctrl_conn_closed_cb(struct ctrl_connection *connection) +static int ctrl_conn_closed_cb(struct ipa_server_conn *connection) { struct bsc_connection *bsc; struct bsc_cmd_list *pending, *tmp; llist_for_each_entry(bsc, &nat->bsc_connections, list_entry) { llist_for_each_entry_safe(pending, tmp, &bsc->cmd_pending, list_entry) { - if (pending->ccon == connection) + if (pending->ipa_link == connection) bsc_del_pending(pending); } } + return 0; } static int forward_to_bsc(struct ctrl_cmd *cmd) @@ -1660,8 +1661,8 @@ static int forward_to_bsc(struct ctrl_cmd *cmd) cmd->reply = "Sending failed"; goto err; } - pending->ccon = cmd->ccon; - pending->ccon->closed_cb = ctrl_conn_closed_cb; + pending->ipa_link = cmd->ipa_link; + pending->ipa_link->closed_cb = ctrl_conn_closed_cb; pending->cmd = cmd; /* Setup the timeout */ -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 14:04:51 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:51 +0200 Subject: [PATCH 3/5] libctrl: Add a new function to send commands through an osmo_wqueue In-Reply-To: References: Message-ID: <5faf7ff77dbfed71a917ae25553c7dacc842b3e5.1316094892.git.daniel@totalueberwachung.de> This is essentially the old ctrl_cmd_send function with a different name. As long as the connection between nat and osmo-bsc is not using the generic socket infrastructure from libosmo-abis it is still needed. --- openbsc/include/openbsc/control_cmd.h | 1 + openbsc/src/libctrl/control_if.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index 87db33f..8eeed99 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -61,6 +61,7 @@ struct ctrl_cmd_map { 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_wqueue(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, struct ctrl_cmd *cmd); struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg); struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd); diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index 99e4ccf..5476179 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -86,6 +86,28 @@ int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, struct ctrl_cmd *cmd) return 0; } +int ctrl_cmd_send_wqueue(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) +{ + int ret; + struct msgb *msg; + + msg = ctrl_cmd_make(cmd); + if (!msg) { + LOGP(DCTRL, LOGL_ERROR, "Could not generate msg\n"); + return -1; + } + + ipaccess_prepend_header_ext(msg, IPAC_PROTO_EXT_CTRL); + ipaccess_prepend_header(msg, IPAC_PROTO_OSMO); + + ret = osmo_wqueue_enqueue(queue, msg); + if (ret != 0) { + LOGP(DCTRL, LOGL_ERROR, "Failed to enqueue the command"); + msgb_free(msg); + } + return ret; +} + int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data) { char *token, *request; -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 14:04:52 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:52 +0200 Subject: [PATCH 4/5] osmo-bsc: Use ctrl_cmd_send_wqueue to send cmds over the nat-bsc link In-Reply-To: References: Message-ID: --- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index 04cfb99..eeaaf72 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -211,7 +211,7 @@ static void handle_ctrl(struct osmo_msc_data *msc, struct msgb *msg) cmd->id = "err"; cmd->reply = "Failed to parse control message."; - ctrl_cmd_send(&msc->msc_con->write_queue, cmd); + ctrl_cmd_send_wqueue(&msc->msc_con->write_queue, cmd); talloc_free(cmd); return; @@ -219,7 +219,7 @@ static void handle_ctrl(struct osmo_msc_data *msc, struct msgb *msg) ret = ctrl_cmd_handle(cmd, msc->network); if (ret != CTRL_CMD_HANDLED) - ctrl_cmd_send(&msc->msc_con->write_queue, cmd); + ctrl_cmd_send_wqueue(&msc->msc_con->write_queue, cmd); talloc_free(cmd); } -- 1.7.6.1 From daniel at totalueberwachung.de Thu Sep 15 14:04:53 2011 From: daniel at totalueberwachung.de (Daniel Willmann) Date: Thu, 15 Sep 2011 16:04:53 +0200 Subject: [PATCH 5/5] nat: Use ctrl_cmd_send_wqueue to send cmds over the nat-bsc link In-Reply-To: References: Message-ID: --- openbsc/src/osmo-bsc_nat/bsc_nat.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 2753065..f432622 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -1249,7 +1249,7 @@ static int handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg) talloc_free(cmd); return 0; err: - ctrl_cmd_send(&bsc->write_queue, cmd); + ctrl_cmd_send_wqueue(&bsc->write_queue, cmd); talloc_free(cmd); return 0; } @@ -1657,7 +1657,7 @@ static int forward_to_bsc(struct ctrl_cmd *cmd) goto err; } - if (ctrl_cmd_send(&bsc->write_queue, bsc_cmd)) { + if (ctrl_cmd_send_wqueue(&bsc->write_queue, bsc_cmd)) { cmd->reply = "Sending failed"; goto err; } -- 1.7.6.1 From pablo at gnumonks.org Thu Sep 15 23:17:49 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Fri, 16 Sep 2011 01:17:49 +0200 Subject: [PATCH 0/5] pablo/ctrl-updates related patches In-Reply-To: References: Message-ID: <20110915231749.GB30848@1984> On Thu, Sep 15, 2011 at 04:04:48PM +0200, Daniel Willmann wrote: > Hello Pablo, > > attached are patches against the current pablo/ctrl-updates branch that > fix the compile issues. It needs the closed callback in libosmo-abis to > work. As long as the bsc_msc_connection is still using write_queues I > have added the old ctrl_cmd_send function again (under a different name) > So we can still send commands over that connection. > I've tested the communication/timeout/closed_cb handling and nothing > problematic showed up. Thanks Daniel, I'll rebase the pablo/ctrl-updates change with these patches and resubmit. > Having two send commands is unfortunate, but I guess it's okay for the > time being. I'm guessing that the other connections will be switching to > libosmo-abis as well in the foreseeable future and then this issue will > resolve itself. Indeed, make sense to me for the time being. I'll look for more candidates that can be ported to the generic IPA infrastructure. It can be interesting to see if they have any other specific need, I think we're still in time to make not-very-painful API/ABI changes. From pablo at gnumonks.org Mon Sep 19 00:56:12 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Mon, 19 Sep 2011 02:56:12 +0200 Subject: bug in A-bis OML wireshark dissector Message-ID: <20110919005612.GA22570@1984> Hi! While submitting the A-bis OML wireshark dissector I noticed one bug in it that results in bogus message labeling. The following patch should be applied to osmocom/wireshark.git tree. P.S: I have submitted a patch to wireshark bugzilla that includes this bugfix. -------------- next part -------------- diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c index 0066933..ee97fad 100644 --- a/epan/dissectors/packet-gsm_abis_oml.c +++ b/epan/dissectors/packet-gsm_abis_oml.c @@ -1184,6 +1184,7 @@ _match_oml_fom_msgtype(const guint32 val, const value_string_ext *vs) ret = match_strval_idx(val, _oml_fom_msgtype_vals, &idx); if (!ret) return NULL; + return &(_oml_fom_msgtype_vals[idx]); } return &(vs->_vs_p[idx]); } @@ -1198,6 +1199,7 @@ _match_oml_fom_attr(const guint32 val, const value_string_ext *vs) ret = match_strval_idx(val, _oml_fom_attr_vals, &idx); if (!ret) return NULL; + return &(_oml_fom_attr_vals[idx]); } return &(vs->_vs_p[idx]); } From laforge at gnumonks.org Sun Sep 25 21:54:59 2011 From: laforge at gnumonks.org (Harald Welte) Date: Sun, 25 Sep 2011 23:54:59 +0200 Subject: comments on jolly/lapd branch Message-ID: <20110925215459.GI30476@prithivi.gnumonks.org> Hi Andreas, I've done a quick read through your jolly/lapd branches, and I have the following comments: 1) great work, thanks :) 2) lapd_profile I would like to use a 'struct lapd_profile' instead of a simple enum. Why? Because this puts all the values/parameters (like k, n201, short_address, use_sabme, t200, etc.) into the control of the caller, instead of the library. so basically we would have struct lapd_profile { uint8_t k; unsigned int n201; ... }; and then some library-pre-defined ones: const struct lapd_profile lapd_profile_isdn = { ... }; const struct lapd_profile lapd_profile_abis = { ... }; but this way an application could define their own profile with slightly different timers, without having to modify the library codebase. The actual lapd_datalink then just would have a const struct lapd_profile *profile; member that is assigned during lapd_dl_init(). 3) the msgb_free() changes in input/dahdi.c, src/e1_input.c, etc. should be a separate patch, as they are actual bugfixes of the old code, as far as I understand. That bugfix patch should be first, then the actual LAPD restructuring on top of it. 4) regarding the two-dimensional switch() statements, I suggest introducing the following macros to include/osmocom/core/osmo_prim.h: #define OSMO_PRIM(prim, op) (prim << 8 | op & 0xFF) #define OSMO_PRIM_HDR(oph) OSMO_PRIM(oph->primitive, oph->operation) then you can do something like this in the lapd code: switch (OSMO_PRIM_HDR(oph)) { case OSMO_PRIM(PRIM_DL_EST, PRIM_OP_REQUEST): ... } Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From pablo at gnumonks.org Mon Sep 26 11:35:33 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Mon, 26 Sep 2011 13:35:33 +0200 Subject: [PATCH 0/3] rb-tree based timer infrastructure for libosmocore Message-ID: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso Hi! This patch reworks the timer insfrastructure of libosmocore to make it more scalable. I remember some discussion with Harald while I was in Berlin that this can be of interest. It also reworks the timer torture test, the current list-based timer seems to have problem with it. You can find this changes in the pablo/timer branch. Pablo Neira Ayuso (3): add rb-tree implementation to libosmocore timer: add scalable RB-tree based timer infrastructure tests: add new torture test for timer infrastructure include/osmocom/core/Makefile.am | 2 +- include/osmocom/core/linuxrbtree.h | 160 +++++++++++++++ include/osmocom/core/timer.h | 6 +- src/Makefile.am | 2 +- src/rbtree.c | 389 ++++++++++++++++++++++++++++++++++++ src/timer.c | 176 +++++++++-------- tests/timer/timer_test.c | 141 ++++++++++--- 7 files changed, 757 insertions(+), 119 deletions(-) create mode 100644 include/osmocom/core/linuxrbtree.h create mode 100644 src/rbtree.c -- 1.7.2.5 From pablo at gnumonks.org Mon Sep 26 11:35:34 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Mon, 26 Sep 2011 13:35:34 +0200 Subject: [PATCH 1/3] add rb-tree implementation to libosmocore In-Reply-To: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> References: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> Message-ID: <1317036936-18012-2-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This patch adds red black trees implementation to libosmocore. This data structure is very useful to search for elements in ordered sets in O(log n) instead of O(n) that lists provide. The first client of this code will be one follow up patch that implements rbtree-based timer scheduler. --- include/osmocom/core/Makefile.am | 2 +- include/osmocom/core/linuxrbtree.h | 160 +++++++++++++++ src/Makefile.am | 2 +- src/rbtree.c | 389 ++++++++++++++++++++++++++++++++++++ 4 files changed, 551 insertions(+), 2 deletions(-) create mode 100644 include/osmocom/core/linuxrbtree.h create mode 100644 src/rbtree.c diff --git a/include/osmocom/core/Makefile.am b/include/osmocom/core/Makefile.am index aabb775..5465d5f 100644 --- a/include/osmocom/core/Makefile.am +++ b/include/osmocom/core/Makefile.am @@ -2,7 +2,7 @@ osmocore_HEADERS = signal.h linuxlist.h timer.h select.h msgb.h bits.h \ bitvec.h statistics.h utils.h socket.h \ gsmtap.h write_queue.h prim.h \ logging.h rate_ctr.h gsmtap_util.h \ - crc16.h panic.h process.h \ + crc16.h panic.h process.h linuxrbtree.h \ backtrace.h conv.h application.h \ crcgen.h crc8gen.h crc16gen.h crc32gen.h crc64gen.h diff --git a/include/osmocom/core/linuxrbtree.h b/include/osmocom/core/linuxrbtree.h new file mode 100644 index 0000000..ee98891 --- /dev/null +++ b/include/osmocom/core/linuxrbtree.h @@ -0,0 +1,160 @@ +/* + Red Black Trees + (C) 1999 Andrea Arcangeli + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + linux/include/linux/rbtree.h + + To use rbtrees you'll have to implement your own insert and search cores. + This will avoid us to use callbacks and to drop drammatically performances. + I know it's not the cleaner way, but in C (not in C++) to get + performances and genericity... + + Some example of insert and search follows here. The search is a plain + normal search over an ordered tree. The insert instead must be implemented + int two steps: as first thing the code must insert the element in + order as a red leaf in the tree, then the support library function + rb_insert_color() must be called. Such function will do the + not trivial work to rebalance the rbtree if necessary. + +----------------------------------------------------------------------- +static inline struct page * rb_search_page_cache(struct inode * inode, + unsigned long offset) +{ + struct rb_node * n = inode->i_rb_page_cache.rb_node; + struct page * page; + + while (n) + { + page = rb_entry(n, struct page, rb_page_cache); + + if (offset < page->offset) + n = n->rb_left; + else if (offset > page->offset) + n = n->rb_right; + else + return page; + } + return NULL; +} + +static inline struct page * __rb_insert_page_cache(struct inode * inode, + unsigned long offset, + struct rb_node * node) +{ + struct rb_node ** p = &inode->i_rb_page_cache.rb_node; + struct rb_node * parent = NULL; + struct page * page; + + while (*p) + { + parent = *p; + page = rb_entry(parent, struct page, rb_page_cache); + + if (offset < page->offset) + p = &(*p)->rb_left; + else if (offset > page->offset) + p = &(*p)->rb_right; + else + return page; + } + + rb_link_node(node, parent, p); + + return NULL; +} + +static inline struct page * rb_insert_page_cache(struct inode * inode, + unsigned long offset, + struct rb_node * node) +{ + struct page * ret; + if ((ret = __rb_insert_page_cache(inode, offset, node))) + goto out; + rb_insert_color(node, &inode->i_rb_page_cache); + out: + return ret; +} +----------------------------------------------------------------------- +*/ + +#ifndef _LINUX_RBTREE_H +#define _LINUX_RBTREE_H + +#include + +struct rb_node +{ + unsigned long rb_parent_color; +#define RB_RED 0 +#define RB_BLACK 1 + struct rb_node *rb_right; + struct rb_node *rb_left; +} __attribute__((aligned(sizeof(long)))); + /* The alignment might seem pointless, but allegedly CRIS needs it */ + +struct rb_root +{ + struct rb_node *rb_node; +}; + + +#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) +#define rb_color(r) ((r)->rb_parent_color & 1) +#define rb_is_red(r) (!rb_color(r)) +#define rb_is_black(r) rb_color(r) +#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0) +#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0) + +static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p) +{ + rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p; +} +static inline void rb_set_color(struct rb_node *rb, int color) +{ + rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; +} + +#define RB_ROOT { NULL, } +#define rb_entry(ptr, type, member) container_of(ptr, type, member) + +#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) +#define RB_EMPTY_NODE(node) (rb_parent(node) == node) +#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) + +extern void rb_insert_color(struct rb_node *, struct rb_root *); +extern void rb_erase(struct rb_node *, struct rb_root *); + +/* Find logical next and previous nodes in a tree */ +extern struct rb_node *rb_next(struct rb_node *); +extern struct rb_node *rb_prev(struct rb_node *); +extern struct rb_node *rb_first(struct rb_root *); +extern struct rb_node *rb_last(struct rb_root *); + +/* Fast replacement of a single node without remove/rebalance/add/rebalance */ +extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, + struct rb_root *root); + +static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, + struct rb_node ** rb_link) +{ + node->rb_parent_color = (unsigned long )parent; + node->rb_left = node->rb_right = NULL; + + *rb_link = node; +} + +#endif /* _LINUX_RBTREE_H */ diff --git a/src/Makefile.am b/src/Makefile.am index b0ccadd..cd05c8c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ libosmocore_la_SOURCES = timer.c select.c signal.c msgb.c bits.c \ write_queue.c utils.c socket.c \ logging.c logging_syslog.c rate_ctr.c \ gsmtap_util.c crc16.c panic.c backtrace.c \ - conv.c application.c \ + conv.c application.c rbtree.c \ crc8gen.c crc16gen.c crc32gen.c crc64gen.c if ENABLE_PLUGIN diff --git a/src/rbtree.c b/src/rbtree.c new file mode 100644 index 0000000..07e1041 --- /dev/null +++ b/src/rbtree.c @@ -0,0 +1,389 @@ +/* + Red Black Trees + (C) 1999 Andrea Arcangeli + (C) 2002 David Woodhouse + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + linux/lib/rbtree.c +*/ + +#include + +static void __rb_rotate_left(struct rb_node *node, struct rb_root *root) +{ + struct rb_node *right = node->rb_right; + struct rb_node *parent = rb_parent(node); + + if ((node->rb_right = right->rb_left)) + rb_set_parent(right->rb_left, node); + right->rb_left = node; + + rb_set_parent(right, parent); + + if (parent) + { + if (node == parent->rb_left) + parent->rb_left = right; + else + parent->rb_right = right; + } + else + root->rb_node = right; + rb_set_parent(node, right); +} + +static void __rb_rotate_right(struct rb_node *node, struct rb_root *root) +{ + struct rb_node *left = node->rb_left; + struct rb_node *parent = rb_parent(node); + + if ((node->rb_left = left->rb_right)) + rb_set_parent(left->rb_right, node); + left->rb_right = node; + + rb_set_parent(left, parent); + + if (parent) + { + if (node == parent->rb_right) + parent->rb_right = left; + else + parent->rb_left = left; + } + else + root->rb_node = left; + rb_set_parent(node, left); +} + +void rb_insert_color(struct rb_node *node, struct rb_root *root) +{ + struct rb_node *parent, *gparent; + + while ((parent = rb_parent(node)) && rb_is_red(parent)) + { + gparent = rb_parent(parent); + + if (parent == gparent->rb_left) + { + { + register struct rb_node *uncle = gparent->rb_right; + if (uncle && rb_is_red(uncle)) + { + rb_set_black(uncle); + rb_set_black(parent); + rb_set_red(gparent); + node = gparent; + continue; + } + } + + if (parent->rb_right == node) + { + register struct rb_node *tmp; + __rb_rotate_left(parent, root); + tmp = parent; + parent = node; + node = tmp; + } + + rb_set_black(parent); + rb_set_red(gparent); + __rb_rotate_right(gparent, root); + } else { + { + register struct rb_node *uncle = gparent->rb_left; + if (uncle && rb_is_red(uncle)) + { + rb_set_black(uncle); + rb_set_black(parent); + rb_set_red(gparent); + node = gparent; + continue; + } + } + + if (parent->rb_left == node) + { + register struct rb_node *tmp; + __rb_rotate_right(parent, root); + tmp = parent; + parent = node; + node = tmp; + } + + rb_set_black(parent); + rb_set_red(gparent); + __rb_rotate_left(gparent, root); + } + } + + rb_set_black(root->rb_node); +} + +static void __rb_erase_color(struct rb_node *node, struct rb_node *parent, + struct rb_root *root) +{ + struct rb_node *other; + + while ((!node || rb_is_black(node)) && node != root->rb_node) + { + if (parent->rb_left == node) + { + other = parent->rb_right; + if (rb_is_red(other)) + { + rb_set_black(other); + rb_set_red(parent); + __rb_rotate_left(parent, root); + other = parent->rb_right; + } + if ((!other->rb_left || rb_is_black(other->rb_left)) && + (!other->rb_right || rb_is_black(other->rb_right))) + { + rb_set_red(other); + node = parent; + parent = rb_parent(node); + } + else + { + if (!other->rb_right || rb_is_black(other->rb_right)) + { + struct rb_node *o_left; + if ((o_left = other->rb_left)) + rb_set_black(o_left); + rb_set_red(other); + __rb_rotate_right(other, root); + other = parent->rb_right; + } + rb_set_color(other, rb_color(parent)); + rb_set_black(parent); + if (other->rb_right) + rb_set_black(other->rb_right); + __rb_rotate_left(parent, root); + node = root->rb_node; + break; + } + } + else + { + other = parent->rb_left; + if (rb_is_red(other)) + { + rb_set_black(other); + rb_set_red(parent); + __rb_rotate_right(parent, root); + other = parent->rb_left; + } + if ((!other->rb_left || rb_is_black(other->rb_left)) && + (!other->rb_right || rb_is_black(other->rb_right))) + { + rb_set_red(other); + node = parent; + parent = rb_parent(node); + } + else + { + if (!other->rb_left || rb_is_black(other->rb_left)) + { + register struct rb_node *o_right; + if ((o_right = other->rb_right)) + rb_set_black(o_right); + rb_set_red(other); + __rb_rotate_left(other, root); + other = parent->rb_left; + } + rb_set_color(other, rb_color(parent)); + rb_set_black(parent); + if (other->rb_left) + rb_set_black(other->rb_left); + __rb_rotate_right(parent, root); + node = root->rb_node; + break; + } + } + } + if (node) + rb_set_black(node); +} + +void rb_erase(struct rb_node *node, struct rb_root *root) +{ + struct rb_node *child, *parent; + int color; + + if (!node->rb_left) + child = node->rb_right; + else if (!node->rb_right) + child = node->rb_left; + else + { + struct rb_node *old = node, *left; + + node = node->rb_right; + while ((left = node->rb_left) != NULL) + node = left; + child = node->rb_right; + parent = rb_parent(node); + color = rb_color(node); + + if (child) + rb_set_parent(child, parent); + if (parent == old) { + parent->rb_right = child; + parent = node; + } else + parent->rb_left = child; + + node->rb_parent_color = old->rb_parent_color; + node->rb_right = old->rb_right; + node->rb_left = old->rb_left; + + if (rb_parent(old)) + { + if (rb_parent(old)->rb_left == old) + rb_parent(old)->rb_left = node; + else + rb_parent(old)->rb_right = node; + } else + root->rb_node = node; + + rb_set_parent(old->rb_left, node); + if (old->rb_right) + rb_set_parent(old->rb_right, node); + goto color; + } + + parent = rb_parent(node); + color = rb_color(node); + + if (child) + rb_set_parent(child, parent); + if (parent) + { + if (parent->rb_left == node) + parent->rb_left = child; + else + parent->rb_right = child; + } + else + root->rb_node = child; + + color: + if (color == RB_BLACK) + __rb_erase_color(child, parent, root); +} + +/* + * This function returns the first node (in sort order) of the tree. + */ +struct rb_node *rb_first(struct rb_root *root) +{ + struct rb_node *n; + + n = root->rb_node; + if (!n) + return NULL; + while (n->rb_left) + n = n->rb_left; + return n; +} + +struct rb_node *rb_last(struct rb_root *root) +{ + struct rb_node *n; + + n = root->rb_node; + if (!n) + return NULL; + while (n->rb_right) + n = n->rb_right; + return n; +} + +struct rb_node *rb_next(struct rb_node *node) +{ + struct rb_node *parent; + + if (rb_parent(node) == node) + return NULL; + + /* If we have a right-hand child, go down and then left as far + as we can. */ + if (node->rb_right) { + node = node->rb_right; + while (node->rb_left) + node=node->rb_left; + return node; + } + + /* No right-hand children. Everything down and left is + smaller than us, so any 'next' node must be in the general + direction of our parent. Go up the tree; any time the + ancestor is a right-hand child of its parent, keep going + up. First time it's a left-hand child of its parent, said + parent is our 'next' node. */ + while ((parent = rb_parent(node)) && node == parent->rb_right) + node = parent; + + return parent; +} + +struct rb_node *rb_prev(struct rb_node *node) +{ + struct rb_node *parent; + + if (rb_parent(node) == node) + return NULL; + + /* If we have a left-hand child, go down and then right as far + as we can. */ + if (node->rb_left) { + node = node->rb_left; + while (node->rb_right) + node=node->rb_right; + return node; + } + + /* No left-hand children. Go up till we find an ancestor which + is a right-hand child of its parent */ + while ((parent = rb_parent(node)) && node == parent->rb_left) + node = parent; + + return parent; +} + +void rb_replace_node(struct rb_node *victim, struct rb_node *new, + struct rb_root *root) +{ + struct rb_node *parent = rb_parent(victim); + + /* Set the surrounding nodes to point to the replacement */ + if (parent) { + if (victim == parent->rb_left) + parent->rb_left = new; + else + parent->rb_right = new; + } else { + root->rb_node = new; + } + if (victim->rb_left) + rb_set_parent(victim->rb_left, new); + if (victim->rb_right) + rb_set_parent(victim->rb_right, new); + + /* Copy the pointers/colour from the victim to the replacement */ + *new = *victim; +} -- 1.7.2.5 From pablo at gnumonks.org Mon Sep 26 11:35:35 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Mon, 26 Sep 2011 13:35:35 +0200 Subject: [PATCH 2/3] timer: add scalable RB-tree based timer infrastructure In-Reply-To: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> References: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> Message-ID: <1317036936-18012-3-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This patch adds RB-tree based timers which scales better than the previous list-based implementation. It does not require any API changes. It breaks ABI because the osmo_timer_list structure has changed though (to avoid this in the future, we can put internal data in some private structure). The following table summarizes the worst-case computational complexity of this new implementation versus the previous one: rb-tree list-based ------- ---------- calculate next timer to expire O(1) O(n) insertion of new timer O(log n) O(n) deletion of timer O(log n) O(1) timer-fired scheduler O(log n) O(3n) The most repeated cases are: * the calculation of the next timer to expire, that happens in every loop of our select function. * the timer-fired scheduler execution. This new implementation only loses in the deletion of timer scenario, this happens because we may need to rebalance the tree after the removal. So I think there is some real gain if we have some situation in which we have to handle lots of timers. --- include/osmocom/core/timer.h | 6 +- src/timer.c | 176 +++++++++++++++++++++++------------------- 2 files changed, 98 insertions(+), 84 deletions(-) diff --git a/include/osmocom/core/timer.h b/include/osmocom/core/timer.h index 8f8c826..30f558b 100644 --- a/include/osmocom/core/timer.h +++ b/include/osmocom/core/timer.h @@ -32,6 +32,7 @@ #include #include +#include /** * Timer management: @@ -51,11 +52,10 @@ */ /*! \brief A structure representing a single instance of a timer */ struct osmo_timer_list { - struct llist_head entry; /*!< \brief linked list header */ + struct rb_node node; /*!< \brief rb-tree node header */ + struct llist_head list; /*!< \brief internal list header */ struct timeval timeout; /*!< \brief expiration time */ unsigned int active : 1; /*!< \brief is it active? */ - unsigned int handled : 1; /*!< \brief did we already handle it */ - unsigned int in_list : 1; /*!< \brief is it in the global list? */ void (*cb)(void*); /*!< \brief call-back called at timeout */ void *data; /*!< \brief user data for callback */ diff --git a/src/timer.c b/src/timer.c index ed2b296..6852983 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,7 +1,12 @@ /* * (C) 2008,2009 by Holger Hans Peter Freyther + * (C) 2011 by Harald Welte * All Rights Reserved * + * Authors: Holger Hans Peter Freyther + * Harald Welte + * Pablo Neira Ayuso + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -18,6 +23,10 @@ * */ +/* These store the amount of time that we wait until next timer expires. */ +static struct timeval nearest; +static struct timeval *nearest_p; + /*! \addtogroup timer * @{ */ @@ -27,35 +36,41 @@ #include #include +#include #include +#include + +static struct rb_root timer_root = RB_ROOT; + +static void __add_timer(struct osmo_timer_list *timer) +{ + struct rb_node **new = &(timer_root.rb_node); + struct rb_node *parent = NULL; -static LLIST_HEAD(timer_list); -static struct timeval s_nearest_time; -static struct timeval s_select_time; + while (*new) { + struct osmo_timer_list *this; -#define MICRO_SECONDS 1000000LL + this = container_of(*new, struct osmo_timer_list, node); -#define TIME_SMALLER(left, right) \ - (left.tv_sec*MICRO_SECONDS+left.tv_usec) <= (right.tv_sec*MICRO_SECONDS+right.tv_usec) + parent = *new; + if (timercmp(&timer->timeout, &this->timeout, <)) + new = &((*new)->rb_left); + else + new = &((*new)->rb_right); + } + rb_link_node(&timer->node, parent, new); + rb_insert_color(&timer->node, &timer_root); +} /*! \brief add a new timer to the timer management * \param[in] timer the timer that should be added */ void osmo_timer_add(struct osmo_timer_list *timer) { - struct osmo_timer_list *list_timer; - - /* TODO: Optimize and remember the closest item... */ timer->active = 1; - - /* this might be called from within update_timers */ - llist_for_each_entry(list_timer, &timer_list, entry) - if (timer == list_timer) - return; - - timer->in_list = 1; - llist_add(&timer->entry, &timer_list); + INIT_LLIST_HEAD(&timer->list); + __add_timer(timer); } /*! \brief schedule a timer at a given future relative time @@ -74,10 +89,9 @@ osmo_timer_schedule(struct osmo_timer_list *timer, int seconds, int microseconds struct timeval current_time; gettimeofday(¤t_time, NULL); - unsigned long long currentTime = current_time.tv_sec * MICRO_SECONDS + current_time.tv_usec; - currentTime += seconds * MICRO_SECONDS + microseconds; - timer->timeout.tv_sec = currentTime / MICRO_SECONDS; - timer->timeout.tv_usec = currentTime % MICRO_SECONDS; + timer->timeout.tv_sec = seconds; + timer->timeout.tv_usec = microseconds; + timeradd(&timer->timeout, ¤t_time, &timer->timeout); osmo_timer_add(timer); } @@ -89,10 +103,12 @@ osmo_timer_schedule(struct osmo_timer_list *timer, int seconds, int microseconds */ void osmo_timer_del(struct osmo_timer_list *timer) { - if (timer->in_list) { + if (timer->active) { timer->active = 0; - timer->in_list = 0; - llist_del(&timer->entry); + rb_erase(&timer->node, &timer_root); + /* make sure this is not already scheduled for removal. */ + if (!llist_empty(&timer->list)) + llist_del_init(&timer->list); } } @@ -116,26 +132,28 @@ int osmo_timer_pending(struct osmo_timer_list *timer) */ struct timeval *osmo_timers_nearest(void) { - struct timeval current_time; - - if (s_nearest_time.tv_sec == 0 && s_nearest_time.tv_usec == 0) - return NULL; - - if (gettimeofday(¤t_time, NULL) == -1) - return NULL; + static struct timeval no_timers = { 0, 0 }; - unsigned long long nearestTime = s_nearest_time.tv_sec * MICRO_SECONDS + s_nearest_time.tv_usec; - unsigned long long currentTime = current_time.tv_sec * MICRO_SECONDS + current_time.tv_usec; + if (nearest_p != NULL && !timerisset(nearest_p)) + return nearest_p; + else + return &no_timers; +} - if (nearestTime < currentTime) { - s_select_time.tv_sec = 0; - s_select_time.tv_usec = 0; +static void update_nearest(struct timeval *cand, struct timeval *current) +{ + if (cand->tv_sec != LONG_MAX) { + if (timercmp(cand, current, >)) + timersub(cand, current, &nearest); + else { + /* loop again inmediately */ + nearest.tv_sec = 0; + nearest.tv_usec = 0; + } + nearest_p = &nearest; } else { - s_select_time.tv_sec = (nearestTime - currentTime) / MICRO_SECONDS; - s_select_time.tv_usec = (nearestTime - currentTime) % MICRO_SECONDS; + nearest_p = NULL; } - - return &s_select_time; } /* @@ -143,17 +161,18 @@ struct timeval *osmo_timers_nearest(void) */ void osmo_timers_prepare(void) { - struct osmo_timer_list *timer, *nearest_timer = NULL; - llist_for_each_entry(timer, &timer_list, entry) { - if (!nearest_timer || TIME_SMALLER(timer->timeout, nearest_timer->timeout)) { - nearest_timer = timer; - } - } + struct rb_node *node; + struct timeval current; + + gettimeofday(¤t, NULL); - if (nearest_timer) { - s_nearest_time = nearest_timer->timeout; + node = rb_first(&timer_root); + if (node) { + struct osmo_timer_list *this; + this = container_of(node, struct osmo_timer_list, node); + update_nearest(&this->timeout, ¤t); } else { - memset(&s_nearest_time, 0, sizeof(struct timeval)); + nearest_p = NULL; } } @@ -163,46 +182,41 @@ void osmo_timers_prepare(void) int osmo_timers_update(void) { struct timeval current_time; - struct osmo_timer_list *timer, *tmp; + struct rb_node *node; + struct llist_head timer_eviction_list; + struct osmo_timer_list *this; int work = 0; gettimeofday(¤t_time, NULL); + INIT_LLIST_HEAD(&timer_eviction_list); + for (node = rb_first(&timer_root); node; node = rb_next(node)) { + this = container_of(node, struct osmo_timer_list, node); + + if (timercmp(&this->timeout, ¤t_time, >)) + break; + + llist_add(&this->list, &timer_eviction_list); + } + /* * The callbacks might mess with our list and in this case * even llist_for_each_entry_safe is not safe to use. To allow - * del_timer, add_timer, schedule_timer to be called from within - * the callback we jump through some loops. + * osmo_timer_del to be called from within the callback we need + * to restart the iteration for each element scheduled for removal. * - * First we set the handled flag of each active timer to zero, - * then we iterate over the list and execute the callbacks. As the - * list might have been changed (specially the next) from within - * the callback we have to start over again. Once every callback - * is dispatched we will remove the non-active from the list. - * - * TODO: If this is a performance issue we can poison a global - * variable in add_timer and del_timer and only then restart. + * The problematic scenario is the following: Given two timers A + * and B that have expired at the same time. Thus, they are both + * in the eviction list in this order: A, then B. If we remove + * timer B from the A's callback, we continue with B in the next + * iteration step, leading to an access-after-release. */ - llist_for_each_entry(timer, &timer_list, entry) { - timer->handled = 0; - } - restart: - llist_for_each_entry(timer, &timer_list, entry) { - if (!timer->handled && TIME_SMALLER(timer->timeout, current_time)) { - timer->handled = 1; - timer->active = 0; - (*timer->cb)(timer->data); - work = 1; - goto restart; - } - } - - llist_for_each_entry_safe(timer, tmp, &timer_list, entry) { - timer->handled = 0; - if (!timer->active) { - osmo_timer_del(timer); - } + llist_for_each_entry(this, &timer_eviction_list, list) { + osmo_timer_del(this); + this->cb(this->data); + work = 1; + goto restart; } return work; @@ -210,10 +224,10 @@ restart: int osmo_timers_check(void) { - struct osmo_timer_list *timer; + struct rb_node *node; int i = 0; - llist_for_each_entry(timer, &timer_list, entry) { + for (node = rb_first(&timer_root); node; node = rb_next(node)) { i++; } return i; -- 1.7.2.5 From pablo at gnumonks.org Mon Sep 26 11:35:36 2011 From: pablo at gnumonks.org (pablo at gnumonks.org) Date: Mon, 26 Sep 2011 13:35:36 +0200 Subject: [PATCH 3/3] tests: add new torture test for timer infrastructure In-Reply-To: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> References: <1317036936-18012-1-git-send-email-pablo@gnumonks.org> Message-ID: <1317036936-18012-4-git-send-email-pablo@gnumonks.org> From: Pablo Neira Ayuso This is a new test for the timer infrastructure. It basically consists of adding 2^N timers per step (where N is the number of step) that expire in (random() % 10) + 1 seconds. Moreover, we randomly delete timers that fulfill (random() % 100) < 10 everytime one timer expires. The default number of steps is 16, the test also allows to check for timer imprecisions (currently, defaulting to 10ms as aceptable). The list-based implementation crashes or it seems loop forever with this test (I guess due to some memory corruption). BTW, this patch contains one cosmetic clean up since we go back to 8-chars per indentations, which seems to be the policy in osmocom. --- tests/timer/timer_test.c | 141 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 108 insertions(+), 33 deletions(-) diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c index 240bc48..bcaafdb 100644 --- a/tests/timer/timer_test.c +++ b/tests/timer/timer_test.c @@ -1,7 +1,11 @@ /* * (C) 2008 by Holger Hans Peter Freyther + * (C) 2011 by Harald Welte * All Rights Reserved * + * Authors: Holger Hans Peter Freyther + * Pablo Neira Ayuso + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,59 +23,130 @@ */ #include +#include +#include #include #include +#include #include "../../config.h" -static void timer_fired(void *data); +static void main_timer_fired(void *data); +static void secondary_timer_fired(void *data); -static struct osmo_timer_list timer_one = { - .cb = timer_fired, - .data = (void*)1, +static unsigned int main_timer_step = 0; +static struct osmo_timer_list main_timer = { + .cb = main_timer_fired, + .data = &main_timer_step, }; -static struct osmo_timer_list timer_two = { - .cb = timer_fired, - .data = (void*)2, -}; +static LLIST_HEAD(timer_test_list); -static struct osmo_timer_list timer_three = { - .cb = timer_fired, - .data = (void*)3, +struct test_timer { + struct llist_head head; + struct osmo_timer_list timer; + struct timeval start; + struct timeval stop; }; -static void timer_fired(void *_data) +/* number of test steps. We add fact(steps) timers in the whole test. */ +#define MAIN_TIMER_NSTEPS 16 + +/* time between two steps, in secs. */ +#define TIME_BETWEEN_STEPS 1 + +/* timer imprecision that we accept for this test: 10 milliseconds. */ +#define TIMER_PRES_SECS 0 +#define TIMER_PRES_USECS 10000 + +static unsigned int expired_timers = 0; +static unsigned int total_timers = 0; +static unsigned int too_late = 0; + +static void main_timer_fired(void *data) +{ + unsigned int *step = data; + unsigned int add_in_this_step; + int i; + + if (*step == MAIN_TIMER_NSTEPS) { + printf("Main timer has finished, please, wait a bit for the " + "final report.\n"); + return; + } + /* add 2^step pair of timers per step. */ + add_in_this_step = (1 << *step); + + for (i=0; istart, NULL); + v->timer.cb = secondary_timer_fired; + v->timer.data = v; + unsigned int seconds = (random() % 10) + 1; + v->stop.tv_sec = v->start.tv_sec + seconds; + osmo_timer_schedule(&v->timer, seconds, 0); + llist_add(&v->head, &timer_test_list); + } + printf("added %d timers in step %u (expired=%u)\n", + add_in_this_step, *step, expired_timers); + total_timers += add_in_this_step; + osmo_timer_schedule(&main_timer, TIME_BETWEEN_STEPS, 0); + (*step)++; +} + +static void secondary_timer_fired(void *data) { - unsigned long data = (unsigned long) _data; - printf("Fired timer: %lu\n", data); - - if (data == 1) { - osmo_timer_schedule(&timer_one, 3, 0); - osmo_timer_del(&timer_two); - } else if (data == 2) { - printf("Should not be fired... bug in del_timer\n"); - } else if (data == 3) { - printf("Timer fired not registering again\n"); - } else { - printf("wtf... wrong data\n"); - } + struct test_timer *v = data, *this, *tmp; + struct timeval current, res, precision = { 1, 0 }; + + gettimeofday(¤t, NULL); + + timersub(¤t, &v->stop, &res); + if (timercmp(&res, &precision, >)) { + printf("ERROR: timer %p has expired too late!\n", v->timer); + too_late++; + } + + llist_del(&v->head); + talloc_free(data); + expired_timers++; + if (expired_timers == total_timers) { + printf("test over: added=%u expired=%u too_late=%u \n", + total_timers, expired_timers, too_late); + exit(EXIT_SUCCESS); + } + + /* randomly (10%) deletion of timers. */ + llist_for_each_entry_safe(this, tmp, &timer_test_list, head) { + if ((random() % 100) < 10) { + osmo_timer_del(&this->timer); + llist_del(&this->head); + talloc_free(this); + expired_timers++; + } + } } int main(int argc, char** argv) { - printf("Starting... timer\n"); + printf("Running timer test for %u steps, accepting imprecision " + "of %u.%.6u seconds\n", + MAIN_TIMER_NSTEPS, TIMER_PRES_SECS, TIMER_PRES_USECS); - osmo_timer_schedule(&timer_one, 3, 0); - osmo_timer_schedule(&timer_two, 5, 0); - osmo_timer_schedule(&timer_three, 4, 0); + osmo_timer_schedule(&main_timer, 1, 0); #ifdef HAVE_SYS_SELECT_H - while (1) { - osmo_select_main(0); - } + while (1) { + osmo_select_main(0); + } #else - printf("Select not supported on this platform!\n"); + printf("Select not supported on this platform!\n"); #endif } -- 1.7.2.5 From pablo at gnumonks.org Tue Sep 27 12:47:12 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Tue, 27 Sep 2011 14:47:12 +0200 Subject: [RFC] proposal for new library: libosmo-net Message-ID: <20110927124712.GA24023@1984> Hi, After some private discussion with Harald, I'd like to propose one new library to abstract the network interface that is used to communicate two elements that are part of one GSM network (no matter if it's on the A-bis interface, A interface, ...). This new library, whose proposed name can be "libosmo-net", would initially support: - E1 interfaces. - Ethernet + IPA TCP/IP. - rs232 (as required by bs11 its config interface). This support is included in libosmo-abis, so my idea is to extract this code from it and leave in libosmo-abis only the specific A-bis bits. The libosmo-net library would be extensible, so we can add new interfaces to it (new E1 cards supported, new protocols over BSD sockets, and so on). The interface provided to the client of the library will be homogeneous for all supported interfaces (at least, as much as we can). The new library will provide: * a constructor/destructor to create/release some network interface of * a given supported type. * a call-back for receiving incoming messages that will take the actual msgb. * one function for sending signalling messages. As well as many helper functions in this regard. Therefore, libosmo-abis will require this new libosmo-net library after all is done. For the A interface, I'd propose some hypothetical libosmo-a library that will contain the specific A interface protocols. Let me know what you think. From laforge at gnumonks.org Thu Sep 29 00:02:03 2011 From: laforge at gnumonks.org (Harald Welte) Date: Thu, 29 Sep 2011 09:02:03 +0900 Subject: [RFC] proposal for new library: libosmo-net In-Reply-To: <20110927124712.GA24023@1984> References: <20110927124712.GA24023@1984> Message-ID: <20110929000203.GF11041@prithivi.gnumonks.org> Hi Pablo, On Tue, Sep 27, 2011 at 02:47:12PM +0200, Pablo Neira Ayuso wrote: > This new library, whose proposed name can be "libosmo-net", would > initially support: > > - E1 interfaces. > - Ethernet + IPA TCP/IP. > - rs232 (as required by bs11 its config interface). > > This support is included in libosmo-abis, so my idea is to extract > this code from it and leave in libosmo-abis only the specific A-bis > bits. I'm not sure if such a split is practical. What exactly woould remain A-bis specific? The TRAU frame handling for voice channels? > For the A interface, I'd propose some hypothetical libosmo-a library > that will contain the specific A interface protocols. Once again I'm not entirely convinced that this is neccessarry. We already have libosmo-sccp for the SCCP parsing routines, and the BSSAP/BSSMAP layer is handled in osmo-bsc directly. So I don't really see what would be left over as A-specific parts. In order to stop further proliferation of small library fragments, I would rather suggest to include any (if at all) remaining A-bis and A related parts in the same libosmo-net. btw: I'm still trying to come up with a better name. libosmo-signalling is wrong as it will also deal with voice/trau/rtp. libosmo-interface maybe? Also not a quite obvious naming. libosmo-netif as a compromise? Regards, Harald -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From pablo at gnumonks.org Thu Sep 29 12:33:28 2011 From: pablo at gnumonks.org (Pablo Neira Ayuso) Date: Thu, 29 Sep 2011 14:33:28 +0200 Subject: [RFC] proposal for new library: libosmo-net In-Reply-To: <20110929000203.GF11041@prithivi.gnumonks.org> References: <20110927124712.GA24023@1984> <20110929000203.GF11041@prithivi.gnumonks.org> Message-ID: <20110929123328.GA7140@1984> Hi Harald, On Thu, Sep 29, 2011 at 09:02:03AM +0900, Harald Welte wrote: > On Tue, Sep 27, 2011 at 02:47:12PM +0200, Pablo Neira Ayuso wrote: > > This new library, whose proposed name can be "libosmo-net", would > > initially support: > > > > - E1 interfaces. > > - Ethernet + IPA TCP/IP. > > - rs232 (as required by bs11 its config interface). > > > > This support is included in libosmo-abis, so my idea is to extract > > this code from it and leave in libosmo-abis only the specific A-bis > > bits. > > I'm not sure if such a split is practical. What exactly woould remain > A-bis specific? The TRAU frame handling for voice channels? And other signalling bits, but yes, it would be fairly small library. > > For the A interface, I'd propose some hypothetical libosmo-a library > > that will contain the specific A interface protocols. > > Once again I'm not entirely convinced that this is neccessarry. We > already have libosmo-sccp for the SCCP parsing routines, and the > BSSAP/BSSMAP layer is handled in osmo-bsc directly. So I don't really > see what would be left over as A-specific parts. > > In order to stop further proliferation of small library fragments, I > would rather suggest to include any (if at all) remaining A-bis and A > related parts in the same libosmo-net. OK, we can put all in the same library. In order to re-use the existing networking interfaces in any GSM interface, I'm thinking about extracting some code from the e1input infrastructure and provide some generic API to create, destroy, write and read data, something like: #define OSMO_NETIF_T_NONE 0 #define OSMO_NETIF_T_DAHDI 1 #define OSMO_NETIF_T_MSISDN 2 #define OSMO_NETIF_T_IPA 3 #define OSMO_NETIF_T_RS232 4 #define OSMO_NETIF_T_WHATSOEVER 5 struct osmo_netif *osmo_netif_open(int type, ...); int osmo_netif_close(struct osmo_netif *if); int osmo_netif_read(struct osmo_netif *if, ...); int osmo_netif_enqueue(struct osmo_netif *if, ...); int osmo_netif_write(struct osmo_netif *if, ...); This would allow to open one net interface of some type, and use it to receive and to send information over it, no matter in it's on the A-bis, A, ... GSM interface. My preliminary planning could be: 1) Rip code from libosmo-abis (input drivers) to implement this new API in libosmo-netif. 2) Port openbsc to use this new API in the A interface. 3) Finally, put libosmo-abis into libosmo-netif. After that, we can consider libosmo-abis obsolete. Following this approach, we can support several network interfaces in the A interface soon. Then, we can spend time to supersede libosmo-abis. Or you consider that the e1input infrastructure is already flexible enough to support the A interface with relatively minor changes? I'm not sure. > btw: I'm still trying to come up with a better name. libosmo-signalling > is wrong as it will also deal with voice/trau/rtp. libosmo-interface > maybe? Also not a quite obvious naming. libosmo-netif as a compromise? libosmo-netif sounds fine to me. From laforge at gnumonks.org Fri Sep 30 08:47:38 2011 From: laforge at gnumonks.org (Harald Welte) Date: Fri, 30 Sep 2011 17:47:38 +0900 Subject: [RFC] proposal for new library: libosmo-net In-Reply-To: <20110929123328.GA7140@1984> References: <20110927124712.GA24023@1984> <20110929000203.GF11041@prithivi.gnumonks.org> <20110929123328.GA7140@1984> Message-ID: <20110930084738.GH3937@prithivi.gnumonks.org> Hi Pablo, On Thu, Sep 29, 2011 at 02:33:28PM +0200, Pablo Neira Ayuso wrote: > In order to re-use the existing networking interfaces in any GSM > interface, I'm thinking about extracting some code from the e1input > infrastructure and provide some generic API to create, destroy, write > and read data, something like: > > #define OSMO_NETIF_T_NONE 0 > #define OSMO_NETIF_T_DAHDI 1 > #define OSMO_NETIF_T_MSISDN 2 > #define OSMO_NETIF_T_IPA 3 > #define OSMO_NETIF_T_RS232 4 > #define OSMO_NETIF_T_WHATSOEVER 5 > > struct osmo_netif *osmo_netif_open(int type, ...); I think this should probably be a _reconfig() function, i.e. something that can process incremental changes to the configuration. It is very likely that the BSC process runs for a long time, and the E1 timeslot configuration / or other signallign configuration changes during runtime. So an initial "open" is not really sufficient. The _reconfig() calls could be triggered every time we "exit" from the VTY node that configures the like or signalling-link. I also think that the _open() / _reconfig() call could be device type specific, i.e. something like struct osmo_netif *osmo_netif_open_dahdi(...); struct osmo_netif *osmo_netif_open_ipa(...); ... as the parameters will probably be _very_ device type specific, it might not make sense to put all of it in one large union of structures. Also, I expect almost all users to use VTY for configuration, so we should have library-internal VTY support where we could have something like this for the VTY parsing inside the library: % a real circuit A-bis line on E1 (BS-11, Ericsson RBS, ..) line AbisLine0 description Foobar driver dahdi [driver-specific parameters] % a real circuit A line on E1 line ALine0 description ... driver misdn [driver-specific parameters] % a virtual A line over IPA line Aline1 description ... driver ipa-client ipa-client remote-ip A.B.C.D ipa-client remote-port <0-65535> ipa-client unit-id 1234 0 ipa-client authot-ken AbCdEf % a virtual A-bis line with IPA protocol like nanoBTS line AbisSrvOML0 description Foobaz driver ipa-server ipa-client local-ip A.B.C.D ipa-client local-port 3003 % a virtual A-bis line with IPA protocol like nanoBTS line AbisSrvRSL0 description Foobaz driver ipa-server ipa-client local-ip A.B.C.D ipa-client local-port 3002 signalling-link ALine0/0 description MyMscLink timeslot 1 sub-slot full encapsulation mtp [mtp-specific parameters] signalling-link AbisLine1/0 description MyBtsLink e1_timeslot 1 sub-slot full encapsulation lapd and then something like this (for the BSC): bsc a-interface signalling-link ALine0/0 % A BS-11 bts 0 oml tei 25 oml signalling-link Line1/0 trx 0 rsl tei 0 rsl signalling-link Line1/0 % an ip.access nanoBTS bts 1 oml tei 255 % IPA stream ID oml line AbisSrvOML0 oml ipa unit-id 1800 0 trx 0 rsl tei 0 % IPA stream ID rsl line AbisSrvRSL0 rsl ipa unit-id 1800 0 > 1) Rip code from libosmo-abis (input drivers) to implement this new > API in libosmo-netif. > 2) Port openbsc to use this new API in the A interface. > 3) Finally, put libosmo-abis into libosmo-netif. After that, we can > consider libosmo-abis obsolete. I think the existing libosmo-abis API might very well disappear, OpenBSC should use the netif library directly even for Abis -- - Harald Welte http://laforge.gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6) From gus at bourg.net Fri Sep 30 17:56:56 2011 From: gus at bourg.net (Gus Bourg) Date: Fri, 30 Sep 2011 10:56:56 -0700 Subject: GPRS not coming up on NanoBTS 140 Message-ID: Hello all, Looking for ideas. I have a NanoBTS Model 140 which doesn't seem to work with GPRS. It never connects to the SGSN. The openbsc/sgsn environment is ok - I can swap in another nano and it works fine. I've taken some log captures: