[sr-dev] git:master: core: new core event: SREV_CFG_RUN_ACTION

Daniel-Constantin Mierla miconda at gmail.com
Thu Feb 4 00:31:18 CET 2010


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Feb  4 00:05:41 2010 +0100

core: new core event: SREV_CFG_RUN_ACTION

- it is fired for each action executed from configuration file
- parameters are current acction and sip message given as a void* array
  of two elements

---

 events.c |   11 +++++++++++
 events.h |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/events.c b/events.c
index 6b29fa2..f2be3ad 100644
--- a/events.c
+++ b/events.c
@@ -60,6 +60,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
 					_sr_events_list.core_stats = f;
 				else return -1;
 			break;
+		case SREV_CFG_RUN_ACTION:
+				if(_sr_events_list.run_action==0)
+					_sr_events_list.run_action = f;
+				else return -1;
+			break;
 		default:
 			return -1;
 	}
@@ -110,6 +115,12 @@ int sr_event_exec(int type, void *data)
 					return ret;
 				} else return 1;
 			break;
+		case SREV_CFG_RUN_ACTION:
+				if(unlikely(_sr_events_list.run_action!=0))
+				{
+					ret = _sr_events_list.run_action(data);
+					return ret;
+				} else return 1;
 		default:
 			return -1;
 	}
diff --git a/events.h b/events.h
index 9af0d71..5c7238a 100644
--- a/events.h
+++ b/events.h
@@ -26,6 +26,7 @@
 #define SREV_NET_DATA_IN	1
 #define SREV_NET_DATA_OUT	2
 #define SREV_CORE_STATS		3
+#define SREV_CFG_RUN_ACTION 4
 
 typedef int (*sr_event_cb_f)(void *data);
 
@@ -33,6 +34,7 @@ typedef struct sr_event_cb {
 	sr_event_cb_f net_data_in;
 	sr_event_cb_f net_data_out;
 	sr_event_cb_f core_stats;
+	sr_event_cb_f run_action;
 } sr_event_cb_t;
 
 void sr_event_cb_init(void);




More information about the sr-dev mailing list