aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/a_iface.h3
-rw-r--r--openbsc/include/openbsc/gsm_data.h2
-rw-r--r--openbsc/include/openbsc/iu.h3
-rw-r--r--openbsc/src/gprs/sgsn_main.c16
-rw-r--r--openbsc/src/libiu/iu.c8
-rw-r--r--openbsc/src/libmsc/a_iface.c14
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_main.c2
-rw-r--r--openbsc/src/osmo-msc/msc_main.c16
8 files changed, 37 insertions, 27 deletions
diff --git a/openbsc/include/openbsc/a_iface.h b/openbsc/include/openbsc/a_iface.h
index 483ffa47f..b27c3db83 100644
--- a/openbsc/include/openbsc/a_iface.h
+++ b/openbsc/include/openbsc/a_iface.h
@@ -19,8 +19,7 @@
*/
/* Initalize A interface connection between to MSC and BSC */
-int a_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port, struct gsm_network *network);
+int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network);
/* Send DTAP message via A-interface */
int a_iface_tx_dtap(struct msgb *msg);
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index b07cac4a8..39e2227e0 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -478,6 +478,8 @@ struct gsm_network {
struct {
enum nsap_addr_enc rab_assign_addr_enc;
} iu;
+
+ struct osmo_sccp_instance *sccp;
};
struct osmo_esme;
diff --git a/openbsc/include/openbsc/iu.h b/openbsc/include/openbsc/iu.h
index a0c481aae..65d41ad74 100644
--- a/openbsc/include/openbsc/iu.h
+++ b/openbsc/include/openbsc/iu.h
@@ -62,8 +62,7 @@ typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx,
typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id,
struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
-int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port,
+int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
int iu_tx(struct msgb *msg, uint8_t sapi);
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index 200e803fb..52c300cee 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -61,6 +61,8 @@
#include <osmocom/ctrl/control_if.h>
#include <osmocom/ctrl/ports.h>
+#include <osmocom/sigtran/protocol/m3ua.h>
+
#include <gtp.h>
#include "../../bscconfig.h"
@@ -322,6 +324,7 @@ int main(int argc, char **argv)
{
struct ctrl_handle *ctrl;
struct gsm_network dummy_network;
+ struct osmo_sccp_instance *sccp;
int rc;
srand(time(NULL));
@@ -432,7 +435,18 @@ int main(int argc, char **argv)
}
#ifdef BUILD_IU
- iu_init(tall_bsc_ctx, "OsmoSGSN", 2, "127.0.0.4", "127.0.0.1", 0, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
+ sccp = osmo_sccp_simple_client(tall_bsc_ctx, "OsmoSGSN",
+ 2 /* FIXME: configurable */,
+ OSMO_SS7_ASP_PROT_M3UA, 0,
+ "127.0.0.4" /* FIXME: configurable */,
+ M3UA_PORT,
+ "127.0.0.1" /* FIXME: configurable */);
+ if (!sccp) {
+ printf("Setting up SCCP client failed.\n");
+ return 8;
+ }
+
+ iu_init(tall_bsc_ctx, sccp, gsm0408_gprs_rcvmsg_iu, sgsn_ranap_iu_event);
#endif
if (daemonize) {
diff --git a/openbsc/src/libiu/iu.c b/openbsc/src/libiu/iu.c
index 32891f9ed..1bb530584 100644
--- a/openbsc/src/libiu/iu.c
+++ b/openbsc/src/libiu/iu.c
@@ -752,8 +752,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
return rc;
}
-int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_addr,
- const char *remote_addr, uint16_t local_port,
+int iu_init(void *ctx, struct osmo_sccp_instance *sccp,
iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb)
{
talloc_iu_ctx = talloc_named_const(ctx, 1, "iu");
@@ -761,9 +760,8 @@ int iu_init(void *ctx, const char *name, uint32_t local_pc, const char *listen_a
global_iu_recv_cb = iu_recv_cb;
global_iu_event_cb = iu_event_cb;
- g_sccp = osmo_sccp_simple_client(talloc_iu_ctx, name, local_pc, OSMO_SS7_ASP_PROT_M3UA,
- local_port, listen_addr, M3UA_PORT, remote_addr);
- g_scu = osmo_sccp_user_bind(g_sccp, name, sccp_sap_up, OSMO_SCCP_SSN_RANAP);
+ g_sccp = sccp;
+ g_scu = osmo_sccp_user_bind(g_sccp, "OsmoMSC-Iu", sccp_sap_up, OSMO_SCCP_SSN_RANAP);
return 0;
}
diff --git a/openbsc/src/libmsc/a_iface.c b/openbsc/src/libmsc/a_iface.c
index c6b446b14..ce38e20db 100644
--- a/openbsc/src/libmsc/a_iface.c
+++ b/openbsc/src/libmsc/a_iface.c
@@ -38,9 +38,6 @@
#include <osmocom/core/byteswap.h>
#include <osmocom/sccp/sccp_types.h>
-#define SSN_BSSAP 254 /* SCCP_SSN_BSSAP */
-#define SENDER_PC 1 /* Our local point code */
-
/* A pointer to the GSM network we work with. By the current paradigm,
* there can only be one gsm_network per MSC. The pointer is set once
* when calling a_init() */
@@ -383,22 +380,15 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu)
}
/* Initalize A interface connection between to MSC and BSC */
-int a_init(void *ctx, const char *name, uint32_t local_pc,
- const char *listen_addr, const char *remote_addr, uint16_t local_port, struct gsm_network *network)
+int a_init(void *ctx, struct osmo_sccp_instance *sccp, struct gsm_network *network)
{
/* FIXME: Remove hardcoded parameters, use parameters in parameter list */
- struct osmo_sccp_instance *sccp;
-
LOGP(DMSC, LOGL_NOTICE, "Initalizing SCCP connection to stp...\n");
gsm_network = network;
- osmo_ss7_init();
/* SCCP Protocol stack */
- sccp =
- osmo_sccp_simple_client(NULL, name, SENDER_PC, OSMO_SS7_ASP_PROT_M3UA, 0, NULL, M3UA_PORT,
- "127.0.0.1");
- osmo_sccp_user_bind(sccp, name, sccp_sap_up, SSN_BSSAP);
+ osmo_sccp_user_bind(sccp, "OsmoMSC-A", sccp_sap_up, SCCP_SSN_BSSAP);
return 0;
}
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index 1f8f645ac..47113da7d 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
msc->msc_con->g_calling_addr.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC;
msc->msc_con->g_calling_addr.ssn = SCCP_SSN_BSSAP;
msc->msc_con->g_calling_addr.ri = OSMO_SCCP_RI_SSN_PC;
- msc->msc_con->g_calling_addr.pc = 23;
+ msc->msc_con->g_calling_addr.pc = 42;
msc->msc_con->g_called_addr.presence = OSMO_SCCP_ADDR_T_SSN | OSMO_SCCP_ADDR_T_PC;
msc->msc_con->g_called_addr.ssn = SCCP_SSN_BSSAP;
msc->msc_con->g_called_addr.ri = OSMO_SCCP_RI_SSN_PC;
diff --git a/openbsc/src/osmo-msc/msc_main.c b/openbsc/src/osmo-msc/msc_main.c
index 3a8e31722..5b4acd2bc 100644
--- a/openbsc/src/osmo-msc/msc_main.c
+++ b/openbsc/src/osmo-msc/msc_main.c
@@ -496,14 +496,22 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
return 7;
}
- /* Set up A-Interface */
- /* TODO: implement A-Interface and remove above legacy stuff. */
+ /* Set up STP link to receive connections from BSC and HNBGW */
+ msc_network->sccp = osmo_sccp_simple_client(tall_msc_ctx, "OsmoMSC",
+ 1 /* FIXME: configurable */,
+ OSMO_SS7_ASP_PROT_M3UA, 0,
+ "127.0.0.3" /* FIXME: configurable */,
+ M3UA_PORT, "127.0.0.1" /* FIXME: configurable */);
+ if (!msc_network->sccp) {
+ printf("Setting up SCCP client failed.\n");
+ return 8;
+ }
/* Set up IuCS */
- iu_init(tall_msc_ctx, "OsmoMSC_Iu", 1, "127.0.0.3", "127.0.0.1", 0, rcvmsg_iu_cs, rx_iu_event);
+ iu_init(tall_msc_ctx, msc_network->sccp, rcvmsg_iu_cs, rx_iu_event);
/* Set up A interface */
- a_init(tall_msc_ctx, "OsmoMSC_A", 254, "127.0.0.3", "127.0.0.1", 0, msc_network);
+ a_init(tall_msc_ctx, msc_network->sccp, msc_network);
if (msc_cmdline_config.daemonize) {
rc = osmo_daemonize();