This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/3363
add osmo_sccp_addr_name() and two value_string[]s
osmo_sccp_addr_dump() just prints the raw values. In osmo_sccp_addr_name(), use
osmo_ss7_pointcode_print() and newly added SSN and GT value_string[] to print
more meaningful log output.
Change-Id: Ie1aedd7894acd69ddc887cd65a8a0df4b888838c
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_helpers.c
M src/sccp_sap.c
3 files changed, 81 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/63/3363/1
diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h
index 6ae8579..d44e347 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -60,6 +60,11 @@
OSMO_SCCP_RI_SSN_IP,
};
+extern const struct value_string osmo_sccp_routing_ind_names[];
+static inline const char *osmo_sccp_routing_ind_name(enum osmo_sccp_routing_ind val)
+{ return get_value_string(osmo_sccp_routing_ind_names, val); }
+
+
/* Q.713 3.4.1 + RFC 3868 3.10.2.3 */
enum osmo_sccp_gti {
OSMO_SCCP_GTI_NO_GT,
@@ -68,6 +73,10 @@
OSMO_SCCP_GTI_TT_NPL_ENC,
OSMO_SCCP_GTI_TT_NPL_ENC_NAI,
};
+
+extern const struct value_string osmo_sccp_gti_names[];
+static inline const char *osmo_sccp_gti_name(enum osmo_sccp_gti val)
+{ return get_value_string(osmo_sccp_gti_names, val); }
/* RFC 3868 3.10.2.3 */
enum osmo_sccp_npi {
@@ -126,6 +135,10 @@
OSMO_SCCP_SSN_BSS_OAM = 253,
};
+extern const struct value_string osmo_sccp_ssn_names[];
+static inline const char *osmo_sccp_ssn_name(enum osmo_sccp_ssn val)
+{ return get_value_string(osmo_sccp_ssn_names, val); }
+
struct osmo_sccp_gt {
uint8_t gti;
uint8_t tt;
diff --git a/src/sccp_helpers.c b/src/sccp_helpers.c
index 2320fe5..471c9cb 100644
--- a/src/sccp_helpers.c
+++ b/src/sccp_helpers.c
@@ -274,6 +274,7 @@
return buf;
}
+/* Return string representation of SCCP address raw bytes in a static string. */
char *osmo_sccp_addr_dump(const struct osmo_sccp_addr *addr)
{
static char buf[256];
@@ -295,3 +296,26 @@
return buf;
}
+
+/* Like osmo_sccp_addr_dump() but print human readable representations instead of raw values. */
+char *osmo_sccp_addr_name(const struct osmo_ss7_instance *ss7, const struct osmo_sccp_addr *addr)
+{
+ static char buf[256];
+ bool comma = false;
+
+ buf[0] = '\0';
+
+ append_to_buf(buf, &comma, "RI=%s", osmo_sccp_routing_ind_name(addr->ri));
+
+ if (addr->presence & OSMO_SCCP_ADDR_T_PC)
+ append_to_buf(buf, &comma, "PC=%s", osmo_ss7_pointcode_print(ss7, addr->pc));
+ if (addr->presence & OSMO_SCCP_ADDR_T_SSN)
+ append_to_buf(buf, &comma, "SSN=%s", osmo_sccp_ssn_name(addr->ssn));
+ if (addr->presence & OSMO_SCCP_ADDR_T_IPv4)
+ append_to_buf(buf, &comma, "IP=%s", inet_ntoa(addr->ip.v4));
+ append_to_buf(buf, &comma, "GTI=%s", osmo_sccp_gti_name(addr->gt.gti));
+ if (addr->presence & OSMO_SCCP_ADDR_T_GT)
+ append_to_buf(buf, &comma, "GT=(%s)", osmo_sccp_gt_dump(&addr->gt));
+
+ return buf;
+}
diff --git a/src/sccp_sap.c b/src/sccp_sap.c
index d4580ae..a4b4087 100644
--- a/src/sccp_sap.c
+++ b/src/sccp_sap.c
@@ -85,3 +85,47 @@
return prim_name_buf;
}
+
+const struct value_string osmo_sccp_routing_ind_names[] = {
+ { OSMO_SCCP_RI_NONE, "NONE" },
+ { OSMO_SCCP_RI_GT, "GT" },
+ { OSMO_SCCP_RI_SSN_PC, "SSN_PC" },
+ { OSMO_SCCP_RI_SSN_IP, "SSN_IP" },
+};
+
+const struct value_string osmo_sccp_gti_names[] = {
+ { OSMO_SCCP_GTI_NO_GT, "NO_GT" },
+ { OSMO_SCCP_GTI_NAI_ONLY, "NAI_ONLY" },
+ { OSMO_SCCP_GTI_TT_ONLY, "TT_ONLY" },
+ { OSMO_SCCP_GTI_TT_NPL_ENC, "TT_NPL_ENC" },
+ { OSMO_SCCP_GTI_TT_NPL_ENC_NAI, "TT_NPL_ENC_NAI" },
+};
+
+const struct value_string osmo_sccp_ssn_names[] = {
+ { OSMO_SCCP_SSN_MGMT, "MGMT" },
+ { OSMO_SCCP_SSN_ISUP, "ISUP" },
+ { OSMO_SCCP_SSN_OMAP, "OMAP" },
+ { OSMO_SCCP_SSN_MAP, "MAP" },
+ { OSMO_SCCP_SSN_HLR, "HLR" },
+ { OSMO_SCCP_SSN_VLR, "VLR" },
+ { OSMO_SCCP_SSN_MSC, "MSC" },
+ { OSMO_SCCP_SSN_EIR, "EIR" },
+ { OSMO_SCCP_SSN_AUC, "AUC" },
+ { OSMO_SCCP_SSN_ISDN_SS, "ISDN_SS" },
+ { OSMO_SCCP_SSN_RES_INTL, "RES_INTL" },
+ { OSMO_SCCP_SSN_BISDN, "BISDN" },
+ { OSMO_SCCP_SSN_TC_TEST, "TC_TEST" },
+ { OSMO_SCCP_SSN_RANAP, "RANAP" },
+ { OSMO_SCCP_SSN_RNSAP, "RNSAP" },
+ { OSMO_SCCP_SSN_GMLC_MAP, "GMLC_MAP" },
+ { OSMO_SCCP_SSN_CAP, "CAP" },
+ { OSMO_SCCP_SSN_gsmSCF_MAP, "gsmSCF_MAP" },
+ { OSMO_SCCP_SSN_SIWF_MAP, "SIWF_MAP" },
+ { OSMO_SCCP_SSN_SGSN_MAP, "SGSN_MAP" },
+ { OSMO_SCCP_SSN_GGSN_MAP, "GGSN_MAP" },
+ { OSMO_SCCP_SSN_PCAP, "PCAP" },
+ { OSMO_SCCP_SSN_BSC_BSSAP, "BSC_BSSAP" },
+ { OSMO_SCCP_SSN_MSC_BSSAP, "MSC_BSSAP" },
+ { OSMO_SCCP_SSN_SMLC_BSSAP, "SMLC_BSSAP" },
+ { OSMO_SCCP_SSN_BSS_OAM, "BSS_OAM" },
+};
--
To view, visit https://gerrit.osmocom.org/3363
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1aedd7894acd69ddc887cd65a8a0df4b888838c
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>