summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-10-29 21:48:35 +0100
committerlaforge <laforge@osmocom.org>2019-11-05 20:50:37 +0000
commit79fb8a66f3f68a387c75312e08572589846e89c0 (patch)
tree997274cb3d3ca597a294777270ef59041a6a6807
parentebd2fc60461763e756e5a6c3176a33f3fa005282 (diff)
introduce public enum osmo_ss7_asp_role for ASP/SG/IPSP
This supersedes the library-internal enum xua_asp_role. Change-Id: I28b0888b8f8206e9dd67ef64ce0f71ba9a7105ce
-rw-r--r--include/osmocom/sigtran/osmo_ss7.h8
-rw-r--r--src/osmo_ss7.c13
-rw-r--r--src/xua_asp_fsm.c33
-rw-r--r--src/xua_asp_fsm.h8
4 files changed, 32 insertions, 30 deletions
diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h
index 04058c2..87336a8 100644
--- a/include/osmocom/sigtran/osmo_ss7.h
+++ b/include/osmocom/sigtran/osmo_ss7.h
@@ -369,6 +369,14 @@ enum osmo_ss7_asp_admin_state {
OSMO_SS7_ASP_ADM_S_ENABLED,
};
+enum osmo_ss7_asp_role {
+ OSMO_SS7_ASP_ROLE_ASP,
+ OSMO_SS7_ASP_ROLE_SG,
+ OSMO_SS7_ASP_ROLE_IPSP,
+};
+
+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;
diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 87f1245..7a5e35d 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -74,6 +74,13 @@ struct value_string osmo_ss7_asp_protocol_vals[] = {
{ 0, NULL }
};
+const struct value_string osmo_ss7_asp_role_names[] = {
+ { OSMO_SS7_ASP_ROLE_ASP, "ASP" },
+ { OSMO_SS7_ASP_ROLE_SG, "SG" },
+ { OSMO_SS7_ASP_ROLE_IPSP, "IPSP" },
+ { 0, NULL }
+};
+
static int asp_proto_to_ip_proto(enum osmo_ss7_asp_protocol proto)
{
switch (proto) {
@@ -1280,7 +1287,7 @@ static int xua_cli_connect_cb(struct osmo_stream_cli *cli);
int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
{
int rc;
- enum xua_asp_role role;
+ enum osmo_ss7_asp_role role;
char bufloc[512], bufrem[512];
OSMO_ASSERT(ss7_initialized);
@@ -1326,7 +1333,7 @@ int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
osmo_stream_cli_set_reconnect_timeout() above) to connect so the error is transient */
}
/* TODO: make this configurable and not implicit */
- role = XUA_ASPFSM_ROLE_ASP;
+ role = OSMO_SS7_ASP_ROLE_ASP;
} else {
/* We are in server mode now */
if (asp->client) {
@@ -1339,7 +1346,7 @@ int osmo_ss7_asp_restart(struct osmo_ss7_asp *asp)
LOGPASP(asp, DLSS7, LOGL_NOTICE, "ASP Restart for server "
"not implemented yet!\n");
/* TODO: make this configurable and not implicit */
- role = XUA_ASPFSM_ROLE_SG;
+ role = OSMO_SS7_ASP_ROLE_SG;
}
/* (re)start the ASP FSM */
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 16c06d6..3f3d69a 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -47,13 +47,6 @@
#define SUA_T_IAS_SEC (7*60) /* SUA only */
#define SUA_T_IAR_SEC (15*60) /* SUA only */
-static const struct value_string xua_asp_role_names[] = {
- { XUA_ASPFSM_ROLE_ASP, "ASP" },
- { XUA_ASPFSM_ROLE_SG, "SG" },
- { XUA_ASPFSM_ROLE_IPSP, "IPSP" },
- { 0, NULL }
-};
-
static const struct value_string xua_asp_event_names[] = {
{ XUA_ASP_E_M_ASP_UP_REQ, "M-ASP_UP.req" },
{ XUA_ASP_E_M_ASP_ACTIVE_REQ, "M-ASP_ACTIVE.req" },
@@ -88,7 +81,7 @@ struct xua_asp_fsm_priv {
/* pointer back to ASP to which we belong */
struct osmo_ss7_asp *asp;
/* Role (ASP/SG/IPSP) */
- enum xua_asp_role role;
+ enum osmo_ss7_asp_role role;
/* routing context[s]: list of 32bit integers */
/* ACTIVE: traffic mode type, tid label, drn label ? */
@@ -312,12 +305,12 @@ static void check_stop_t_ack(struct osmo_fsm_inst *fi, uint32_t event)
#define ENSURE_ASP_OR_IPSP(fi, event) \
do { \
struct xua_asp_fsm_priv *_xafp = fi->priv; \
- if (_xafp->role != XUA_ASPFSM_ROLE_ASP && \
- _xafp->role != XUA_ASPFSM_ROLE_IPSP) { \
+ if (_xafp->role != OSMO_SS7_ASP_ROLE_ASP && \
+ _xafp->role != OSMO_SS7_ASP_ROLE_IPSP) { \
LOGPFSML(fi, LOGL_ERROR, "event %s not permitted " \
"in role %s\n", \
osmo_fsm_event_name(fi->fsm, event), \
- get_value_string(xua_asp_role_names, _xafp->role));\
+ get_value_string(osmo_ss7_asp_role_names, _xafp->role));\
return; \
} \
} while(0)
@@ -325,12 +318,12 @@ static void check_stop_t_ack(struct osmo_fsm_inst *fi, uint32_t event)
#define ENSURE_SG_OR_IPSP(fi, event) \
do { \
struct xua_asp_fsm_priv *_xafp = fi->priv; \
- if (_xafp->role != XUA_ASPFSM_ROLE_SG && \
- _xafp->role != XUA_ASPFSM_ROLE_IPSP) { \
+ if (_xafp->role != OSMO_SS7_ASP_ROLE_SG && \
+ _xafp->role != OSMO_SS7_ASP_ROLE_IPSP) { \
LOGPFSML(fi, LOGL_ERROR, "event %s not permitted " \
"in role %s\n", \
osmo_fsm_event_name(fi->fsm, event), \
- get_value_string(xua_asp_role_names, _xafp->role));\
+ get_value_string(osmo_ss7_asp_role_names, _xafp->role));\
return; \
} \
} while(0)
@@ -709,7 +702,7 @@ struct osmo_fsm xua_asp_fsm = {
};
static struct osmo_fsm_inst *ipa_asp_fsm_start(struct osmo_ss7_asp *asp,
- enum xua_asp_role role, int log_level);
+ enum osmo_ss7_asp_role role, int log_level);
/*! \brief Start a new ASP finite stae machine for given ASP
* \param[in] asp Application Server Process for which to start FSM
@@ -717,7 +710,7 @@ static struct osmo_fsm_inst *ipa_asp_fsm_start(struct osmo_ss7_asp *asp,
* \param[in] log_level Logging Level for ASP FSM logging
* \returns FSM instance on success; NULL on error */
struct osmo_fsm_inst *xua_asp_fsm_start(struct osmo_ss7_asp *asp,
- enum xua_asp_role role, int log_level)
+ enum osmo_ss7_asp_role role, int log_level)
{
struct osmo_fsm_inst *fi;
struct xua_asp_fsm_priv *xafp;
@@ -768,7 +761,7 @@ struct ipa_asp_fsm_priv {
/* pointer back to ASP to which we belong */
struct osmo_ss7_asp *asp;
/* Role (ASP/SG/IPSP) */
- enum xua_asp_role role;
+ enum osmo_ss7_asp_role role;
/* Structure holding parsed data of the IPA CCM ID exchange */
struct ipaccess_unit *ipa_unit;
@@ -807,7 +800,7 @@ static void ipa_asp_fsm_down(struct osmo_fsm_inst *fi, uint32_t event, void *dat
switch (event) {
case XUA_ASP_E_M_ASP_UP_REQ:
case XUA_ASP_E_SCTP_EST_IND:
- if (iafp->role == XUA_ASPFSM_ROLE_SG) {
+ if (iafp->role == OSMO_SS7_ASP_ROLE_SG) {
/* Server: Transmit IPA ID GET + Wait for Response */
if (fd >= 0) {
ipa_ccm_send_id_req(fd);
@@ -1115,7 +1108,7 @@ struct osmo_fsm ipa_asp_fsm = {
* \param[in] log_level Logging Level for ASP FSM logging
* \returns FSM instance on success; NULL on error */
static struct osmo_fsm_inst *ipa_asp_fsm_start(struct osmo_ss7_asp *asp,
- enum xua_asp_role role, int log_level)
+ enum osmo_ss7_asp_role role, int log_level)
{
struct osmo_fsm_inst *fi;
struct ipa_asp_fsm_priv *iafp;
@@ -1137,7 +1130,7 @@ static struct osmo_fsm_inst *ipa_asp_fsm_start(struct osmo_ss7_asp *asp,
fi->priv = iafp;
- if (role == XUA_ASPFSM_ROLE_ASP)
+ if (role == OSMO_SS7_ASP_ROLE_ASP)
osmo_fsm_inst_dispatch(fi, XUA_ASP_E_M_ASP_UP_REQ, NULL);
return fi;
diff --git a/src/xua_asp_fsm.h b/src/xua_asp_fsm.h
index 32749ec..2b36220 100644
--- a/src/xua_asp_fsm.h
+++ b/src/xua_asp_fsm.h
@@ -36,14 +36,8 @@ enum xua_asp_event {
_NUM_XUA_ASP_E
};
-enum xua_asp_role {
- XUA_ASPFSM_ROLE_ASP,
- XUA_ASPFSM_ROLE_SG,
- XUA_ASPFSM_ROLE_IPSP,
-};
-
extern struct osmo_fsm xua_asp_fsm;
extern struct osmo_fsm ipa_asp_fsm;
struct osmo_fsm_inst *xua_asp_fsm_start(struct osmo_ss7_asp *asp,
- enum xua_asp_role role, int log_level);
+ enum osmo_ss7_asp_role role, int log_level);