Browse code

core: added possibility to know if SIP workers handle RPC commands

- for example when using xmlrpc module, the rpc commands are handled by
sip workers and may require special sip child initialization

Daniel-Constantin Mierla authored on 28/09/2011 20:18:53
Showing 2 changed files
... ...
@@ -112,6 +112,28 @@ struct sr_module* modules=0;
112 112
 int mod_response_cbk_no=0;
113 113
 response_function* mod_response_cbks=0;
114 114
 
115
+/**
116
+ * if set to 1, SIP worker processes handle RPC commands as well
117
+ */
118
+static int child_sip_rpc_mode = 0;
119
+
120
+void set_sip_rpc_mode(int mode)
121
+{
122
+	child_sip_rpc_mode = mode;
123
+}
124
+
125
+int get_sip_rpc_mode(void)
126
+{
127
+	return child_sip_rpc_mode;
128
+}
129
+
130
+int is_rpc_worker(int rank)
131
+{
132
+	if(rank==PROC_RPC || (rank>PROC_MAIN && child_sip_rpc_mode!=0))
133
+		return 1;
134
+	return 0;
135
+}
136
+
115 137
 /* initializes statically built (compiled in) modules*/
116 138
 int register_builtin_modules()
117 139
 {
... ...
@@ -655,4 +655,8 @@ int fixup_free_fparam_2(void** param, int param_no);
655 655
  */
656 656
 free_fixup_function get_fixup_free(fixup_function f);
657 657
 
658
+void set_sip_rpc_mode(int mode);
659
+int get_sip_rpc_mode(void);
660
+int is_rpc_worker(int rank);
661
+
658 662
 #endif /* sr_module_h */