Browse code

core: added new event SREV_CORE_STATS

- to be used by Kamailio core statistics not included in stock SR core
(cherry picked from commit 47c89177ce276cdf8f6a2d06fdd3359ba283fe4c)

Daniel-Constantin Mierla authored on 13/10/2009 18:47:35 • Andrei Pelinescu-Onciul committed on 01/02/2010 15:51:13
Showing 2 changed files
... ...
@@ -48,6 +48,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
48 48
 					_sr_events_list.net_data_out = f;
49 49
 				else return -1;
50 50
 			break;
51
+		case SREV_CORE_STATS:
52
+				if(_sr_events_list.core_stats==0)
53
+					_sr_events_list.core_stats = f;
54
+				else return -1;
55
+			break;
51 56
 		default:
52 57
 			return -1;
53 58
 	}
... ...
@@ -91,6 +96,13 @@ int sr_event_exec(int type, void *data)
91 96
 					return ret;
92 97
 				} else return 1;
93 98
 			break;
99
+		case SREV_CORE_STATS:
100
+				if(unlikely(_sr_events_list.core_stats!=0))
101
+				{
102
+					ret = _sr_events_list.core_stats(data);
103
+					return ret;
104
+				} else return 1;
105
+			break;
94 106
 		default:
95 107
 			return -1;
96 108
 	}
... ...
@@ -25,12 +25,14 @@
25 25
 
26 26
 #define SREV_NET_DATA_IN	1
27 27
 #define SREV_NET_DATA_OUT	2
28
+#define SREV_CORE_STATS		3
28 29
 
29 30
 typedef int (*sr_event_cb_f)(void *data);
30 31
 
31 32
 typedef struct sr_event_cb {
32 33
 	sr_event_cb_f net_data_in;
33 34
 	sr_event_cb_f net_data_out;
35
+	sr_event_cb_f core_stats;
34 36
 } sr_event_cb_t;
35 37
 
36 38
 void sr_event_cb_init(void);