Browse code

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

Daniel-Constantin Mierla authored on 03/02/2010 23:05:41
Showing 2 changed files
... ...
@@ -60,6 +60,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
60 60
 					_sr_events_list.core_stats = f;
61 61
 				else return -1;
62 62
 			break;
63
+		case SREV_CFG_RUN_ACTION:
64
+				if(_sr_events_list.run_action==0)
65
+					_sr_events_list.run_action = f;
66
+				else return -1;
67
+			break;
63 68
 		default:
64 69
 			return -1;
65 70
 	}
... ...
@@ -110,6 +115,12 @@ int sr_event_exec(int type, void *data)
110 115
 					return ret;
111 116
 				} else return 1;
112 117
 			break;
118
+		case SREV_CFG_RUN_ACTION:
119
+				if(unlikely(_sr_events_list.run_action!=0))
120
+				{
121
+					ret = _sr_events_list.run_action(data);
122
+					return ret;
123
+				} else return 1;
113 124
 		default:
114 125
 			return -1;
115 126
 	}
... ...
@@ -26,6 +26,7 @@
26 26
 #define SREV_NET_DATA_IN	1
27 27
 #define SREV_NET_DATA_OUT	2
28 28
 #define SREV_CORE_STATS		3
29
+#define SREV_CFG_RUN_ACTION 4
29 30
 
30 31
 typedef int (*sr_event_cb_f)(void *data);
31 32
 
... ...
@@ -33,6 +34,7 @@ typedef struct sr_event_cb {
33 34
 	sr_event_cb_f net_data_in;
34 35
 	sr_event_cb_f net_data_out;
35 36
 	sr_event_cb_f core_stats;
37
+	sr_event_cb_f run_action;
36 38
 } sr_event_cb_t;
37 39
 
38 40
 void sr_event_cb_init(void);