[MERGED] osmo-bsc[master]: common_cs.h: mv gsm_encr to gsm_data.h
Neels Hofmeyr has submitted this change and it was merged. Change subject: common_cs.h: mv gsm_encr to gsm_data.h .. common_cs.h: mv gsm_encr to gsm_data.h This leaves common_cs.h practically empty. Leave its removal to the next patch, which removes libcommon-cs entirely (I07d4a48af3154ee4d904686f230a51b8b8a94ff9). Change-Id: Ic3233f03580aa8c0ab178dfd33e68ecab5b9f042 --- M include/osmocom/bsc/common_cs.h M include/osmocom/bsc/gsm_data.h 2 files changed, 8 insertions(+), 8 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index f751a43..b6a8ed8 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -7,11 +7,3 @@ struct gsm_network; struct vty; - -#define MAX_A5_KEY_LEN (128/8) - -struct gsm_encr { - uint8_t alg_id; - uint8_t key_len; - uint8_t key[MAX_A5_KEY_LEN]; -}; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 1d12f3d..8af594f 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -300,6 +300,14 @@ LCHAN_SAPI_S_ERROR, }; +#define MAX_A5_KEY_LEN (128/8) + +struct gsm_encr { + uint8_t alg_id; + uint8_t key_len; + uint8_t key[MAX_A5_KEY_LEN]; +}; + struct gsm_lchan { /* The TS that we're part of */ struct gsm_bts_trx_ts *ts; -- To view, visit https://gerrit.osmocom.org/6442 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic3233f03580aa8c0ab178dfd33e68ecab5b9f042 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[PATCH] osmo-bsc[master]: libcommon-cs: move a_reset.c into libbsc
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6437 to look at the new patch set (#4). libcommon-cs: move a_reset.c into libbsc a_reset.c was originally used by both libmsc and libbsc in the old openbsc.git repository. Now osmo-msc.git has its own copy, and the idea of sharing libcommon-cs is no longer applicable. Move it to libbsc where it belongs. Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5 --- M src/libbsc/Makefile.am R src/libbsc/a_reset.c M src/libcommon-cs/Makefile.am 3 files changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/37/6437/4 diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am index f03b498..e68ada8 100644 --- a/src/libbsc/Makefile.am +++ b/src/libbsc/Makefile.am @@ -27,6 +27,7 @@ abis_om2000.c \ abis_om2000_vty.c \ abis_rsl.c \ + a_reset.c \ bsc_rll.c \ bsc_subscriber.c \ paging.c \ diff --git a/src/libcommon-cs/a_reset.c b/src/libbsc/a_reset.c similarity index 100% rename from src/libcommon-cs/a_reset.c rename to src/libbsc/a_reset.c diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am index 8cca1d7..e549509 100644 --- a/src/libcommon-cs/Makefile.am +++ b/src/libcommon-cs/Makefile.am @@ -17,6 +17,5 @@ noinst_LIBRARIES = libcommon-cs.a libcommon_cs_a_SOURCES = \ - a_reset.c \ common_cs.c \ common_cs_vty.c -- To view, visit https://gerrit.osmocom.org/6437 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-bsc[master]: libcommon_cs: move gsm48 bits to libbsc
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6440 to look at the new patch set (#4). libcommon_cs: move gsm48 bits to libbsc These functions were originally shared between libmsc and libbsc in the old openbsc.git; now osmo-bsc.git has its own copies, so move them into libbsc. Change-Id: Ie411c2ce8008accee54782a442d6361e50777a54 --- M include/osmocom/bsc/common_cs.h M include/osmocom/bsc/gsm_04_08_utils.h M src/libbsc/gsm_04_08_utils.c M src/libcommon-cs/common_cs.c M src/libfilter/bsc_msg_filter.c M src/osmo-bsc/osmo_bsc_filter.c 6 files changed, 65 insertions(+), 63 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/40/6440/4 diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index 432d4d5..dccc7b5 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -19,9 +19,3 @@ int common_cs_vty_init(struct gsm_network *network, int (* config_write_net )(struct vty *)); struct gsm_network *gsmnet_from_vty(struct vty *v); - -struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); -int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_t *mi_type); -int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length, - char *mi_string, uint8_t *mi_type); -struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); diff --git a/include/osmocom/bsc/gsm_04_08_utils.h b/include/osmocom/bsc/gsm_04_08_utils.h index 625f173..34979ab 100644 --- a/include/osmocom/bsc/gsm_04_08_utils.h +++ b/include/osmocom/bsc/gsm_04_08_utils.h @@ -22,6 +22,12 @@ int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn, enum gsm48_reject_value value); +struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value); +int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_t *mi_type); +int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length, + char *mi_string, uint8_t *mi_type); +struct msgb *gsm48_create_loc_upd_rej(uint8_t cause); + #define GSM48_ALLOC_SIZE2048 #define GSM48_ALLOC_HEADROOM256 diff --git a/src/libbsc/gsm_04_08_utils.c b/src/libbsc/gsm_04_08_utils.c index 85eb7b5..3004e5d 100644 --- a/src/libbsc/gsm_04_08_utils.c +++ b/src/libbsc/gsm_04_08_utils.c @@ -636,3 +636,60 @@ return gsm0808_submit_dtap(conn, msg, 0, 0); } + +struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value) +{ + struct msgb *msg; + struct gsm48_hdr *gh; + + msg = gsm48_msgb_alloc_name("GSM 04.08 SERV REJ"); + if (!msg) + return NULL; + + gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); + gh->proto_discr = GSM48_PDISC_MM; + gh->msg_type = GSM48_MT_MM_CM_SERV_REJ; + gh->data[0] = value; + + return msg; +} + +struct msgb *gsm48_create_loc_upd_rej(uint8_t cause) +{ + struct gsm48_hdr *gh; + struct msgb *msg; + + msg = gsm48_msgb_alloc_name("GSM 04.08 LOC UPD REJ"); + if (!msg) + return NULL; + + gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); + gh->proto_discr = GSM48_PDISC_MM; + gh->msg_type = GSM48_MT_MM_LOC_UPD_REJECT; + gh->data[0] = cause; + return msg; +} + +int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, uint8_t *mi_type) +{ + /* Check the size for the classmark */ + if (length < 1 + *classmark2_lv) + return -1; + + uint8_t *mi_lv = classmark2_lv + *classmark2_lv + 1; + if (length < 2 + *classmark2_lv + mi_lv[0]) + return -2; + + *mi_type = mi_lv[1] & GSM_MI_TYPE_MASK; + return gsm48_mi_to_string(mi_string, GSM48_MI_SIZE, mi_lv+1, *mi_lv); +} + +int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length, + char *mi_string, uint8_t *mi_type) +{ + static const uint32_t classmark_offset = + offsetof(struct gsm48_pag_resp, classmark2); + uint8_t *classmark2_lv = (uint8_t *) &resp->classmark2; + return gsm48_extract_mi(classmark2_lv, length - classmark_offset, + mi_string, mi_type); +} diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c index 0520e96..9307f63 100644 --- a/src/libcommon-cs/common_cs.c +++ b/src/libcommon-cs/common_cs.c @@ -30,59 +30,3 @@ #include #include -struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value) -{ - struct msgb *msg; - struct gsm48_hdr *gh; - - msg = gsm48_msgb_alloc_name("GSM 04.08 SERV REJ"); - if (!msg) - return NULL; - - gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1); - gh->proto_discr = GSM48_PDISC_MM; - gh->msg_type = GSM48_MT_MM_CM_SERV_REJ; - gh->data[0] = value; - - return msg; -} - -str
[PATCH] osmo-bsc[master]: libcommon-cs: move vty bits to libbsc/bsc_vty.c
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6441 to look at the new patch set (#4). libcommon-cs: move vty bits to libbsc/bsc_vty.c The gsm_network VTY was partly shared between libmsc and libbsc in the old openbsc.git; now osmo-bsc.git has its own copy, so merge all of it into bsc_vty.c. This leaves common_cs_vty.c practically empty; leave removal of the file to later, when we drop the entire libcommon-cs in I07d4a48af3154ee4d904686f230a51b8b8a94ff9. Note that gsmnet_from_vty() is also already declared in bsc/vty.h. Change-Id: I6f3a596f31762b48afed39a85a343c400826300f --- M include/osmocom/bsc/common_cs.h M src/libbsc/bsc_vty.c M src/libcommon-cs/common_cs_vty.c 3 files changed, 197 insertions(+), 209 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/41/6441/4 diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index dccc7b5..f751a43 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -15,7 +15,3 @@ uint8_t key_len; uint8_t key[MAX_A5_KEY_LEN]; }; - -int common_cs_vty_init(struct gsm_network *network, - int (* config_write_net )(struct vty *)); -struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index a719358..1407061 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -115,6 +115,12 @@ { 0, NULL } }; +struct cmd_node net_node = { + GSMNET_NODE, + "%s(config-net)# ", + 1, +}; + struct cmd_node bts_node = { BTS_NODE, "%s(config-net-bts)# ", @@ -132,6 +138,20 @@ "%s(config-net-bts-trx-ts)# ", 1, }; + +static struct gsm_network *vty_global_gsm_network = NULL; + +struct gsm_network *gsmnet_from_vty(struct vty *v) +{ + /* It can't hurt to force callers to continue to pass the vty instance +* to this function, in case we'd like to retrieve the global +* gsm_network instance from the vty at some point in the future. But +* until then, just return the global pointer, which should have been +* initialized by common_cs_vty_init(). +*/ + OSMO_ASSERT(vty_global_gsm_network); + return vty_global_gsm_network; +} static int dummy_config_write(struct vty *v) { @@ -4269,6 +4289,167 @@ return CMD_SUCCESS; } +#define NETWORK_STR "Configure the GSM network\n" +#define CODE_CMD_STR "Code commands\n" +#define NAME_CMD_STR "Name Commands\n" +#define NAME_STR "Name to use\n" + +DEFUN(cfg_net, + cfg_net_cmd, + "network", NETWORK_STR) +{ + vty->index = gsmnet_from_vty(vty); + vty->node = GSMNET_NODE; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_ncc, + cfg_net_ncc_cmd, + "network country code <1-999>", + "Set the GSM network country code\n" + "Country commands\n" + CODE_CMD_STR + "Network Country Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->country_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_mnc, + cfg_net_mnc_cmd, + "mobile network code <0-999>", + "Set the GSM mobile network code\n" + "Network Commands\n" + CODE_CMD_STR + "Mobile Network Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->network_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_encryption, + cfg_net_encryption_cmd, + "encryption a5 (0|1|2|3)", + "Encryption options\n" + "A5 encryption\n" "A5/0: No encryption\n" + "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n" + "A5/3: 'New' Secure Encryption\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->a5_encryption = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_dyn_ts_allow_tch_f, + cfg_net_dyn_ts_allow_tch_f_cmd, + "dyn_ts_allow_tch_f (0|1)", + "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n" + "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n" + "Allow TCH/F on TCH_F_TCH_H_PDCH\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false; + return CMD_SUCCESS; +} + +DEFUN(cfg_net_timezone, + cfg_net_timezone_cmd, + "timezone <-19-19> (0|15|30|45)", + "Set the Timezone Offset of the network\n" + "Timezone offset (hours)\n" + "Timezone offset (00 minutes)\n" + "Timezone offset (15 minutes)\n" + "Timezone offset (30 minutes)\n" + "Timezone offset (45 minutes)\n" + ) +{ + struct gsm_network *net = vty->index; + int tzhr = atoi(argv[0]); + int tzmn = atoi(argv[1]); + + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = 0; + net->tz.override = 1; + + return CMD_SUCCESS; +} + +DEFUN(cfg_n
[MERGED] osmo-bsc[master]: libcommon-cs: move gsm_network_init() into bsc_network_init()
Neels Hofmeyr has submitted this change and it was merged. Change subject: libcommon-cs: move gsm_network_init() into bsc_network_init() .. libcommon-cs: move gsm_network_init() into bsc_network_init() Some part of the network init was common between libbsc and libmsc in the old openbsc.git repository. Now osmo-bsc.git is independent with its own copy of the gsm_network initialization. So move it over to libbsc. Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af --- M include/osmocom/bsc/common_cs.h M src/libbsc/net_init.c M src/libcommon-cs/common_cs.c 3 files changed, 15 insertions(+), 38 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index c2e8515..432d4d5 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -16,10 +16,6 @@ uint8_t key[MAX_A5_KEY_LEN]; }; -struct gsm_network *gsm_network_init(void *ctx, -uint16_t country_code, -uint16_t network_code); - int common_cs_vty_init(struct gsm_network *network, int (* config_write_net )(struct vty *)); struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c index 435c0ce..4fa59ed 100644 --- a/src/libbsc/net_init.c +++ b/src/libbsc/net_init.c @@ -45,7 +45,21 @@ { struct gsm_network *net; - net = gsm_network_init(ctx, country_code, network_code); + net = talloc_zero(ctx, struct gsm_network); + if (!net) + return NULL; + + net->country_code = country_code; + net->network_code = network_code; + + /* Use 30 min periodic update interval as sane default */ + net->t3212 = 5; + + INIT_LLIST_HEAD(&net->trans_list); + INIT_LLIST_HEAD(&net->subscr_conns); + + net->bsc_subscribers = talloc_zero(net, struct llist_head); + INIT_LLIST_HEAD(net->bsc_subscribers); net->bsc_data = talloc_zero(net, struct osmo_bsc_data); if (!net->bsc_data) { diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c index 39df45e..0520e96 100644 --- a/src/libcommon-cs/common_cs.c +++ b/src/libcommon-cs/common_cs.c @@ -30,39 +30,6 @@ #include #include -/* Warning: if bsc_network_init() is not called, some of the members of - * gsm_network are not initialized properly and must not be used! (In - * particular the llist heads and stats counters.) - * The long term aim should be to have entirely separate structs for libbsc and - * libmsc with some common general items. - */ -struct gsm_network *gsm_network_init(void *ctx, -uint16_t country_code, -uint16_t network_code) -{ - struct gsm_network *net; - - net = talloc_zero(ctx, struct gsm_network); - if (!net) - return NULL; - - net->country_code = country_code; - net->network_code = network_code; - - /* Use 30 min periodic update interval as sane default */ - net->t3212 = 5; - - INIT_LLIST_HEAD(&net->trans_list); - INIT_LLIST_HEAD(&net->subscr_conns); - - net->bsc_subscribers = talloc_zero(net, struct llist_head); - INIT_LLIST_HEAD(net->bsc_subscribers); - - net->dyn_ts_allow_tch_f = true; - - return net; -} - struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value) { struct msgb *msg; -- To view, visit https://gerrit.osmocom.org/6438 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[PATCH] osmo-bsc[master]: gsm_network: drop unused subscr_epxire_timer
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6445 to look at the new patch set (#4). gsm_network: drop unused subscr_epxire_timer Change-Id: I2e34ffb35e244472f8bfc993facc8d6e130f10d9 --- M include/osmocom/bsc/gsm_data.h 1 file changed, 0 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/6445/4 diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index fc745a2..3da4fff 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1169,9 +1169,6 @@ int T3122; int T3141; - /* timer to expire old location updates */ - struct osmo_timer_list subscr_expire_timer; - enum gsm_chan_t ctype_by_chreq[_NUM_CHREQ_T]; /* Use a TCH for handling requests of type paging any */ -- To view, visit https://gerrit.osmocom.org/6445 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I2e34ffb35e244472f8bfc993facc8d6e130f10d9 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmo-bsc[master]: libcommon-cs: move vty bits to libbsc/bsc_vty.c
Neels Hofmeyr has submitted this change and it was merged. Change subject: libcommon-cs: move vty bits to libbsc/bsc_vty.c .. libcommon-cs: move vty bits to libbsc/bsc_vty.c The gsm_network VTY was partly shared between libmsc and libbsc in the old openbsc.git; now osmo-bsc.git has its own copy, so merge all of it into bsc_vty.c. This leaves common_cs_vty.c practically empty; leave removal of the file to later, when we drop the entire libcommon-cs in I07d4a48af3154ee4d904686f230a51b8b8a94ff9. Note that gsmnet_from_vty() is also already declared in bsc/vty.h. Change-Id: I6f3a596f31762b48afed39a85a343c400826300f --- M include/osmocom/bsc/common_cs.h M src/libbsc/bsc_vty.c M src/libcommon-cs/common_cs_vty.c 3 files changed, 197 insertions(+), 209 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h index dccc7b5..f751a43 100644 --- a/include/osmocom/bsc/common_cs.h +++ b/include/osmocom/bsc/common_cs.h @@ -15,7 +15,3 @@ uint8_t key_len; uint8_t key[MAX_A5_KEY_LEN]; }; - -int common_cs_vty_init(struct gsm_network *network, - int (* config_write_net )(struct vty *)); -struct gsm_network *gsmnet_from_vty(struct vty *v); diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index a719358..1407061 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -115,6 +115,12 @@ { 0, NULL } }; +struct cmd_node net_node = { + GSMNET_NODE, + "%s(config-net)# ", + 1, +}; + struct cmd_node bts_node = { BTS_NODE, "%s(config-net-bts)# ", @@ -132,6 +138,20 @@ "%s(config-net-bts-trx-ts)# ", 1, }; + +static struct gsm_network *vty_global_gsm_network = NULL; + +struct gsm_network *gsmnet_from_vty(struct vty *v) +{ + /* It can't hurt to force callers to continue to pass the vty instance +* to this function, in case we'd like to retrieve the global +* gsm_network instance from the vty at some point in the future. But +* until then, just return the global pointer, which should have been +* initialized by common_cs_vty_init(). +*/ + OSMO_ASSERT(vty_global_gsm_network); + return vty_global_gsm_network; +} static int dummy_config_write(struct vty *v) { @@ -4269,6 +4289,167 @@ return CMD_SUCCESS; } +#define NETWORK_STR "Configure the GSM network\n" +#define CODE_CMD_STR "Code commands\n" +#define NAME_CMD_STR "Name Commands\n" +#define NAME_STR "Name to use\n" + +DEFUN(cfg_net, + cfg_net_cmd, + "network", NETWORK_STR) +{ + vty->index = gsmnet_from_vty(vty); + vty->node = GSMNET_NODE; + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_ncc, + cfg_net_ncc_cmd, + "network country code <1-999>", + "Set the GSM network country code\n" + "Country commands\n" + CODE_CMD_STR + "Network Country Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->country_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_mnc, + cfg_net_mnc_cmd, + "mobile network code <0-999>", + "Set the GSM mobile network code\n" + "Network Commands\n" + CODE_CMD_STR + "Mobile Network Code to use\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->network_code = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_encryption, + cfg_net_encryption_cmd, + "encryption a5 (0|1|2|3)", + "Encryption options\n" + "A5 encryption\n" "A5/0: No encryption\n" + "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n" + "A5/3: 'New' Secure Encryption\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + + gsmnet->a5_encryption = atoi(argv[0]); + + return CMD_SUCCESS; +} + +DEFUN(cfg_net_dyn_ts_allow_tch_f, + cfg_net_dyn_ts_allow_tch_f_cmd, + "dyn_ts_allow_tch_f (0|1)", + "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n" + "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n" + "Allow TCH/F on TCH_F_TCH_H_PDCH\n") +{ + struct gsm_network *gsmnet = gsmnet_from_vty(vty); + gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false; + return CMD_SUCCESS; +} + +DEFUN(cfg_net_timezone, + cfg_net_timezone_cmd, + "timezone <-19-19> (0|15|30|45)", + "Set the Timezone Offset of the network\n" + "Timezone offset (hours)\n" + "Timezone offset (00 minutes)\n" + "Timezone offset (15 minutes)\n" + "Timezone offset (30 minutes)\n" + "Timezone offset (45 minutes)\n" + ) +{ + struct gsm_network *net = vty->index; + int tzhr = atoi(argv[0]); + int tzmn = atoi(argv[1]); + + net->tz.hr = tzhr; + net->tz.mn = tzmn; + net->tz.dst = 0; + net->tz.override = 1; + +
[PATCH] osmo-bsc[master]: drop unused common.h
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6444 to look at the new patch set (#4). drop unused common.h Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f --- M include/osmocom/bsc/Makefile.am D include/osmocom/bsc/common.h M include/osmocom/bsc/gsm_data.h 3 files changed, 0 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/44/6444/4 diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index f975947..b996070 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -14,7 +14,6 @@ bss.h \ bts_ipaccess_nanobts_omlattr.h \ chan_alloc.h \ - common.h \ common_bsc.h \ ctrl.h \ debug.h \ diff --git a/include/osmocom/bsc/common.h b/include/osmocom/bsc/common.h deleted file mode 100644 index d91b3d3..000 --- a/include/osmocom/bsc/common.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -enum nsap_addr_enc { - NSAP_ADDR_ENC_X213, - NSAP_ADDR_ENC_V4RAW, -}; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index d1a901e..fc745a2 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -15,7 +15,6 @@ #include -#include #include #include -- To view, visit https://gerrit.osmocom.org/6444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-bsc[master]: drop libcommon-cs completely
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6443 to look at the new patch set (#4). drop libcommon-cs completely Change-Id: I07d4a48af3154ee4d904686f230a51b8b8a94ff9 --- M configure.ac M include/osmocom/bsc/Makefile.am M include/osmocom/bsc/common_bsc.h D include/osmocom/bsc/common_cs.h M include/osmocom/bsc/gsm_data.h M src/Makefile.am M src/ipaccess/Makefile.am M src/libbsc/Makefile.am M src/libbsc/bsc_vty.c M src/libbsc/net_init.c D src/libcommon-cs/Makefile.am D src/libcommon-cs/common_cs.c D src/libcommon-cs/common_cs_vty.c M src/osmo-bsc/Makefile.am M src/osmo-bsc/osmo_bsc_filter.c M src/osmo-bsc_nat/Makefile.am M src/osmo-bsc_nat/bsc_nat.c M src/utils/Makefile.am M tests/abis/Makefile.am M tests/bsc-nat/Makefile.am M tests/bsc/Makefile.am M tests/bssap/Makefile.am M tests/channel/Makefile.am M tests/gsm0408/Makefile.am M tests/nanobts_omlattr/Makefile.am M tests/subscr/Makefile.am 26 files changed, 2 insertions(+), 114 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/43/6443/4 diff --git a/configure.ac b/configure.ac index b2644fe..dac222f 100644 --- a/configure.ac +++ b/configure.ac @@ -150,7 +150,6 @@ src/Makefile src/libbsc/Makefile src/libfilter/Makefile -src/libcommon-cs/Makefile src/osmo-bsc/Makefile src/ipaccess/Makefile src/utils/Makefile diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index c503a50..f975947 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -16,7 +16,6 @@ chan_alloc.h \ common.h \ common_bsc.h \ - common_cs.h \ ctrl.h \ debug.h \ e1_config.h \ diff --git a/include/osmocom/bsc/common_bsc.h b/include/osmocom/bsc/common_bsc.h index 32e5097..d3c7ff5 100644 --- a/include/osmocom/bsc/common_bsc.h +++ b/include/osmocom/bsc/common_bsc.h @@ -1,7 +1,6 @@ #pragma once #include -#include struct gsm_network *bsc_network_init(void *ctx, uint16_t country_code, diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h deleted file mode 100644 index b6a8ed8..000 --- a/include/osmocom/bsc/common_cs.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include - -struct msgb; -struct gsm_network; - -struct vty; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 8af594f..d1a901e 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/src/Makefile.am b/src/Makefile.am index 28b070e..fc9bf8e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,6 @@ # Libraries SUBDIRS = \ - libcommon-cs \ libbsc \ libfilter \ $(NULL) diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am index 0301d3a..a6195b9 100644 --- a/src/ipaccess/Makefile.am +++ b/src/ipaccess/Makefile.am @@ -46,7 +46,6 @@ # FIXME: resolve the bogus dependencies patched around here: ipaccess_config_LDADD = \ $(top_builddir)/src/libbsc/libbsc.a \ - $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(OSMO_LIBS) \ $(NULL) diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am index e68ada8..e8e69c7 100644 --- a/src/libbsc/Makefile.am +++ b/src/libbsc/Makefile.am @@ -19,8 +19,6 @@ libbsc.a \ $(NULL) -libbsc_a_LIBADD = $(top_builddir)/src/libcommon-cs/libcommon-cs.a - libbsc_a_SOURCES = \ abis_nm.c \ abis_nm_vty.c \ diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 1407061..f1cbb54 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c index c5c7c5e..90f668f 100644 --- a/src/libbsc/net_init.c +++ b/src/libbsc/net_init.c @@ -17,7 +17,6 @@ * */ -#include #include #include #include diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am deleted file mode 100644 index e549509..000 --- a/src/libcommon-cs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -AM_CPPFLAGS = \ - $(all_includes) \ - -I$(top_srcdir)/include \ - -I$(top_builddir) \ - $(NULL) - -AM_CFLAGS = \ - -Wall \ - $(LIBOSMOCORE_CFLAGS) \ - $(LIBOSMOGSM_CFLAGS) \ - $(LIBOSMOVTY_CFLAGS) \ - $(LIBOSMOABIS_CFLAGS) \ - $(LIBOSMOSIGTRAN_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(NULL) - -noinst_LIBRARIES = libcommon-cs.a - -libcommon_cs_a_SOURCES = \ - common_cs.c \ - common_cs_vty.c diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c deleted file mode 100644 index 9307f63..000 --- a/src/libcommon-cs/common_cs.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Code used by both libbsc and libmsc (comm
[MERGED] osmo-bsc[master]: drop unused common.h
Neels Hofmeyr has submitted this change and it was merged. Change subject: drop unused common.h .. drop unused common.h Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f --- M include/osmocom/bsc/Makefile.am D include/osmocom/bsc/common.h M include/osmocom/bsc/gsm_data.h 3 files changed, 0 insertions(+), 8 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index f975947..b996070 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -14,7 +14,6 @@ bss.h \ bts_ipaccess_nanobts_omlattr.h \ chan_alloc.h \ - common.h \ common_bsc.h \ ctrl.h \ debug.h \ diff --git a/include/osmocom/bsc/common.h b/include/osmocom/bsc/common.h deleted file mode 100644 index d91b3d3..000 --- a/include/osmocom/bsc/common.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -enum nsap_addr_enc { - NSAP_ADDR_ENC_X213, - NSAP_ADDR_ENC_V4RAW, -}; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index d1a901e..fc745a2 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -15,7 +15,6 @@ #include -#include #include #include -- To view, visit https://gerrit.osmocom.org/6444 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[MERGED] osmo-bsc[master]: drop libcommon-cs completely
Neels Hofmeyr has submitted this change and it was merged. Change subject: drop libcommon-cs completely .. drop libcommon-cs completely Change-Id: I07d4a48af3154ee4d904686f230a51b8b8a94ff9 --- M configure.ac M include/osmocom/bsc/Makefile.am M include/osmocom/bsc/common_bsc.h D include/osmocom/bsc/common_cs.h M include/osmocom/bsc/gsm_data.h M src/Makefile.am M src/ipaccess/Makefile.am M src/libbsc/Makefile.am M src/libbsc/bsc_vty.c M src/libbsc/net_init.c D src/libcommon-cs/Makefile.am D src/libcommon-cs/common_cs.c D src/libcommon-cs/common_cs_vty.c M src/osmo-bsc/Makefile.am M src/osmo-bsc/osmo_bsc_filter.c M src/osmo-bsc_nat/Makefile.am M src/osmo-bsc_nat/bsc_nat.c M src/utils/Makefile.am M tests/abis/Makefile.am M tests/bsc-nat/Makefile.am M tests/bsc/Makefile.am M tests/bssap/Makefile.am M tests/channel/Makefile.am M tests/gsm0408/Makefile.am M tests/nanobts_omlattr/Makefile.am M tests/subscr/Makefile.am 26 files changed, 2 insertions(+), 114 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/configure.ac b/configure.ac index b2644fe..dac222f 100644 --- a/configure.ac +++ b/configure.ac @@ -150,7 +150,6 @@ src/Makefile src/libbsc/Makefile src/libfilter/Makefile -src/libcommon-cs/Makefile src/osmo-bsc/Makefile src/ipaccess/Makefile src/utils/Makefile diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am index c503a50..f975947 100644 --- a/include/osmocom/bsc/Makefile.am +++ b/include/osmocom/bsc/Makefile.am @@ -16,7 +16,6 @@ chan_alloc.h \ common.h \ common_bsc.h \ - common_cs.h \ ctrl.h \ debug.h \ e1_config.h \ diff --git a/include/osmocom/bsc/common_bsc.h b/include/osmocom/bsc/common_bsc.h index 32e5097..d3c7ff5 100644 --- a/include/osmocom/bsc/common_bsc.h +++ b/include/osmocom/bsc/common_bsc.h @@ -1,7 +1,6 @@ #pragma once #include -#include struct gsm_network *bsc_network_init(void *ctx, uint16_t country_code, diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h deleted file mode 100644 index b6a8ed8..000 --- a/include/osmocom/bsc/common_cs.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include - -struct msgb; -struct gsm_network; - -struct vty; diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 8af594f..d1a901e 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -17,7 +17,6 @@ #include #include -#include #include #include diff --git a/src/Makefile.am b/src/Makefile.am index 28b070e..fc9bf8e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,6 @@ # Libraries SUBDIRS = \ - libcommon-cs \ libbsc \ libfilter \ $(NULL) diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am index 0301d3a..a6195b9 100644 --- a/src/ipaccess/Makefile.am +++ b/src/ipaccess/Makefile.am @@ -46,7 +46,6 @@ # FIXME: resolve the bogus dependencies patched around here: ipaccess_config_LDADD = \ $(top_builddir)/src/libbsc/libbsc.a \ - $(top_builddir)/src/libcommon-cs/libcommon-cs.a \ $(OSMO_LIBS) \ $(NULL) diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am index e68ada8..e8e69c7 100644 --- a/src/libbsc/Makefile.am +++ b/src/libbsc/Makefile.am @@ -19,8 +19,6 @@ libbsc.a \ $(NULL) -libbsc_a_LIBADD = $(top_builddir)/src/libcommon-cs/libcommon-cs.a - libbsc_a_SOURCES = \ abis_nm.c \ abis_nm_vty.c \ diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 1407061..f1cbb54 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c index c5c7c5e..90f668f 100644 --- a/src/libbsc/net_init.c +++ b/src/libbsc/net_init.c @@ -17,7 +17,6 @@ * */ -#include #include #include #include diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am deleted file mode 100644 index e549509..000 --- a/src/libcommon-cs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -AM_CPPFLAGS = \ - $(all_includes) \ - -I$(top_srcdir)/include \ - -I$(top_builddir) \ - $(NULL) - -AM_CFLAGS = \ - -Wall \ - $(LIBOSMOCORE_CFLAGS) \ - $(LIBOSMOGSM_CFLAGS) \ - $(LIBOSMOVTY_CFLAGS) \ - $(LIBOSMOABIS_CFLAGS) \ - $(LIBOSMOSIGTRAN_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(NULL) - -noinst_LIBRARIES = libcommon-cs.a - -libcommon_cs_a_SOURCES = \ - common_cs.c \ - common_cs_vty.c diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c deleted file mode 100644 index 9307f63..000 --- a/src/libcommon-cs/common_cs.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Code used by bot
[MERGED] osmo-bsc[master]: libcommon-cs: move a_reset.c into libbsc
Neels Hofmeyr has submitted this change and it was merged. Change subject: libcommon-cs: move a_reset.c into libbsc .. libcommon-cs: move a_reset.c into libbsc a_reset.c was originally used by both libmsc and libbsc in the old openbsc.git repository. Now osmo-msc.git has its own copy, and the idea of sharing libcommon-cs is no longer applicable. Move it to libbsc where it belongs. Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5 --- M src/libbsc/Makefile.am R src/libbsc/a_reset.c M src/libcommon-cs/Makefile.am 3 files changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am index f03b498..e68ada8 100644 --- a/src/libbsc/Makefile.am +++ b/src/libbsc/Makefile.am @@ -27,6 +27,7 @@ abis_om2000.c \ abis_om2000_vty.c \ abis_rsl.c \ + a_reset.c \ bsc_rll.c \ bsc_subscriber.c \ paging.c \ diff --git a/src/libcommon-cs/a_reset.c b/src/libbsc/a_reset.c similarity index 100% rename from src/libcommon-cs/a_reset.c rename to src/libbsc/a_reset.c diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am index 8cca1d7..e549509 100644 --- a/src/libcommon-cs/Makefile.am +++ b/src/libcommon-cs/Makefile.am @@ -17,6 +17,5 @@ noinst_LIBRARIES = libcommon-cs.a libcommon_cs_a_SOURCES = \ - a_reset.c \ common_cs.c \ common_cs_vty.c -- To view, visit https://gerrit.osmocom.org/6437 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr