diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-04-03 14:26:17 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-04-03 15:06:10 +0200 |
commit | ee0bcf2fca87513ba8065d025ebd062bd6940399 (patch) | |
tree | 96da9423917f8a8dd5ae33b8096c99012657941f | |
parent | 67b895e156f7066432b020c68cb5c579a7fbdd02 (diff) |
sccp_scoc: move sccp_find_user() up
Move it before sccp_scoc_rx_scrc_rout_fail(), so it can be used in
the latter function to figure out the local_ref from the user (follow
up commit).
Related: OS#3871
Change-Id: Ieabeda3126dcc0349a06c0fc7c9e468b900d7855
-rw-r--r-- | src/sccp_scoc.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c index 726426c..82590a0 100644 --- a/src/sccp_scoc.c +++ b/src/sccp_scoc.c @@ -1329,6 +1329,31 @@ static struct xua_msg *gen_coref_without_conn(struct osmo_sccp_instance *inst, return xua; } +/* Find a SCCP user for given SUA message (based on SUA_IEI_DEST_ADDR */ +static struct osmo_sccp_user *sccp_find_user(struct osmo_sccp_instance *inst, + struct xua_msg *xua) +{ + int rc; + struct osmo_sccp_addr called_addr; + + rc = sua_addr_parse(&called_addr, xua, SUA_IEI_DEST_ADDR); + if (rc < 0) { + LOGP(DLSCCP, LOGL_ERROR, "Cannot find SCCP User for XUA " + "Message %s without valid DEST_ADDR\n", + xua_hdr_dump(xua, &xua_dialect_sua)); + return NULL; + } + + if (!(called_addr.presence & OSMO_SCCP_ADDR_T_SSN)) { + LOGP(DLSCCP, LOGL_ERROR, "Cannot resolve SCCP User for " + "XUA Message %s without SSN in CalledAddr\n", + xua_hdr_dump(xua, &xua_dialect_sua)); + return NULL; + } + + return sccp_user_find(inst, called_addr.ssn, called_addr.pc); +} + /*! \brief SCOC: Receive SCRC Routing Failure * \param[in] inst SCCP Instance on which we operate * \param[in] xua SUA message that was failed to route @@ -1355,31 +1380,6 @@ void sccp_scoc_rx_scrc_rout_fail(struct osmo_sccp_instance *inst, } } -/* Find a SCCP user for given SUA message (based on SUA_IEI_DEST_ADDR */ -static struct osmo_sccp_user *sccp_find_user(struct osmo_sccp_instance *inst, - struct xua_msg *xua) -{ - int rc; - struct osmo_sccp_addr called_addr; - - rc = sua_addr_parse(&called_addr, xua, SUA_IEI_DEST_ADDR); - if (rc < 0) { - LOGP(DLSCCP, LOGL_ERROR, "Cannot find SCCP User for XUA " - "Message %s without valid DEST_ADDR\n", - xua_hdr_dump(xua, &xua_dialect_sua)); - return NULL; - } - - if (!(called_addr.presence & OSMO_SCCP_ADDR_T_SSN)) { - LOGP(DLSCCP, LOGL_ERROR, "Cannot resolve SCCP User for " - "XUA Message %s without SSN in CalledAddr\n", - xua_hdr_dump(xua, &xua_dialect_sua)); - return NULL; - } - - return sccp_user_find(inst, called_addr.ssn, called_addr.pc); -} - /* Generate a COERR based in input arguments */ static struct xua_msg *gen_coerr(uint32_t route_ctx, uint32_t dest_ref, uint32_t err_cause) |