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;
}
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40250?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I16b0aa71db5be2daf7a8c52da829a38ad564eb7b
Gerrit-Change-Number: 40250
Gerrit-PatchSet: 7
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>