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
This commit is contained in:
Oliver Smith 2019-04-03 14:26:17 +02:00
parent 67b895e156
commit ee0bcf2fca
1 changed files with 25 additions and 25 deletions

View File

@ -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)