[sr-dev] git:master:1f00d722: core: new event SREV_NET_DATA_SEND

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 11 12:43:29 CET 2016


Module: kamailio
Branch: master
Commit: 1f00d722aaefbd2515ae69ffdcf541143862d9fd
URL: https://github.com/kamailio/kamailio/commit/1f00d722aaefbd2515ae69ffdcf541143862d9fd

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-11T12:39:59+01:00

core: new event SREV_NET_DATA_SEND

- to be executed if message was sent to the network

---

Modified: events.c
Modified: events.h

---

Diff:  https://github.com/kamailio/kamailio/commit/1f00d722aaefbd2515ae69ffdcf541143862d9fd.diff
Patch: https://github.com/kamailio/kamailio/commit/1f00d722aaefbd2515ae69ffdcf541143862d9fd.patch

---

diff --git a/events.c b/events.c
index bb1373a..b140b61 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_SEND:
+				if(_sr_events_list.net_data_send==0)
+					_sr_events_list.net_data_send = f;
+				else return -1;
+			break;
 		default:
 			return -1;
 	}
@@ -295,6 +300,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_SEND:
+				if(unlikely(_sr_events_list.net_data_send!=0))
+				{
+					ret = _sr_events_list.net_data_send(data);
+					return ret;
+				} else return 1;
 		default:
 			return -1;
 	}
@@ -332,6 +343,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_SEND:
+				return (_sr_events_list.net_data_send!=0)?1:0;
 	}
 	return 0;
 }
diff --git a/events.h b/events.h
index 2946d94..86ab784 100644
--- a/events.h
+++ b/events.h
@@ -35,6 +35,7 @@
 #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_CB_LIST_SIZE	3
 
@@ -54,6 +55,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_send;
 } sr_event_cb_t;
 
 void sr_event_cb_init(void);




More information about the sr-dev mailing list