[sr-dev] git:master: core: added possibility to know if SIP workers handle RPC commands

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 29 10:26:56 CEST 2011


Module: sip-router
Branch: master
Commit: 37db0ca71dd14653182ac3c50bc27c7271f322cf
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=37db0ca71dd14653182ac3c50bc27c7271f322cf

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Sep 28 22:18:53 2011 +0200

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

---

 sr_module.c |   22 ++++++++++++++++++++++
 sr_module.h |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/sr_module.c b/sr_module.c
index f861655..9da476f 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -112,6 +112,28 @@ struct sr_module* modules=0;
 int mod_response_cbk_no=0;
 response_function* mod_response_cbks=0;
 
+/**
+ * if set to 1, SIP worker processes handle RPC commands as well
+ */
+static int child_sip_rpc_mode = 0;
+
+void set_sip_rpc_mode(int mode)
+{
+	child_sip_rpc_mode = mode;
+}
+
+int get_sip_rpc_mode(void)
+{
+	return child_sip_rpc_mode;
+}
+
+int is_rpc_worker(int rank)
+{
+	if(rank==PROC_RPC || (rank>PROC_MAIN && child_sip_rpc_mode!=0))
+		return 1;
+	return 0;
+}
+
 /* initializes statically built (compiled in) modules*/
 int register_builtin_modules()
 {
diff --git a/sr_module.h b/sr_module.h
index deea860..5a56923 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -655,4 +655,8 @@ int fixup_free_fparam_2(void** param, int param_no);
  */
 free_fixup_function get_fixup_free(fixup_function f);
 
+void set_sip_rpc_mode(int mode);
+int get_sip_rpc_mode(void);
+int is_rpc_worker(int rank);
+
 #endif /* sr_module_h */




More information about the sr-dev mailing list