|
@@ -50,6 +50,8 @@ static int w_tcp_keepalive_disable1(sip_msg_t* msg, char* con);
|
|
|
static int w_tcp_keepalive_disable0(sip_msg_t* msg);
|
|
|
static int w_tcpops_set_connection_lifetime2(sip_msg_t* msg, char* con, char* time);
|
|
|
static int w_tcpops_set_connection_lifetime1(sip_msg_t* msg, char* time);
|
|
|
+static int w_tcpops_enable_closed_event1(sip_msg_t* msg, char* con, char* foo);
|
|
|
+static int w_tcpops_enable_closed_event0(sip_msg_t* msg, char* foo);
|
|
|
static int w_tcp_conid_state(sip_msg_t* msg, char* con, char *p2);
|
|
|
static int w_tcp_conid_alive(sip_msg_t* msg, char* con, char *p2);
|
|
|
|
|
@@ -69,6 +71,10 @@ static cmd_export_t cmds[]={
|
|
|
0, ANY_ROUTE},
|
|
|
{"tcp_set_connection_lifetime", (cmd_function)w_tcpops_set_connection_lifetime1, 1, fixup_numpv,
|
|
|
0, REQUEST_ROUTE|ONREPLY_ROUTE},
|
|
|
+ {"tcp_enable_closed_event", (cmd_function)w_tcpops_enable_closed_event1, 1, fixup_numpv,
|
|
|
+ 0, ANY_ROUTE},
|
|
|
+ {"tcp_enable_closed_event", (cmd_function)w_tcpops_enable_closed_event0, 0, 0,
|
|
|
+ 0, REQUEST_ROUTE|ONREPLY_ROUTE},
|
|
|
{"tcp_conid_state", (cmd_function)w_tcp_conid_state, 1, fixup_numpv,
|
|
|
0, ANY_ROUTE},
|
|
|
{"tcp_conid_alive", (cmd_function)w_tcp_conid_alive, 1, fixup_numpv,
|
|
@@ -76,13 +82,18 @@ static cmd_export_t cmds[]={
|
|
|
{0, 0, 0, 0, 0, 0}
|
|
|
};
|
|
|
|
|
|
+static param_export_t params[] = {
|
|
|
+ {"closed_event", PARAM_INT, &tcp_closed_event},
|
|
|
+ {0, 0, 0}
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
|
|
|
struct module_exports exports = {
|
|
|
"tcpops",
|
|
|
DEFAULT_DLFLAGS, /* dlopen flags */
|
|
|
cmds, /* exported functions to config */
|
|
|
- 0, /* exported parameters to config */
|
|
|
+ params, /* exported parameters to config */
|
|
|
0, /* exported statistics */
|
|
|
0, /* exported MI functions */
|
|
|
0, /* exported pseudo-variables */
|
|
@@ -334,6 +345,42 @@ static int w_tcpops_set_connection_lifetime1(sip_msg_t* msg, char* time)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static int w_tcpops_enable_closed_event1(sip_msg_t* msg, char* conid, char* foo)
|
|
|
+{
|
|
|
+ struct tcp_connection *s_con;
|
|
|
+
|
|
|
+ _IVALUE (conid)
|
|
|
+
|
|
|
+ if (unlikely((s_con = tcpconn_get(i_conid, 0, 0, 0, 0)) == NULL)) {
|
|
|
+ LM_ERR("invalid connection id %d, (must be a TCP conid)\n", i_conid);
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ s_con->flags |= F_CONN_CLOSE_EV;
|
|
|
+ tcpconn_put(s_con);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static int w_tcpops_enable_closed_event0(sip_msg_t* msg, char* foo)
|
|
|
+{
|
|
|
+ struct tcp_connection *s_con;
|
|
|
+
|
|
|
+ if(unlikely(msg->rcv.proto != PROTO_TCP && msg->rcv.proto != PROTO_TLS && msg->rcv.proto != PROTO_WS && msg->rcv.proto != PROTO_WSS))
|
|
|
+ {
|
|
|
+ LM_ERR("the current message does not come from a TCP connection\n");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (unlikely((s_con = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0, 0)) == NULL)) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ s_con->flags |= F_CONN_CLOSE_EV;
|
|
|
+ tcpconn_put(s_con);
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
*/
|