summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2014-04-15 08:46:18 +0000
committerBenny Prijono <bennylp@teluu.com>2014-04-15 08:46:18 +0000
commit77503f8a6dfc9a1b9f0fe0b028c6bb3fd575693a (patch)
tree0aae3a7603a01c2572ac366b3904f21e2d0c384b
parentd92ae21ccb7898aceeec8f5e01925ebea6a2e903 (diff)
Closed #1760: added pjsip_tcp_transport_get_socket() API to get the raw socket handle from SIP TCP transport
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4817 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsip/sip_transport_tcp.h12
-rw-r--r--pjsip/src/pjsip/sip_transport_tcp.c9
2 files changed, 21 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_transport_tcp.h b/pjsip/include/pjsip/sip_transport_tcp.h
index 7e7bc139..28169fcc 100644
--- a/pjsip/include/pjsip/sip_transport_tcp.h
+++ b/pjsip/include/pjsip/sip_transport_tcp.h
@@ -204,6 +204,18 @@ PJ_DECL(pj_status_t) pjsip_tcp_transport_start3(
pjsip_tpfactory **p_factory
);
+/**
+ * Retrieve the internal socket handle used by the TCP transport. Note
+ * that this socket normally is registered to ioqueue, so application
+ * needs to take care not to perform operation that disrupts ioqueue
+ * operation.
+ *
+ * @param transport The TCP transport.
+ *
+ * @return The socket handle, or PJ_INVALID_SOCKET if no socket
+ * is currently being used.
+ */
+PJ_DECL(pj_sock_t) pjsip_tcp_transport_get_socket(pjsip_transport *transport);
PJ_END_DECL
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 7a9f093e..6a0eaffb 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -1478,5 +1478,14 @@ static void tcp_keep_alive_timer(pj_timer_heap_t *th, pj_timer_entry *e)
}
+PJ_DEF(pj_sock_t) pjsip_tcp_transport_get_socket(pjsip_transport *transport)
+{
+ struct tcp_transport *tcp = (struct tcp_transport*)transport;
+
+ PJ_ASSERT_RETURN(transport, PJ_INVALID_SOCKET);
+ return tcp->sock;
+}
+
+
#endif /* PJ_HAS_TCP */