pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38645?usp=email )
Change subject: WIP
......................................................................
WIP
Change-Id: I5839b4dd04468af20d1836386dcc722e7a83ac5f
---
M include/osmocom/sigtran/osmo_ss7.h
M src/Makefile.am
M src/ipa.c
M src/m3ua.c
M src/osmo_ss7.c
M src/osmo_ss7_as.c
M src/osmo_ss7_asp.c
M src/osmo_ss7_hmrt.c
M src/osmo_ss7_vty.c
M src/osmo_ss7_xua_srv.c
M src/sccp_user.c
A src/ss7_asp.h
M src/ss7_internal.h
M src/sua.c
M src/xua_as_fsm.c
M src/xua_asp_fsm.c
M src/xua_default_lm_fsm.c
M src/xua_rkm.c
M src/xua_shared.c
M src/xua_snm.c
M tests/ss7/ss7_test.c
21 files changed, 126 insertions(+), 83 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/45/38645/1
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 0027426..2d45733 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -275,77 +275,7 @@
extern const struct value_string osmo_ss7_asp_role_names[];
-struct osmo_ss7_asp {
- /*! entry in \ref osmo_ss7_instance.asp_list */
- struct llist_head list;
- struct osmo_ss7_instance *inst;
-
- /*! ASP FSM */
- struct osmo_fsm_inst *fi;
-
- /*! \ref osmo_xua_server over which we were established */
- struct osmo_xua_server *xua_server;
- struct llist_head siblings;
-
- /*! osmo_stream / libosmo-netif handles */
- struct osmo_stream_cli *client;
- struct osmo_stream_srv *server;
- /*! pre-formatted human readable local/remote socket name */
- char *sock_name;
-
- /* ASP Identifier for ASP-UP + NTFY */
- uint32_t asp_id;
- bool asp_id_present;
-
- /* Layer Manager to which we talk */
- const struct osmo_xua_layer_manager *lm;
- void *lm_priv;
-
- /*! Were we dynamically allocated */
- bool dyn_allocated;
-
- /*! Were we allocated by "simple client" support? */
- bool simple_client_allocated;
-
- /*! Rate Counter Group */
- struct rate_ctr_group *ctrg;
-
- /*! Pending message for non-blocking IPA read */
- struct msgb *pending_msg;
-
- struct {
- char *name;
- char *description;
- enum osmo_ss7_asp_protocol proto;
- enum osmo_ss7_asp_admin_state adm_state;
- bool is_server;
- enum osmo_ss7_asp_role role;
- bool role_set_by_vty;
- bool trans_role_set_by_vty;
-
- struct osmo_ss7_asp_peer local;
- struct osmo_ss7_asp_peer remote;
- uint8_t qos_class;
- uint32_t quirks;
-
- /* T_defs used by the default_lm: */
- struct osmo_tdef *T_defs_lm;
-
- struct {
- bool num_ostreams_present;
- bool max_instreams_present;
- bool max_attempts_present;
- bool max_init_timeo_present;
- uint16_t num_ostreams_value;
- uint16_t max_instreams_value;
- uint16_t max_attempts_value;
- uint16_t max_init_timeo_value; /* ms */
- } sctp_init;
-
- /*! The underlaying transport protocol (one of IPPROTO_*) */
- int trans_proto;
- } cfg;
-};
+struct osmo_ss7_asp;
/*! Peer SG doesn't send NTFY(AS-INACTIVE) after ASP-UP procedure */
#define OSMO_SS7_ASP_QUIRK_NO_NOTIFY 0x00000001
diff --git a/src/Makefile.am b/src/Makefile.am
index 8f848de..8071be8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,7 @@
noinst_HEADERS = \
sccp_internal.h \
+ ss7_asp.h \
ss7_internal.h \
ss7_link.h \
ss7_linkset.h \
diff --git a/src/ipa.c b/src/ipa.c
index 64eb4d4..ce44262 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -47,6 +47,7 @@
#include <osmocom/sigtran/protocol/mtp.h>
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "xua_asp_fsm.h"
diff --git a/src/m3ua.c b/src/m3ua.c
index 05680ea..a4db7f6 100644
--- a/src/m3ua.c
+++ b/src/m3ua.c
@@ -44,6 +44,7 @@
#include "xua_as_fsm.h"
#include "xua_asp_fsm.h"
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
#define M3UA_MSGB_SIZE 1500
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 0402038..40bf0b1 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -50,6 +50,7 @@
#include "sccp_internal.h"
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "ss7_linkset.h"
#include "ss7_route.h"
diff --git a/src/osmo_ss7_as.c b/src/osmo_ss7_as.c
index cc61b12..f4e5853 100644
--- a/src/osmo_ss7_as.c
+++ b/src/osmo_ss7_as.c
@@ -33,6 +33,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
+#include "ss7_asp.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
#include "ss7_internal.h"
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index 6058304..1ee0f76 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -51,6 +51,7 @@
#include "sccp_internal.h"
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "ss7_xua_srv.h"
#include "xua_asp_fsm.h"
diff --git a/src/osmo_ss7_hmrt.c b/src/osmo_ss7_hmrt.c
index e504cb1..9aaa1df 100644
--- a/src/osmo_ss7_hmrt.c
+++ b/src/osmo_ss7_hmrt.c
@@ -35,6 +35,7 @@
#include <osmocom/sigtran/protocol/m3ua.h>
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_linkset.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 7f9aa39..8dd9a4f 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -46,6 +46,7 @@
#include "xua_internal.h"
#include <osmocom/sigtran/sccp_sap.h>
#include "sccp_internal.h"
+#include "ss7_asp.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
#include "ss7_internal.h"
diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c
index 4fb2115..db1481b 100644
--- a/src/osmo_ss7_xua_srv.c
+++ b/src/osmo_ss7_xua_srv.c
@@ -51,6 +51,7 @@
#include "sccp_internal.h"
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "xua_asp_fsm.h"
#include "xua_as_fsm.h"
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 84e57da..3604883 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -39,6 +39,7 @@
#include "sccp_internal.h"
#include "xua_internal.h"
+#include "ss7_asp.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
#include "ss7_internal.h"
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
new file mode 100644
index 0000000..dc15078
--- /dev/null
+++ b/src/ss7_asp.h
@@ -0,0 +1,106 @@
+#pragma once
+
+#include <stdint.h>
+#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/tdef.h>
+#include <osmocom/netif/stream.h>
+
+#include <osmocom/sigtran/osmo_ss7.h>
+
+#include "ss7_internal.h"
+
+/***********************************************************************
+ * SS7 Linksets
+ ***********************************************************************/
+
+struct osmo_ss7_instance;
+struct osmo_xua_layer_manager;
+
+struct osmo_ss7_asp {
+ /*! entry in \ref osmo_ss7_instance.asp_list */
+ struct llist_head list;
+ struct osmo_ss7_instance *inst;
+
+ /*! ASP FSM */
+ struct osmo_fsm_inst *fi;
+
+ /*! \ref osmo_xua_server over which we were established */
+ struct osmo_xua_server *xua_server;
+ struct llist_head siblings;
+
+ /*! osmo_stream / libosmo-netif handles */
+ struct osmo_stream_cli *client;
+ struct osmo_stream_srv *server;
+ /*! pre-formatted human readable local/remote socket name */
+ char *sock_name;
+
+ /* ASP Identifier for ASP-UP + NTFY */
+ uint32_t asp_id;
+ bool asp_id_present;
+
+ /* Layer Manager to which we talk */
+ const struct osmo_xua_layer_manager *lm;
+ void *lm_priv;
+
+ /*! Were we dynamically allocated */
+ bool dyn_allocated;
+
+ /*! Were we allocated by "simple client" support? */
+ bool simple_client_allocated;
+
+ /*! Rate Counter Group */
+ struct rate_ctr_group *ctrg;
+
+ /*! Pending message for non-blocking IPA read */
+ struct msgb *pending_msg;
+
+ struct {
+ char *name;
+ char *description;
+ enum osmo_ss7_asp_protocol proto;
+ enum osmo_ss7_asp_admin_state adm_state;
+ bool is_server;
+ enum osmo_ss7_asp_role role;
+ bool role_set_by_vty;
+ bool trans_role_set_by_vty;
+
+ struct osmo_ss7_asp_peer local;
+ struct osmo_ss7_asp_peer remote;
+ uint8_t qos_class;
+ uint32_t quirks;
+
+ /* T_defs used by the default_lm: */
+ struct osmo_tdef *T_defs_lm;
+
+ struct {
+ bool num_ostreams_present;
+ bool max_instreams_present;
+ bool max_attempts_present;
+ bool max_init_timeo_present;
+ uint16_t num_ostreams_value;
+ uint16_t max_instreams_value;
+ uint16_t max_attempts_value;
+ uint16_t max_init_timeo_value; /* ms */
+ } sctp_init;
+
+ /*! The underlaying transport protocol (one of IPPROTO_*) */
+ int trans_proto;
+ } cfg;
+};
+
+struct osmo_ss7_asp *ss7_asp_alloc(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);
+bool ss7_asp_set_default_peer_hosts(struct osmo_ss7_asp *asp);
+bool ss7_asp_is_started(const struct osmo_ss7_asp *asp);
+int ss7_asp_get_fd(const struct osmo_ss7_asp *asp);
+
+int ss7_asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp);
+int ss7_asp_apply_primary_address(const struct osmo_ss7_asp *asp);
+int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
+int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
+
+#define LOGPASP(asp, subsys, level, fmt, args ...) \
+ _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ##
args)
diff --git a/src/ss7_internal.h b/src/ss7_internal.h
index 5d576c5..f326896 100644
--- a/src/ss7_internal.h
+++ b/src/ss7_internal.h
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include <osmocom/netif/stream.h>
#include <osmocom/sigtran/osmo_ss7.h>
extern bool ss7_initialized;
@@ -14,12 +15,6 @@
struct osmo_ss7_as *ss7_as_alloc(struct osmo_ss7_instance *inst, const char *name,
enum osmo_ss7_asp_protocol proto);
-struct osmo_ss7_asp *ss7_asp_alloc(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);
-bool ss7_asp_set_default_peer_hosts(struct osmo_ss7_asp *asp);
-bool ss7_asp_is_started(const struct osmo_ss7_asp *asp);
-int ss7_asp_get_fd(const struct osmo_ss7_asp *asp);
struct osmo_ss7_asp *ss7_asp_find_by_socket_addr(int fd, int trans_proto);
bool ss7_asp_protocol_check_trans_proto(enum osmo_ss7_asp_protocol proto, int
trans_proto);
@@ -28,10 +23,6 @@
int ss7_asp_xua_srv_conn_rx_cb(struct osmo_stream_srv *conn, int res, struct msgb *msg);
int ss7_asp_m3ua_tcp_srv_conn_rx_cb(struct osmo_stream_srv *conn, int res, struct msgb
*msg);
int ss7_asp_xua_srv_conn_closed_cb(struct osmo_stream_srv *srv);
-int ss7_asp_apply_peer_primary_address(const struct osmo_ss7_asp *asp);
-int ss7_asp_apply_primary_address(const struct osmo_ss7_asp *asp);
-int ss7_asp_apply_new_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
-int ss7_asp_apply_drop_local_address(const struct osmo_ss7_asp *asp, unsigned int
loc_idx);
bool ss7_asp_peer_match_host(const struct osmo_ss7_asp_peer *peer, const char *host, bool
host_is_v6);
int ss7_asp_peer_find_host(const struct osmo_ss7_asp_peer *peer, const char *host);
@@ -54,7 +45,5 @@
#define LOGSS7(inst, level, fmt, args ...) \
_LOGSS7(inst, DLSS7, level, fmt, ## args)
-#define LOGPASP(asp, subsys, level, fmt, args ...) \
- _LOGSS7((asp)->inst, subsys, level, "asp-%s: " fmt, (asp)->cfg.name, ##
args)
#define LOGPAS(as, subsys, level, fmt, args ...) \
_LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ##
args)
diff --git a/src/sua.c b/src/sua.c
index a69f3b5..b7c70bb 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -47,6 +47,7 @@
#include "xua_asp_fsm.h"
#include "xua_internal.h"
#include "sccp_internal.h"
+#include "ss7_asp.h"
#include "ss7_internal.h"
/* Appendix C.4 of Q.714 (all in milliseconds) */
diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index dff0d06..702be2b 100644
--- a/src/xua_as_fsm.c
+++ b/src/xua_as_fsm.c
@@ -23,6 +23,7 @@
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/protocol/m3ua.h>
+#include "ss7_asp.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
#include "xua_asp_fsm.h"
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 9e9f8ac..37932a7 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -27,6 +27,7 @@
#include "xua_msg.h"
#include <osmocom/sigtran/protocol/sua.h>
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "ss7_xua_srv.h"
#include "xua_asp_fsm.h"
diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index b55f982..dd8e505 100644
--- a/src/xua_default_lm_fsm.c
+++ b/src/xua_default_lm_fsm.c
@@ -37,6 +37,7 @@
#include "xua_internal.h"
#include "xua_asp_fsm.h"
+#include "ss7_asp.h"
#include "ss7_xua_srv.h"
#define S(x) (1 << (x))
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index 5a7bc2e..0a05cdc 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -28,6 +28,7 @@
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/protocol/m3ua.h>
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "ss7_route.h"
#include "ss7_route_table.h"
diff --git a/src/xua_shared.c b/src/xua_shared.c
index 15b9b52..6fd0369 100644
--- a/src/xua_shared.c
+++ b/src/xua_shared.c
@@ -34,6 +34,7 @@
#include <osmocom/sigtran/protocol/m3ua.h>
#include <osmocom/sigtran/protocol/sua.h>
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "xua_internal.h"
diff --git a/src/xua_snm.c b/src/xua_snm.c
index b5737cd..78720cc 100644
--- a/src/xua_snm.c
+++ b/src/xua_snm.c
@@ -31,6 +31,7 @@
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/protocol/mtp.h>
+#include "ss7_asp.h"
#include "ss7_internal.h"
#include "xua_internal.h"
#include "sccp_internal.h"
diff --git a/tests/ss7/ss7_test.c b/tests/ss7/ss7_test.c
index 6fd21d7..98d4680 100644
--- a/tests/ss7/ss7_test.c
+++ b/tests/ss7/ss7_test.c
@@ -1,3 +1,4 @@
+#include "../src/ss7_asp.h"
#include "../src/ss7_link.h"
#include "../src/ss7_linkset.h"
#include "../src/ss7_route.h"
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38645?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I5839b4dd04468af20d1836386dcc722e7a83ac5f
Gerrit-Change-Number: 38645
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>