Module: kamailio
Branch: master
Commit: 41359ef2f2e106548b39d5b21b625a72a5c5bb60
URL:
https://github.com/kamailio/kamailio/commit/41359ef2f2e106548b39d5b21b625a7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-04-12T14:18:19+02:00
core: kemi - skip "native" and "default" config engines names
- reserved for the existing kamailio.cfg interpreter
---
Modified: kemi.c
Modified: kemi.h
---
Diff:
https://github.com/kamailio/kamailio/commit/41359ef2f2e106548b39d5b21b625a7…
Patch:
https://github.com/kamailio/kamailio/commit/41359ef2f2e106548b39d5b21b625a7…
---
diff --git a/kemi.c b/kemi.c
index 22f55c0..76a67e1 100644
--- a/kemi.c
+++ b/kemi.c
@@ -187,6 +187,9 @@ int sr_kemi_eng_register(str *ename, sr_kemi_eng_route_f froute)
_sr_kemi_eng_list[_sr_kemi_eng_list_size].froute = froute;
_sr_kemi_eng_list_size++;
+ LM_DBG("registered config routing enginge [%.*s]",
+ ename->len, ename->s);
+
return 0;
}
@@ -197,6 +200,14 @@ int sr_kemi_eng_set(str *ename, str *cpath)
{
int i;
+ /* skip native and default */
+ if(ename->len==6 && strncasecmp(ename->s, "native", 6)==0) {
+ return 0;
+ }
+ if(ename->len==7 && strncasecmp(ename->s, "default", 7)==0) {
+ return 0;
+ }
+
for(i=0; i<_sr_kemi_eng_list_size; i++) {
if(_sr_kemi_eng_list[i].ename.len==ename->len
&& strncasecmp(_sr_kemi_eng_list[i].ename.s, ename->s,
@@ -209,6 +220,27 @@ int sr_kemi_eng_set(str *ename, str *cpath)
return -1;
}
+/**
+ *
+ */
+int sr_kemi_eng_setz(char *ename, char *cpath)
+{
+ str sname;
+ str spath;
+
+ sname.s = ename;
+ sname.len = strlen(ename);
+
+ if(cpath!=0) {
+ spath.s = cpath;
+ spath.len = strlen(cpath);
+ return sr_kemi_eng_set(&sname, &spath);
+ } else {
+ return sr_kemi_eng_set(&sname, NULL);
+ }
+}
+
+
sr_kemi_eng_t* sr_kemi_eng_get(void)
{
return _sr_kemi_eng;
diff --git a/kemi.h b/kemi.h
index c0087c6..19e328b 100644
--- a/kemi.h
+++ b/kemi.h
@@ -100,6 +100,7 @@ typedef struct sr_kemi_eng {
int sr_kemi_eng_register(str *ename, sr_kemi_eng_route_f froute);
int sr_kemi_eng_set(str *ename, str *cpath);
+int sr_kemi_eng_setz(char *ename, char *cpath);
sr_kemi_eng_t* sr_kemi_eng_get(void);
#endif