git:master:f8697609: cfgutils: core_hash() exported to kemi framework

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

git:master:f8697609: cfgutils: core_hash() exported to kemi framework

Daniel-Constantin Mierla-6
Module: kamailio
Branch: master
Commit: f86976098695f2b7fb765d8c59da6da96d791235
URL: https://github.com/kamailio/kamailio/commit/f86976098695f2b7fb765d8c59da6da96d791235

Author: Daniel-Constantin Mierla <[hidden email]>
Committer: Daniel-Constantin Mierla <[hidden email]>
Date: 2017-06-18T08:32:04+02:00

cfgutils: core_hash() exported to kemi framework

---

Modified: src/modules/cfgutils/cfgutils.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f86976098695f2b7fb765d8c59da6da96d791235.diff
Patch: https://github.com/kamailio/kamailio/commit/f86976098695f2b7fb765d8c59da6da96d791235.patch

---

diff --git a/src/modules/cfgutils/cfgutils.c b/src/modules/cfgutils/cfgutils.c
index 571ff3b71d..0b72186546 100644
--- a/src/modules/cfgutils/cfgutils.c
+++ b/src/modules/cfgutils/cfgutils.c
@@ -943,6 +943,18 @@ static int w_core_hash(struct sip_msg *msg, char *p1, char *p2, char *p3)
         return core_hash(&s1, s2.len ? &s2 : NULL, size) + 1;
 }
 
+static int ki_core_hash(sip_msg_t *msg, str *s1, str *s2, int sz)
+{
+ int size;
+
+ size = sz;
+
+ if (size <= 0) size = 2;
+ else size = 1 << size;
+
+ return core_hash(s1, (s2 && s2->len>0)?s2:NULL, size) + 1;
+}
+
 /**
  * @brief bind functions to CFGUTILS API structure
  */
@@ -1023,6 +1035,11 @@ static sr_kemi_t sr_kemi_cfgutils_exports[] = {
  { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
  SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
  },
+ { str_init("cfgutils"), str_init("core_hash"),
+ SR_KEMIP_INT, ki_core_hash,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
 
  { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };


_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev