pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-sigtran/+/38720?usp=email )


Change subject: sigtran: Make osmo_ss7_as struct private
......................................................................

sigtran: Make osmo_ss7_as struct private

Change-Id: I8c6513e6d2c152e853270fa5b488b606a3d18b14
---
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_instance.c
M src/osmo_ss7_route.c
M src/osmo_ss7_vty.c
M src/sccp_scrc.c
M src/sccp_user.c
A src/ss7_as.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
23 files changed, 123 insertions(+), 79 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran 
refs/changes/20/38720/1

diff --git a/include/osmocom/sigtran/osmo_ss7.h 
b/include/osmocom/sigtran/osmo_ss7.h
index ae25aa5..3b2b380 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -121,6 +121,9 @@
  * SS7 Application Servers
  ***********************************************************************/

+struct osmo_ss7_as;
+struct osmo_ss7_asp;
+
 struct osmo_ss7_routing_key {
        uint32_t context;
        uint32_t l_rk_id;
@@ -165,50 +168,6 @@

 int osmo_ss7_asp_protocol_port(enum osmo_ss7_asp_protocol prot);

-enum osmo_ss7_as_patch_sccp_mode {
-       OSMO_SS7_PATCH_NONE,    /* no patching of SCCP */
-       OSMO_SS7_PATCH_BOTH,    /* patch both OPC and DPC into SCCP addresses */
-};
-
-struct osmo_ss7_as {
-       /*! entry in 'ref osmo_ss7_instance.as_list */
-       struct llist_head list;
-       struct osmo_ss7_instance *inst;
-
-       /*! AS FSM */
-       struct osmo_fsm_inst *fi;
-
-       /*! Were we dynamically allocated by RKM? */
-       bool rkm_dyn_allocated;
-
-       /*! Were we allocated by "simple client" support? */
-       bool simple_client_allocated;
-
-       /*! Rate Counter Group */
-       struct rate_ctr_group *ctrg;
-
-       struct {
-               char *name;
-               char *description;
-               enum osmo_ss7_asp_protocol proto;
-               struct osmo_ss7_routing_key routing_key;
-               enum osmo_ss7_as_traffic_mode mode;
-               /* traffic mode was configured by VTY / config file */
-               bool mode_set_by_vty;
-               /* traffic mode was configured by RKM (routing key management) 
or first ASPAC */
-               bool mode_set_by_peer;
-               uint32_t recovery_timeout_msec;
-               uint8_t qos_class;
-               struct {
-                       uint32_t dpc;
-                       enum osmo_ss7_as_patch_sccp_mode sccp_mode;
-               } pc_override;
-
-               struct osmo_ss7_asp *asps[16];
-               uint8_t last_asp_idx_sent; /* used for load-sharing traffic 
mode (round robin implementation) */
-       } cfg;
-};
-
 struct osmo_ss7_as *
 osmo_ss7_as_find_by_name(struct osmo_ss7_instance *inst, const char *name);
 struct osmo_ss7_as *
diff --git a/src/Makefile.am b/src/Makefile.am
index 356a33a..dc35ecc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,7 @@

 noinst_HEADERS = \
        sccp_internal.h \
+       ss7_as.h \
        ss7_asp.h \
        ss7_asp_peer.h \
        ss7_instance.h \
diff --git a/src/ipa.c b/src/ipa.c
index ce44262..d62d710 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_as.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 a4db7f6..be1f167 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index c906cf5..5965cd5 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "ss7_linkset.h"
@@ -213,28 +214,3 @@
                OSMO_ASSERT(false);
        }
 }
-
-bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t 
m3ua_tmt)
-{
-       if (!as->cfg.mode_set_by_vty && !as->cfg.mode_set_by_peer)
-               return true;
-
-       switch (m3ua_tmt) {
-       case M3UA_TMOD_OVERRIDE:
-               if (as->cfg.mode == OSMO_SS7_AS_TMOD_OVERRIDE)
-                       return true;
-               break;
-       case M3UA_TMOD_LOADSHARE:
-               if (as->cfg.mode == OSMO_SS7_AS_TMOD_LOADSHARE ||
-                   as->cfg.mode == OSMO_SS7_AS_TMOD_ROUNDROBIN)
-                       return true;
-               break;
-       case M3UA_TMOD_BCAST:
-               if (as->cfg.mode == OSMO_SS7_AS_TMOD_BCAST)
-                       return true;
-               break;
-       default:
-               break;
-       }
-       return false;
-}
diff --git a/src/osmo_ss7_as.c b/src/osmo_ss7_as.c
index fb8c68a..0e8ca99 100644
--- a/src/osmo_ss7_as.c
+++ b/src/osmo_ss7_as.c
@@ -26,13 +26,15 @@
 #include <unistd.h>
 #include <inttypes.h>

-#include <osmocom/sigtran/osmo_ss7.h>
-
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/logging.h>

+#include <osmocom/sigtran/osmo_ss7.h>
+#include <osmocom/sigtran/protocol/m3ua.h>
+
+#include "ss7_as.h"
 #include "ss7_asp.h"
 #include "ss7_route.h"
 #include "ss7_route_table.h"
@@ -309,3 +311,29 @@
        }
        return asp;
 }
+
+bool osmo_ss7_as_tmode_compatible_xua(struct osmo_ss7_as *as, uint32_t 
m3ua_tmt)
+{
+       if (!as->cfg.mode_set_by_vty && !as->cfg.mode_set_by_peer)
+               return true;
+
+       switch (m3ua_tmt) {
+       case M3UA_TMOD_OVERRIDE:
+               if (as->cfg.mode == OSMO_SS7_AS_TMOD_OVERRIDE)
+                       return true;
+               break;
+       case M3UA_TMOD_LOADSHARE:
+               if (as->cfg.mode == OSMO_SS7_AS_TMOD_LOADSHARE ||
+                   as->cfg.mode == OSMO_SS7_AS_TMOD_ROUNDROBIN)
+                       return true;
+               break;
+       case M3UA_TMOD_BCAST:
+               if (as->cfg.mode == OSMO_SS7_AS_TMOD_BCAST)
+                       return true;
+               break;
+       default:
+               break;
+       }
+       return false;
+
+}
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index 12a5d5f..d81d25c 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "ss7_xua_srv.h"
diff --git a/src/osmo_ss7_hmrt.c b/src/osmo_ss7_hmrt.c
index 9aaa1df..c256860 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_linkset.h"
 #include "ss7_route.h"
diff --git a/src/osmo_ss7_instance.c b/src/osmo_ss7_instance.c
index 60a8829..f7d9a41 100644
--- a/src/osmo_ss7_instance.c
+++ b/src/osmo_ss7_instance.c
@@ -33,6 +33,7 @@
 #include <osmocom/sigtran/osmo_ss7.h>
 #include <osmocom/sigtran/sccp_sap.h>

+#include "ss7_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "ss7_instance.h"
diff --git a/src/osmo_ss7_route.c b/src/osmo_ss7_route.c
index 32e3eb7..2cde410 100644
--- a/src/osmo_ss7_route.c
+++ b/src/osmo_ss7_route.c
@@ -27,6 +27,7 @@
 #include <osmocom/sigtran/osmo_ss7.h>

 #include "ss7_linkset.h"
+#include "ss7_as.h"
 #include "ss7_route.h"
 #include "ss7_route_table.h"
 #include "ss7_internal.h"
diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 482e2f8..6b404b3 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_route.h"
 #include "ss7_route_table.h"
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c
index 33f0633..23c3f2d 100644
--- a/src/sccp_scrc.c
+++ b/src/sccp_scrc.c
@@ -33,6 +33,7 @@
 #include <osmocom/sigtran/protocol/mtp.h>

 #include "sccp_internal.h"
+#include "ss7_as.h"
 #include "ss7_instance.h"
 #include "ss7_linkset.h"
 #include "ss7_route.h"
diff --git a/src/sccp_user.c b/src/sccp_user.c
index d364eb5..8e8e2bd 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_route.h"
 #include "ss7_route_table.h"
diff --git a/src/ss7_as.h b/src/ss7_as.h
new file mode 100644
index 0000000..504818c
--- /dev/null
+++ b/src/ss7_as.h
@@ -0,0 +1,71 @@
+#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 Application Server
+ ***********************************************************************/
+
+struct osmo_ss7_instance;
+struct osmo_ss7_asp;
+
+enum osmo_ss7_as_patch_sccp_mode {
+       OSMO_SS7_PATCH_NONE,    /* no patching of SCCP */
+       OSMO_SS7_PATCH_BOTH,    /* patch both OPC and DPC into SCCP addresses */
+};
+
+enum ss7_as_ctr {
+       SS7_AS_CTR_RX_MSU_TOTAL,
+       SS7_AS_CTR_TX_MSU_TOTAL,
+};
+
+struct osmo_ss7_as {
+       /*! entry in 'ref osmo_ss7_instance.as_list */
+       struct llist_head list;
+       struct osmo_ss7_instance *inst;
+
+       /*! AS FSM */
+       struct osmo_fsm_inst *fi;
+
+       /*! Were we dynamically allocated by RKM? */
+       bool rkm_dyn_allocated;
+
+       /*! Were we allocated by "simple client" support? */
+       bool simple_client_allocated;
+
+       /*! Rate Counter Group */
+       struct rate_ctr_group *ctrg;
+
+       struct {
+               char *name;
+               char *description;
+               enum osmo_ss7_asp_protocol proto;
+               struct osmo_ss7_routing_key routing_key;
+               enum osmo_ss7_as_traffic_mode mode;
+               /* traffic mode was configured by VTY / config file */
+               bool mode_set_by_vty;
+               /* traffic mode was configured by RKM (routing key management) 
or first ASPAC */
+               bool mode_set_by_peer;
+               uint32_t recovery_timeout_msec;
+               uint8_t qos_class;
+               struct {
+                       uint32_t dpc;
+                       enum osmo_ss7_as_patch_sccp_mode sccp_mode;
+               } pc_override;
+
+               struct osmo_ss7_asp *asps[16];
+               uint8_t last_asp_idx_sent; /* used for load-sharing traffic 
mode (round robin implementation) */
+       } cfg;
+};
+
+#define LOGPAS(as, subsys, level, fmt, args ...) \
+       _LOGSS7((as)->inst, subsys, level, "as-%s: " fmt, (as)->cfg.name, ## 
args)
diff --git a/src/ss7_internal.h b/src/ss7_internal.h
index 27bd54f..9475645 100644
--- a/src/ss7_internal.h
+++ b/src/ss7_internal.h
@@ -28,11 +28,3 @@
 int ss7_asp_xua_srv_conn_closed_cb(struct osmo_stream_srv *srv);

 int xua_tcp_segmentation_cb(struct msgb *msg);
-
-enum ss7_as_ctr {
-       SS7_AS_CTR_RX_MSU_TOTAL,
-       SS7_AS_CTR_TX_MSU_TOTAL,
-};
-
-#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 b7c70bb..c7bde24 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"

diff --git a/src/xua_as_fsm.c b/src/xua_as_fsm.c
index 632bb01..6517f73 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_route.h"
 #include "ss7_route_table.h"
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 37932a7..089c31c 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "ss7_xua_srv.h"
diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c
index dd8e505..7c27b19 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_xua_srv.h"

diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index 0a05cdc..9a3918e 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "ss7_route.h"
diff --git a/src/xua_shared.c b/src/xua_shared.c
index 6fd0369..022b8ed 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_as.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 78720cc..36fe3c7 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_as.h"
 #include "ss7_asp.h"
 #include "ss7_internal.h"
 #include "xua_internal.h"
diff --git a/tests/ss7/ss7_test.c b/tests/ss7/ss7_test.c
index 98d4680..a28d37f 100644
--- a/tests/ss7/ss7_test.c
+++ b/tests/ss7/ss7_test.c
@@ -1,3 +1,4 @@
+#include "../src/ss7_as.h"
 #include "../src/ss7_asp.h"
 #include "../src/ss7_link.h"
 #include "../src/ss7_linkset.h"

--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/38720?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: I8c6513e6d2c152e853270fa5b488b606a3d18b14
Gerrit-Change-Number: 38720
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to