Browse code

core: allow to specify that rpc worker may handle sip commands

- a sip child process can handle rpc (e.g., xmlops module) and a rpc
child process can handle sip commands (e.g., mi cmd to end dlg and
event_route[tm:local-request])

Daniel-Constantin Mierla authored on 28/09/2011 21:52:49
Showing 2 changed files
... ...
@@ -113,23 +113,37 @@ int mod_response_cbk_no=0;
113 113
 response_function* mod_response_cbks=0;
114 114
 
115 115
 /**
116
- * if set to 1, SIP worker processes handle RPC commands as well
116
+ * if bit 1 set, SIP worker processes handle RPC commands as well
117
+ * if bit 2 set, RPC worker processes handle SIP commands as well
117 118
  */
118 119
 static int child_sip_rpc_mode = 0;
119 120
 
120
-void set_sip_rpc_mode(int mode)
121
+#define CHILD_SIP_RPC	1<<0
122
+#define CHILD_RPC_SIP	1<<1
123
+
124
+void set_child_sip_rpc_mode(void)
121 125
 {
122
-	child_sip_rpc_mode = mode;
126
+	child_sip_rpc_mode |= CHILD_SIP_RPC;
123 127
 }
124 128
 
125
-int get_sip_rpc_mode(void)
129
+void set_child_rpc_sip_mode(void)
126 130
 {
127
-	return child_sip_rpc_mode;
131
+	child_sip_rpc_mode |= CHILD_RPC_SIP;
128 132
 }
129 133
 
130 134
 int is_rpc_worker(int rank)
131 135
 {
132
-	if(rank==PROC_RPC || (rank>PROC_MAIN && child_sip_rpc_mode!=0))
136
+	if(rank==PROC_RPC
137
+			|| (rank>PROC_MAIN && (child_sip_rpc_mode&CHILD_SIP_RPC)!=0))
138
+		return 1;
139
+	return 0;
140
+}
141
+
142
+int is_sip_worker(int rank)
143
+{
144
+	if(rank>PROC_MAIN
145
+			|| ((rank==PROC_RPC || rank==PROC_NOCHLDINIT)
146
+					&& (child_sip_rpc_mode&CHILD_RPC_SIP)!=0))
133 147
 		return 1;
134 148
 	return 0;
135 149
 }
... ...
@@ -655,8 +655,9 @@ 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);
658
+void set_child_sip_rpc_mode(void);
659
+void set_child_rpc_sip_mode(void);
660
+int is_sip_worker(int rank);
660 661
 int is_rpc_worker(int rank);
661 662
 
662 663
 #endif /* sr_module_h */