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 200
 {
198 201
 	int i;
199 202
 
203
+	/* skip native and default */
204
+	if(ename->len==6 && strncasecmp(ename->s, "native", 6)==0) {
205
+		return 0;
206
+	}
207
+	if(ename->len==7 && strncasecmp(ename->s, "default", 7)==0) {
208
+		return 0;
209
+	}
210
+
200 211
 	for(i=0; i<_sr_kemi_eng_list_size; i++) {
201 212
 		if(_sr_kemi_eng_list[i].ename.len==ename->len
202 213
 				&& strncasecmp(_sr_kemi_eng_list[i].ename.s, ename->s,
... ...
@@ -209,6 +220,27 @@ int sr_kemi_eng_set(str *ename, str *cpath)
209 220
 	return -1;
210 221
 }
211 222
 
223
+/**
224
+ *
225
+ */
226
+int sr_kemi_eng_setz(char *ename, char *cpath)
227
+{
228
+	str sname;
229
+	str spath;
230
+
231
+	sname.s = ename;
232
+	sname.len = strlen(ename);
233
+
234
+	if(cpath!=0) {
235
+		spath.s = cpath;
236
+		spath.len = strlen(cpath);
237
+		return sr_kemi_eng_set(&sname, &spath);
238
+	} else {
239
+		return sr_kemi_eng_set(&sname, NULL);
240
+	}
241
+}
242
+
243
+
212 244
 sr_kemi_eng_t* sr_kemi_eng_get(void)
213 245
 {
214 246
 	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