From b114b73e5d22e3f9b396fa6af42d64b0b6cb7a02 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 5 Sep 2020 00:10:01 +0200 Subject: add OSMO_SCCP_ADDR_T_MASK for osmo_sccp_addr_cmp() Avoid magic number 0xffffffff and rather provide a mask value for all address components. Change-Id: I13ff0858e496c4392b8e1590d62f7eb80f191a07 --- include/osmocom/sigtran/sccp_sap.h | 1 + src/sccp_user.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/osmocom/sigtran/sccp_sap.h b/include/osmocom/sigtran/sccp_sap.h index 817ac45..de9b24c 100644 --- a/include/osmocom/sigtran/sccp_sap.h +++ b/include/osmocom/sigtran/sccp_sap.h @@ -51,6 +51,7 @@ enum osmo_scu_prim_type { #define OSMO_SCCP_ADDR_T_SSN 0x0004 /* subsystem number */ #define OSMO_SCCP_ADDR_T_IPv4 0x0008 #define OSMO_SCCP_ADDR_T_IPv6 0x0010 +#define OSMO_SCCP_ADDR_T_MASK 0x001f /* Q.713 3.4.1 + RFC 3868 3.10.2.3 */ enum osmo_sccp_routing_ind { diff --git a/src/sccp_user.c b/src/sccp_user.c index e1329ac..880cab1 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -342,8 +342,8 @@ int osmo_sccp_gt_cmp(const struct osmo_sccp_gt *a, const struct osmo_sccp_gt *b) * The SCCP addresses' Routing Indicator is not compared, see osmo_sccp_addr_ri_cmp(). * \param[in] a left side. * \param[in] b right side. - * \param[in] presence_criteria A bitmask of OSMO_SCCP_ADDR_T_* values, or 0xffffffff to compare all parts, except the - * routing indicator. + * \param[in] presence_criteria A bitmask of OSMO_SCCP_ADDR_T_* values, or OSMO_SCCP_ADDR_T_MASK to compare all parts, + * except the routing indicator. * \return -1 if a < b, 1 if a > b, and 0 if all checked values match. */ int osmo_sccp_addr_cmp(const struct osmo_sccp_addr *a, const struct osmo_sccp_addr *b, uint32_t presence_criteria) -- cgit v1.2.3