Module: kamailio
Branch: master
Commit: 34afdb987d55d984da49b5896649cea1fc3d075b
URL:
https://github.com/kamailio/kamailio/commit/34afdb987d55d984da49b5896649cea…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-01-11T22:24:28+01:00
core: new event SREV_NET_DATA_RECV
- to be executed if a sip message has been received
---
Modified: events.c
Modified: events.h
---
Diff:
https://github.com/kamailio/kamailio/commit/34afdb987d55d984da49b5896649cea…
Patch:
https://github.com/kamailio/kamailio/commit/34afdb987d55d984da49b5896649cea…
---
diff --git a/events.c b/events.c
index b140b61..d2e3286 100644
--- a/events.c
+++ b/events.c
@@ -170,6 +170,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
_sr_events_list.tcp_closed = f;
else return -1;
break;
+ case SREV_NET_DATA_RECV:
+ if(_sr_events_list.net_data_recv==0)
+ _sr_events_list.net_data_recv = f;
+ else return -1;
+ break;
case SREV_NET_DATA_SEND:
if(_sr_events_list.net_data_send==0)
_sr_events_list.net_data_send = f;
@@ -300,6 +305,12 @@ int sr_event_exec(int type, void *data)
ret = _sr_events_list.tcp_closed(data);
return ret;
} else return 1;
+ case SREV_NET_DATA_RECV:
+ if(unlikely(_sr_events_list.net_data_recv!=0))
+ {
+ ret = _sr_events_list.net_data_recv(data);
+ return ret;
+ } else return 1;
case SREV_NET_DATA_SEND:
if(unlikely(_sr_events_list.net_data_send!=0))
{
@@ -343,6 +354,8 @@ int sr_event_enabled(int type)
return (_sr_events_list.rcv_nosip!=0)?1:0;
case SREV_TCP_CLOSED:
return (_sr_events_list.tcp_closed!=0)?1:0;
+ case SREV_NET_DATA_RECV:
+ return (_sr_events_list.net_data_recv!=0)?1:0;
case SREV_NET_DATA_SEND:
return (_sr_events_list.net_data_send!=0)?1:0;
}
diff --git a/events.h b/events.h
index 86ab784..60d53d7 100644
--- a/events.h
+++ b/events.h
@@ -35,7 +35,8 @@
#define SREV_TCP_WS_FRAME_OUT 11
#define SREV_STUN_IN 12
#define SREV_TCP_CLOSED 13
-#define SREV_NET_DATA_SEND 14
+#define SREV_NET_DATA_RECV 14
+#define SREV_NET_DATA_SEND 15
#define SREV_CB_LIST_SIZE 3
@@ -55,6 +56,7 @@ typedef struct sr_event_cb {
sr_event_cb_f stun_in;
sr_event_cb_f rcv_nosip;
sr_event_cb_f tcp_closed;
+ sr_event_cb_f net_data_recv;
sr_event_cb_f net_data_send;
} sr_event_cb_t;