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
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 2af846e..50c73db 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 @@
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 @@
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 @@
{
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 @@
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;
}