pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40250?usp=email )
(
6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: sccp: Implement dpc_accessible() ......................................................................
sccp: Implement dpc_accessible()
Change-Id: I16b0aa71db5be2daf7a8c52da829a38ad564eb7b --- M src/sccp_scrc.c 1 file changed, 31 insertions(+), 2 deletions(-)
Approvals: daniel: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c index 543a464..1ca7cfe 100644 --- a/src/sccp_scrc.c +++ b/src/sccp_scrc.c @@ -62,9 +62,38 @@ return false; }
-static bool dpc_accessible(struct osmo_sccp_instance *inst, uint32_t pc) +/* ITU Q.714: "DPC accessible ?" + * Figure C.1/Q.714 - SCCP routing control procedures (SCRC) + * "sheet 4 of 12", "sheet 5 of 12", "sheet 10 of 12" + */ +static bool dpc_accessible(struct osmo_sccp_instance *inst, uint32_t dpc) { - /* TODO: implement this! */ + struct osmo_ss7_instance *ss7 = inst->ss7; + struct osmo_ss7_route *rt; + struct osmo_ss7_route_label rtlabel; + char buf_dpc[MAX_PC_STR_LEN]; + + if (osmo_ss7_pc_is_local(ss7, dpc)) { + LOGPSCI(inst, LOGL_DEBUG, "dpc_accessible(DPC=%u=%s): true (local)\n", + dpc, osmo_ss7_pointcode_print_buf(buf_dpc, sizeof(buf_dpc), ss7, dpc)); + return true; + } + + rtlabel = (struct osmo_ss7_route_label){ + .opc = 0, + .dpc = dpc, + .sls = 0, + }; + + rt = ss7_instance_lookup_route(ss7, &rtlabel); + if (!rt) { + LOGPSCI(inst, LOGL_INFO, "dpc_accessible(DPC=%u=%s): false\n", + dpc, osmo_ss7_pointcode_print_buf(buf_dpc, sizeof(buf_dpc), ss7, dpc)); + return false; + } + + LOGPSCI(inst, LOGL_DEBUG, "dpc_accessible(DPC=%u=%s): true\n", + dpc, osmo_ss7_pointcode_print_buf(buf_dpc, sizeof(buf_dpc), ss7, dpc)); return true; }