[sr-dev] git:tmp/k3.0_sr_backports: core: added new event SREV_CORE_STATS

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Feb 1 18:25:55 CET 2010


Module: sip-router
Branch: tmp/k3.0_sr_backports
Commit: 13959998a2701a279db6396cd9aa6e7913cc0ec7
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=13959998a2701a279db6396cd9aa6e7913cc0ec7

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Oct 13 20:47:35 2009 +0200

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)

---

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

diff --git a/events.c b/events.c
index 0d07395..be98221 100644
--- a/events.c
+++ b/events.c
@@ -48,6 +48,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
 					_sr_events_list.net_data_out = f;
 				else return -1;
 			break;
+		case SREV_CORE_STATS:
+				if(_sr_events_list.core_stats==0)
+					_sr_events_list.core_stats = f;
+				else return -1;
+			break;
 		default:
 			return -1;
 	}
@@ -91,6 +96,13 @@ int sr_event_exec(int type, void *data)
 					return ret;
 				} else return 1;
 			break;
+		case SREV_CORE_STATS:
+				if(unlikely(_sr_events_list.core_stats!=0))
+				{
+					ret = _sr_events_list.core_stats(data);
+					return ret;
+				} else return 1;
+			break;
 		default:
 			return -1;
 	}
diff --git a/events.h b/events.h
index 9fda619..9af0d71 100644
--- a/events.h
+++ b/events.h
@@ -25,12 +25,14 @@
 
 #define SREV_NET_DATA_IN	1
 #define SREV_NET_DATA_OUT	2
+#define SREV_CORE_STATS		3
 
 typedef int (*sr_event_cb_f)(void *data);
 
 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_t;
 
 void sr_event_cb_init(void);




More information about the sr-dev mailing list