Browse code

core: new core event executed when a non sip packet is received

- event type SREV_RCV_NOSIP

Daniel-Constantin Mierla authored on 18/07/2014 14:01:29
Showing 2 changed files
... ...
@@ -152,6 +152,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
152 152
 					_sr_events_list.stun_in = f;
153 153
 				else return -1;
154 154
 			break;
155
+		case SREV_RCV_NOSIP:
156
+				if(_sr_events_list.rcv_nosip==0)
157
+					_sr_events_list.rcv_nosip = f;
158
+				else return -1;
159
+			break;
155 160
 		default:
156 161
 			return -1;
157 162
 	}
... ...
@@ -255,6 +260,12 @@ int sr_event_exec(int type, void *data)
255 255
 					ret = _sr_events_list.stun_in(data);
256 256
 					return ret;
257 257
 				} else return 1;
258
+		case SREV_RCV_NOSIP:
259
+				if(unlikely(_sr_events_list.rcv_nosip!=0))
260
+				{
261
+					ret = _sr_events_list.rcv_nosip(data);
262
+					return ret;
263
+				} else return 1;
258 264
 		default:
259 265
 			return -1;
260 266
 	}
... ...
@@ -288,6 +299,8 @@ int sr_event_enabled(int type)
288 288
 				return (_sr_events_list.tcp_ws_frame_out!=0)?1:0;
289 289
 		case SREV_STUN_IN:
290 290
 				return (_sr_events_list.stun_in!=0)?1:0;
291
+		case SREV_RCV_NOSIP:
292
+				return (_sr_events_list.rcv_nosip!=0)?1:0;
291 293
 	}
292 294
 	return 0;
293 295
 }
... ...
@@ -28,7 +28,7 @@
28 28
 #define SREV_CORE_STATS			3
29 29
 #define SREV_CFG_RUN_ACTION		4
30 30
 #define SREV_PKG_UPDATE_STATS	5
31
-/*		6 - not used anymore */
31
+#define SREV_RCV_NOSIP			6
32 32
 #define SREV_NET_DGRAM_IN		7
33 33
 #define SREV_TCP_HTTP_100C		8
34 34
 #define SREV_TCP_MSRP_FRAME		9
... ...
@@ -51,6 +51,7 @@ typedef struct sr_event_cb {
51 51
 	sr_event_cb_f tcp_ws_frame_in;
52 52
 	sr_event_cb_f tcp_ws_frame_out;
53 53
 	sr_event_cb_f stun_in;
54
+	sr_event_cb_f rcv_nosip;
54 55
 } sr_event_cb_t;
55 56
 
56 57
 void sr_event_cb_init(void);