pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40250?usp=email )
Change subject: sccp: Implement dpc_accessible() ......................................................................
sccp: Implement dpc_accessible()
Change-Id: I16b0aa71db5be2daf7a8c52da829a38ad564eb7b --- M src/sccp_scrc.c 1 file changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/50/40250/1
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c index 63ded9d..8a0ddd1 100644 --- a/src/sccp_scrc.c +++ b/src/sccp_scrc.c @@ -62,9 +62,28 @@ return false; }
-static bool dpc_accessible(struct osmo_sccp_instance *inst, uint32_t pc) +static bool dpc_accessible(struct osmo_sccp_instance *inst, uint32_t dpc) { - /* TODO: implement this! */ + struct osmo_ss7_route *rt; + struct osmo_ss7_route_label rtlabel; + + if (osmo_ss7_pc_is_local(inst->ss7, dpc)) { + LOGP(DLSCCP, LOGL_DEBUG, "dpc_accessible(%u): true (local)\n", dpc); + return true; + } + + rtlabel = (struct osmo_ss7_route_label){ + .opc = 0, + .dpc = dpc, + .sls = 0, + }; + + rt = ss7_instance_lookup_route(inst->ss7, &rtlabel); + if (!rt) { + LOGP(DLSCCP, LOGL_INFO, "dpc_accessible(%u): false\n", dpc); + return false; + } + LOGP(DLSCCP, LOGL_DEBUG, "dpc_accessible(%u): true\n", dpc); return true; }