Răsfoiți Sursa

topoh: added mod param use_mode

- if set to 1, the module is initialized only for use as a library, via
  inter-module api functions
- default: 0 - initialized for use to process sip messages
Daniel-Constantin Mierla 2 ani în urmă
părinte
comite
5b9f22c0f4
1 a modificat fișierele cu 8 adăugiri și 0 ștergeri
  1. 8 0
      src/modules/topoh/topoh_mod.c

+ 8 - 0
src/modules/topoh/topoh_mod.c

@@ -82,6 +82,7 @@ int th_param_mask_mode = 0;
 int th_sanity_checks = 0;
 int th_uri_prefix_checks = 0;
 int th_mask_addr_myself = 0;
+int _th_use_mode = 0;
 
 sanity_api_t scb;
 
@@ -116,6 +117,7 @@ static param_export_t params[]={
 	{"uri_prefix_checks",	PARAM_INT, &th_uri_prefix_checks},
 	{"event_callback",	PARAM_STR, &_th_eventrt_callback},
 	{"event_mode",		PARAM_INT, &_th_eventrt_mode},
+	{"use_mode",		PARAM_INT, &_th_use_mode},
 	{0,0,0}
 };
 
@@ -147,6 +149,12 @@ static int mod_init(void)
 	sip_uri_t puri;
 	char buri[MAX_URI_SIZE];
 
+	if(_th_use_mode==1) {
+		/* use in library mode, not for processing sip messages */
+		th_mask_init();
+		return 0;
+	}
+
 	_th_eventrt_outgoing = route_lookup(&event_rt, _th_eventrt_outgoing_name.s);
 	if(_th_eventrt_outgoing<0
 			|| event_rt.rlist[_th_eventrt_outgoing]==NULL) {