Module: kamailio Branch: master Commit: 6189257bb8c5ba4b5a807a2a765cdcfbf0eaea75 URL: https://github.com/kamailio/kamailio/commit/6189257bb8c5ba4b5a807a2a765cdcfbf0eaea75
Author: Xenofon Karamanos <x...@gilawa.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2025-07-31T08:29:18+02:00 core: add some comment on the hardcoded numbers --- Modified: src/core/parser/parse_uri.c --- Diff: https://github.com/kamailio/kamailio/commit/6189257bb8c5ba4b5a807a2a765cdcfbf0eaea75.diff Patch: https://github.com/kamailio/kamailio/commit/6189257bb8c5ba4b5a807a2a765cdcfbf0eaea75.patch --- diff --git a/src/core/parser/parse_uri.c b/src/core/parser/parse_uri.c index bffb572dffc..fd28fba7b08 100644 --- a/src/core/parser/parse_uri.c +++ b/src/core/parser/parse_uri.c @@ -198,6 +198,10 @@ int parse_uri(char *buf, int len, struct sip_uri *uri) str comp_val; /* not returned for now */ #endif +/* derived from the ASCII values of the protocol scheme strings + ("sip:", "sips", "tel:", "urn:") interpreted as 4-byte + little-endian integers. + */ #define SIP_SCH 0x3a706973 #define SIPS_SCH 0x73706973 #define TEL_SCH 0x3a6c6574 @@ -467,6 +471,8 @@ int parse_uri(char *buf, int len, struct sip_uri *uri) goto error_too_short; scheme = ((uint32_t)buf[0]) + (((uint32_t)buf[1]) << 8) + (((uint32_t)buf[2]) << 16) + (((uint32_t)buf[3]) << 24); + /* make it case insensitive by converting to lowercase + OR with difference between 'A' and 'a' is 32 (0x20) */ scheme |= 0x20202020; if(scheme == SIP_SCH) { uri->type = SIP_URI_T; _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!