pespin submitted this change.

View Change

Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve
cosmetic: osmo_ss7: Rearrange some contents

* Create sections for Routing Key, AS Traffic Mode, ASP Protocol which
have their own enum/struct and set of APIs acting upon them.
* Move osmo_ss7_asp_disconnect() to its ASP section (was in AS section).

Change-Id: I592db59e27fa7b401d1281921e38817772308c00
---
M include/osmocom/sigtran/osmo_ss7.h
1 file changed, 44 insertions(+), 22 deletions(-)

diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index dcf985d..d35b870 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -132,12 +132,9 @@
osmo_ss7_route_get_dest_as(struct osmo_ss7_route *rt);

/***********************************************************************
- * SS7 Application Servers
+ * SS7 Routing key
***********************************************************************/

-struct osmo_ss7_as;
-struct osmo_ss7_asp;
-
struct osmo_ss7_routing_key {
uint32_t context;
uint32_t l_rk_id;
@@ -148,6 +145,33 @@
/* FIXME: more complex routing keys */
};

+
+/***********************************************************************
+ * SS7 ASP Protocols
+ ***********************************************************************/
+
+enum osmo_ss7_asp_protocol {
+ OSMO_SS7_ASP_PROT_NONE,
+ OSMO_SS7_ASP_PROT_SUA,
+ OSMO_SS7_ASP_PROT_M3UA,
+ OSMO_SS7_ASP_PROT_IPA,
+ _NUM_OSMO_SS7_ASP_PROT
+};
+
+extern struct value_string osmo_ss7_asp_protocol_vals[];
+static inline const char *
+osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
+{
+ return get_value_string(osmo_ss7_asp_protocol_vals, mode);
+}
+
+int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot);
+
+
+/***********************************************************************
+ * SS7 AS Traffic Mode
+ ***********************************************************************/
+
enum osmo_ss7_as_traffic_mode {
OSMO_SS7_AS_TMOD_OVERRIDE = 0, /* default */
OSMO_SS7_AS_TMOD_BCAST,
@@ -164,23 +188,16 @@
return get_value_string(osmo_ss7_as_traffic_mode_vals, mode);
}

-enum osmo_ss7_asp_protocol {
- OSMO_SS7_ASP_PROT_NONE,
- OSMO_SS7_ASP_PROT_SUA,
- OSMO_SS7_ASP_PROT_M3UA,
- OSMO_SS7_ASP_PROT_IPA,
- _NUM_OSMO_SS7_ASP_PROT
-};
+enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
+int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);

-extern struct value_string osmo_ss7_asp_protocol_vals[];

-static inline const char *
-osmo_ss7_asp_protocol_name(enum osmo_ss7_asp_protocol mode)
-{
- return get_value_string(osmo_ss7_asp_protocol_vals, mode);
-}
+/***********************************************************************
+ * SS7 Application Servers
+ ***********************************************************************/

-int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot);
+struct osmo_ss7_as;
+struct osmo_ss7_asp;

struct osmo_ss7_as *
osmo_ss7_as_find_by_name(struct osmo_ss7_instance *inst, const char *name);
@@ -203,7 +220,6 @@
bool osmo_ss7_as_down(const struct osmo_ss7_as *as);
bool osmo_ss7_as_active(const struct osmo_ss7_as *as);
bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t m3ua_tmt);
-void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);


/***********************************************************************
@@ -260,6 +276,7 @@
osmo_ss7_asp_find_or_create2(struct osmo_ss7_instance *inst, const char *name,
uint16_t remote_port, uint16_t local_port,
int trans_proto, enum osmo_ss7_asp_protocol proto);
+void osmo_ss7_asp_disconnect(struct osmo_ss7_asp *asp);
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp);
int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg);
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp);
@@ -282,6 +299,10 @@
void osmo_ss7_register_rx_unknown_cb(osmo_ss7_asp_rx_unknown_cb *cb);


+/***********************************************************************
+ * Simple Client
+ ***********************************************************************/
+
struct osmo_sccp_instance *
osmo_sccp_simple_client(void *ctx, const char *name, uint32_t default_pc,
enum osmo_ss7_asp_protocol prot, int default_local_port,
@@ -297,6 +318,10 @@
int default_remote_port,
const char *default_remote_ip);

+/***********************************************************************
+ * Simple Server
+ ***********************************************************************/
+
struct osmo_sccp_instance *
osmo_sccp_simple_server(void *ctx, uint32_t pc,
enum osmo_ss7_asp_protocol prot, int local_port,
@@ -314,9 +339,6 @@
int local_port, int remote_port,
const char *remote_ip);

-enum osmo_ss7_as_traffic_mode osmo_ss7_tmode_from_xua(uint32_t in);
-int osmo_ss7_tmode_to_xua(enum osmo_ss7_as_traffic_mode tmod);
-
/* VTY related */
struct vty;
void osmo_ss7_vty_init_asp(void *ctx);

To view, visit change 38721. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I592db59e27fa7b401d1281921e38817772308c00
Gerrit-Change-Number: 38721
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>