Browse code

core: kemi - skip "native" and "default" config engines names

- reserved for the existing kamailio.cfg interpreter

Daniel-Constantin Mierla authored on 12/04/2016 12:18:19
Showing 2 changed files
... ...
@@ -187,6 +187,9 @@ int sr_kemi_eng_register(str *ename, sr_kemi_eng_route_f froute)
187 187
 	_sr_kemi_eng_list[_sr_kemi_eng_list_size].froute = froute;
188 188
 	_sr_kemi_eng_list_size++;
189 189
 
190
+	LM_DBG("registered config routing enginge [%.*s]",
191
+			ename->len, ename->s);
192
+
190 193
 	return 0;
191 194
 }
192 195
 
... ...
@@ -197,6 +200,14 @@ int sr_kemi_eng_set(str *ename, str *cpath)
197 197
 {
198 198
 	int i;
199 199
 
200
+	/* skip native and default */
201
+	if(ename->len==6 && strncasecmp(ename->s, "native", 6)==0) {
202
+		return 0;
203
+	}
204
+	if(ename->len==7 && strncasecmp(ename->s, "default", 7)==0) {
205
+		return 0;
206
+	}
207
+
200 208
 	for(i=0; i<_sr_kemi_eng_list_size; i++) {
201 209
 		if(_sr_kemi_eng_list[i].ename.len==ename->len
202 210
 				&& strncasecmp(_sr_kemi_eng_list[i].ename.s, ename->s,
... ...
@@ -209,6 +220,27 @@ int sr_kemi_eng_set(str *ename, str *cpath)
209 209
 	return -1;
210 210
 }
211 211
 
212
+/**
213
+ *
214
+ */
215
+int sr_kemi_eng_setz(char *ename, char *cpath)
216
+{
217
+	str sname;
218
+	str spath;
219
+
220
+	sname.s = ename;
221
+	sname.len = strlen(ename);
222
+
223
+	if(cpath!=0) {
224
+		spath.s = cpath;
225
+		spath.len = strlen(cpath);
226
+		return sr_kemi_eng_set(&sname, &spath);
227
+	} else {
228
+		return sr_kemi_eng_set(&sname, NULL);
229
+	}
230
+}
231
+
232
+
212 233
 sr_kemi_eng_t* sr_kemi_eng_get(void)
213 234
 {
214 235
 	return _sr_kemi_eng;
... ...
@@ -100,6 +100,7 @@ typedef struct sr_kemi_eng {
100 100
 
101 101
 int sr_kemi_eng_register(str *ename, sr_kemi_eng_route_f froute);
102 102
 int sr_kemi_eng_set(str *ename, str *cpath);
103
+int sr_kemi_eng_setz(char *ename, char *cpath);
103 104
 sr_kemi_eng_t* sr_kemi_eng_get(void);
104 105
 
105 106
 #endif