aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-07-03 15:26:22 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2017-07-05 13:41:28 +0200
commitcbb7b79e19f149de5543d3f49c73bc707cd545b9 (patch)
tree4c63f14ac5c962caed2d50de7956c0ba5afc08ec
parent4313bdfa201271ef487507e355b4a9b91593520f (diff)
simple-client/server: be able to decide on which ss7 instance to bind
osmo_sccp_simple_client() and osmo_sccp_simple_server() are binding on the ss7 instance with the id 1 by default. If the instance does not exist, it is created automatically. Allow choosing the ss7 instance by supplying the id number as function parameter. Add two new functions: osmo_sccp_simple_client_on_ss7_id() osmo_sccp_simple_server_on_ss7_id() Change-Id: I62e608253212415bddbb4c7dcf5d3b5e79c8d28e
-rw-r--r--include/osmocom/sigtran/osmo_ss7.h11
-rw-r--r--src/sccp_user.c36
2 files changed, 39 insertions, 8 deletions
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index caf12f5..57a4e06 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -439,11 +439,22 @@ osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
const char *local_ip, int remote_port, const char *remote_ip);
struct osmo_sccp_instance *
+osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
+ uint32_t pc, enum osmo_ss7_asp_protocol prot,
+ int local_port, const char *local_ip,
+ int remote_port, const char *remote_ip);
+
+struct osmo_sccp_instance *
osmo_sccp_simple_server(void *ctx, uint32_t pc,
enum osmo_ss7_asp_protocol prot, int local_port,
const char *local_ip);
struct osmo_sccp_instance *
+osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
+ enum osmo_ss7_asp_protocol prot,
+ int local_port, const char *local_ip);
+
+struct osmo_sccp_instance *
osmo_sccp_simple_server_add_clnt(struct osmo_sccp_instance *inst,
enum osmo_ss7_asp_protocol prot,
const char *name, uint32_t pc,
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 93b03f6..b21a756 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -236,9 +236,10 @@ void osmo_sccp_instance_destroy(struct osmo_sccp_instance *inst)
***********************************************************************/
struct osmo_sccp_instance *
-osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
- enum osmo_ss7_asp_protocol prot, int local_port,
- const char *local_ip, int remote_port, const char *remote_ip)
+osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name,
+ uint32_t pc, enum osmo_ss7_asp_protocol prot,
+ int local_port, const char *local_ip,
+ int remote_port, const char *remote_ip)
{
struct osmo_ss7_instance *ss7;
struct osmo_ss7_as *as;
@@ -252,7 +253,7 @@ osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
local_port = osmo_ss7_asp_protocol_port(prot);
/* allocate + initialize SS7 instance */
- ss7 = osmo_ss7_instance_find_or_create(ctx, 1);
+ ss7 = osmo_ss7_instance_find_or_create(ctx, ss7_id);
if (!ss7) {
LOGP(DLSCCP, LOGL_ERROR, "Failed to find or create SS7 instance\n");
return NULL;
@@ -309,14 +310,24 @@ out_strings:
return NULL;
}
+struct osmo_sccp_instance *
+osmo_sccp_simple_client(void *ctx, const char *name, uint32_t pc,
+ enum osmo_ss7_asp_protocol prot, int local_port,
+ const char *local_ip, int remote_port, const char *remote_ip)
+{
+ return osmo_sccp_simple_client_on_ss7_id(ctx, 1, name, pc, prot,
+ local_port, local_ip,
+ remote_port, remote_ip);
+}
+
/***********************************************************************
* Convenience function for SERVER
***********************************************************************/
struct osmo_sccp_instance *
-osmo_sccp_simple_server(void *ctx, uint32_t pc,
- enum osmo_ss7_asp_protocol prot, int local_port,
- const char *local_ip)
+osmo_sccp_simple_server_on_ss7_id(void *ctx, uint32_t ss7_id, uint32_t pc,
+ enum osmo_ss7_asp_protocol prot,
+ int local_port, const char *local_ip)
{
struct osmo_ss7_instance *ss7;
struct osmo_xua_server *xs;
@@ -325,7 +336,7 @@ osmo_sccp_simple_server(void *ctx, uint32_t pc,
local_port = osmo_ss7_asp_protocol_port(prot);
/* allocate + initialize SS7 instance */
- ss7 = osmo_ss7_instance_find_or_create(ctx, 1);
+ ss7 = osmo_ss7_instance_find_or_create(ctx, ss7_id);
if (!ss7)
return NULL;
ss7->cfg.primary_pc = pc;
@@ -350,6 +361,15 @@ out_ss7:
}
struct osmo_sccp_instance *
+osmo_sccp_simple_server(void *ctx, uint32_t pc,
+ enum osmo_ss7_asp_protocol prot, int local_port,
+ const char *local_ip)
+{
+ return osmo_sccp_simple_server_on_ss7_id(ctx, 1, pc, prot,
+ local_port, local_ip);
+}
+
+struct osmo_sccp_instance *
osmo_sccp_simple_server_add_clnt(struct osmo_sccp_instance *inst,
enum osmo_ss7_asp_protocol prot,
const char *name, uint32_t pc,