summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_init.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2016-10-26 15:19:41 +0200
committerHarald Welte <laforge@gnumonks.org>2017-05-25 14:04:08 +0200
commitb4999b60d48bcbb5aa575973d068e07ab672e095 (patch)
tree6daf591f6bd52976cf0513a3f73df8bd158d6cc0 /openbsc/src/libbsc/bsc_init.c
parent94bbc73bce304609124e9f617953a11634905d58 (diff)
pcu_sock: add basic pcu interface support
Adds a basic version of a pcu socket interface, similar to the one that can be found in osmo-bts. Change-Id: Ib13cb4099d12fa71e9e0b8727e19ab29e11909b2
Diffstat (limited to 'openbsc/src/libbsc/bsc_init.c')
-rw-r--r--openbsc/src/libbsc/bsc_init.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 2af846e72..50c73db03 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -37,6 +37,8 @@
#include <osmocom/gsm/sysinfo.h>
#include <openbsc/e1_config.h>
#include <openbsc/common_bsc.h>
+#include <openbsc/pcu_if.h>
+#include <limits.h>
/* global pointer to the gsm network data structure */
extern struct gsm_network *bsc_gsmnet;
@@ -191,6 +193,10 @@ int gsm_bts_trx_set_system_infos(struct gsm_bts_trx *trx)
return rc;
}
+ /* Make sure the PCU is aware (in case anything GPRS related has
+ * changed in SI */
+ pcu_info_update(bts);
+
return 0;
err_out:
LOGP(DRR, LOGL_ERROR, "Cannot generate SI%s for BTS %u: error <%s>, "
@@ -486,6 +492,7 @@ static int bootstrap_bts(struct gsm_bts *bts)
int bsc_network_alloc(mncc_recv_cb_t mncc_recv)
{
+ /* initialize our data structures */
bsc_gsmnet = bsc_network_init(tall_bsc_ctx, 1, 1, mncc_recv);
if (!bsc_gsmnet)
return -ENOMEM;
@@ -500,6 +507,8 @@ int bsc_network_configure(const char *config_file)
{
struct gsm_bts *bts;
int rc;
+ char pcu_sock_path[PATH_MAX];
+ char pcu_sock_path_ending[PATH_MAX];
rc = vty_read_config_file(config_file, NULL);
if (rc < 0) {
@@ -527,6 +536,19 @@ int bsc_network_configure(const char *config_file)
LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");
return rc;
}
+
+ strcpy(pcu_sock_path, PCU_SOCK_DEFAULT);
+ sprintf(pcu_sock_path_ending,"_%i", bts->nr);
+ if (bts->nr > 0)
+ strcat(pcu_sock_path, pcu_sock_path_ending);
+ rc = pcu_sock_init(pcu_sock_path, bts);
+
+ if (rc < 0) {
+ LOGP(DNM, LOGL_FATAL,
+ "PCU L1 socket failed for bts %i\n", bts->nr);
+ return rc;
+ }
}
+
return 0;
}