pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38721?usp=email )
Change subject: cosmetic: osmo_ss7: Rearrange some contents ......................................................................
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(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/21/38721/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 3b2b380..5051074 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -118,12 +118,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; @@ -134,6 +131,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, @@ -150,23 +174,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); @@ -189,7 +206,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);
/*********************************************************************** @@ -246,6 +262,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); @@ -268,6 +285,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, @@ -283,6 +304,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, @@ -300,9 +325,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);