diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-06-06 16:44:20 +0200 |
---|---|---|
committer | laforge <laforge@gnumonks.org> | 2019-06-06 19:43:05 +0000 |
commit | ed41e8c08e74d3bce2b61231c4b9f8257bc76101 (patch) | |
tree | 395a58a04490c95ed7c30a3bc1cc3106bd2d846d | |
parent | f450f442f3554bc963eb3ebc30853af2ef79f24d (diff) |
Introduce msc_is_{sccplite,aoip}() helpers
Having the helper makes it easier to read/find for transport type checks. It
will be ifurther re-used in forthcoming commits.
Change-Id: Ic0ee4c472e29ec3092049e5e23b744395613616d
-rw-r--r-- | include/osmocom/bsc/bsc_msc_data.h | 20 | ||||
-rw-r--r-- | src/osmo-bsc/bsc_subscr_conn_fsm.c | 17 | ||||
-rw-r--r-- | src/osmo-bsc/osmo_bsc_sigtran.c | 3 |
3 files changed, 23 insertions, 17 deletions
diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index 472084579..1f9872a41 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -191,5 +191,25 @@ static inline int mgcp_port_to_cic(uint16_t port, uint16_t base) return (port - base) / 2; } +static inline bool msc_is_aoip(const struct bsc_msc_data *msc) +{ + switch (msc->a.asp_proto) { + case OSMO_SS7_ASP_PROT_SUA: + case OSMO_SS7_ASP_PROT_M3UA: + return true; + default: + return false; + } +} + +static inline bool msc_is_sccplite(const struct bsc_msc_data *msc) +{ + switch (msc->a.asp_proto) { + case OSMO_SS7_ASP_PROT_IPA: + return true; + default: + return false; + } +} #endif diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index 87ad56740..7b9f912b2 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -1058,14 +1058,7 @@ bool gscon_is_aoip(struct gsm_subscriber_connection *conn) if (!conn || !conn->sccp.msc) return false; - switch (conn->sccp.msc->a.asp_proto) { - case OSMO_SS7_ASP_PROT_SUA: - case OSMO_SS7_ASP_PROT_M3UA: - return true; - - default: - return false; - } + return msc_is_aoip(conn->sccp.msc); } bool gscon_is_sccplite(struct gsm_subscriber_connection *conn) @@ -1073,11 +1066,5 @@ bool gscon_is_sccplite(struct gsm_subscriber_connection *conn) if (!conn || !conn->sccp.msc) return false; - switch (conn->sccp.msc->a.asp_proto) { - case OSMO_SS7_ASP_PROT_IPA: - return true; - - default: - return false; - } + return msc_is_sccplite(conn->sccp.msc); } diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 5d61c3205..8303c4f53 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -523,8 +523,7 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs) * an X-Osmo-IGN flag telling osmo-mgw to ignore CallID mismatches for this endpoint. * If an explicit VTY command has already indicated whether or not to send X-Osmo-IGN, do * not overwrite that setting. */ - if (msc->a.asp_proto == OSMO_SS7_ASP_PROT_IPA - && !msc->x_osmo_ign_configured) + if (msc_is_sccplite(msc) && !msc->x_osmo_ign_configured) msc->x_osmo_ign |= MGCP_X_OSMO_IGN_CALLID; /* If unset, use default local SCCP address */ |