[sr-dev] git:master:fa6465f9: core: added event callback field for tcp closed connection
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jan 4 23:12:01 CET 2016
Module: kamailio
Branch: master
Commit: fa6465f92adf372c3307211a05688a2482d89353
URL: https://github.com/kamailio/kamailio/commit/fa6465f92adf372c3307211a05688a2482d89353
Author: Armen Babikyan <armen at firespotter.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-04T23:04:37+01:00
core: added event callback field for tcp closed connection
---
Modified: events.c
Modified: events.h
---
Diff: https://github.com/kamailio/kamailio/commit/fa6465f92adf372c3307211a05688a2482d89353.diff
Patch: https://github.com/kamailio/kamailio/commit/fa6465f92adf372c3307211a05688a2482d89353.patch
---
diff --git a/events.c b/events.c
index 5312e7a..bb1373a 100644
--- a/events.c
+++ b/events.c
@@ -165,6 +165,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
_sr_events_list.rcv_nosip = f;
else return -1;
break;
+ case SREV_TCP_CLOSED:
+ if(_sr_events_list.tcp_closed==0)
+ _sr_events_list.tcp_closed = f;
+ else return -1;
+ break;
default:
return -1;
}
@@ -284,6 +289,12 @@ int sr_event_exec(int type, void *data)
ret = _sr_events_list.rcv_nosip(data);
return ret;
} else return 1;
+ case SREV_TCP_CLOSED:
+ if(unlikely(_sr_events_list.tcp_closed!=0))
+ {
+ ret = _sr_events_list.tcp_closed(data);
+ return ret;
+ } else return 1;
default:
return -1;
}
@@ -319,6 +330,8 @@ int sr_event_enabled(int type)
return (_sr_events_list.stun_in!=0)?1:0;
case SREV_RCV_NOSIP:
return (_sr_events_list.rcv_nosip!=0)?1:0;
+ case SREV_TCP_CLOSED:
+ return (_sr_events_list.tcp_closed!=0)?1:0;
}
return 0;
}
diff --git a/events.h b/events.h
index 8218453..2946d94 100644
--- a/events.h
+++ b/events.h
@@ -34,6 +34,7 @@
#define SREV_TCP_WS_FRAME_IN 10
#define SREV_TCP_WS_FRAME_OUT 11
#define SREV_STUN_IN 12
+#define SREV_TCP_CLOSED 13
#define SREV_CB_LIST_SIZE 3
@@ -52,6 +53,7 @@ typedef struct sr_event_cb {
sr_event_cb_f tcp_ws_frame_out;
sr_event_cb_f stun_in;
sr_event_cb_f rcv_nosip;
+ sr_event_cb_f tcp_closed;
} sr_event_cb_t;
void sr_event_cb_init(void);
More information about the sr-dev
mailing list