Module: sip-router
Branch: master
Commit: ac0bd3790b40a4788cea83542b99fe9dd08116bf
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ac0bd37…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Jul 18 16:01:29 2014 +0200
core: new core event executed when a non sip packet is received
- event type SREV_RCV_NOSIP
---
events.c | 13 +++++++++++++
events.h | 3 ++-
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/events.c b/events.c
index a22af75..7b7625f 100644
--- a/events.c
+++ b/events.c
@@ -152,6 +152,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
_sr_events_list.stun_in = f;
else return -1;
break;
+ case SREV_RCV_NOSIP:
+ if(_sr_events_list.rcv_nosip==0)
+ _sr_events_list.rcv_nosip = f;
+ else return -1;
+ break;
default:
return -1;
}
@@ -255,6 +260,12 @@ int sr_event_exec(int type, void *data)
ret = _sr_events_list.stun_in(data);
return ret;
} else return 1;
+ case SREV_RCV_NOSIP:
+ if(unlikely(_sr_events_list.rcv_nosip!=0))
+ {
+ ret = _sr_events_list.rcv_nosip(data);
+ return ret;
+ } else return 1;
default:
return -1;
}
@@ -288,6 +299,8 @@ int sr_event_enabled(int type)
return (_sr_events_list.tcp_ws_frame_out!=0)?1:0;
case SREV_STUN_IN:
return (_sr_events_list.stun_in!=0)?1:0;
+ case SREV_RCV_NOSIP:
+ return (_sr_events_list.rcv_nosip!=0)?1:0;
}
return 0;
}
diff --git a/events.h b/events.h
index f3cb4bc..df001a7 100644
--- a/events.h
+++ b/events.h
@@ -28,7 +28,7 @@
#define SREV_CORE_STATS 3
#define SREV_CFG_RUN_ACTION 4
#define SREV_PKG_UPDATE_STATS 5
-/* 6 - not used anymore */
+#define SREV_RCV_NOSIP 6
#define SREV_NET_DGRAM_IN 7
#define SREV_TCP_HTTP_100C 8
#define SREV_TCP_MSRP_FRAME 9
@@ -51,6 +51,7 @@ typedef struct sr_event_cb {
sr_event_cb_f tcp_ws_frame_in;
sr_event_cb_f tcp_ws_frame_out;
sr_event_cb_f stun_in;
+ sr_event_cb_f rcv_nosip;
} sr_event_cb_t;
void sr_event_cb_init(void);