diff options
Diffstat (limited to 'pjsip/include')
-rw-r--r-- | pjsip/include/pjsip.h | 1 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transport.h | 7 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transport_tcp.h | 33 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 12 |
4 files changed, 46 insertions, 7 deletions
diff --git a/pjsip/include/pjsip.h b/pjsip/include/pjsip.h index b7f2dd95..8da2d64c 100644 --- a/pjsip/include/pjsip.h +++ b/pjsip/include/pjsip.h @@ -39,6 +39,7 @@ #include <pjsip/sip_transport.h> #include <pjsip/sip_transport_udp.h> #include <pjsip/sip_transport_loop.h> +#include <pjsip/sip_transport_tcp.h> #include <pjsip/sip_resolve.h> /* Authentication. */ diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h index e09583db..002061cf 100644 --- a/pjsip/include/pjsip/sip_transport.h +++ b/pjsip/include/pjsip/sip_transport.h @@ -704,7 +704,7 @@ struct pjsip_tpfactory pj_lock_t *lock; /**< Lock object. */ pjsip_transport_type_e type; /**< Transport type. */ - char type_name[8]; /**< Type string name. */ + char *type_name; /**< Type string name. */ unsigned flag; /**< Transport flag. */ pj_sockaddr local_addr; /**< Bound address. */ @@ -722,6 +722,11 @@ struct pjsip_tpfactory int addr_len, pjsip_transport **transport); + /** + * Destroy the listener. + */ + pj_status_t (*destroy)(pjsip_tpfactory *factory); + /* * Application may extend this structure.. */ diff --git a/pjsip/include/pjsip/sip_transport_tcp.h b/pjsip/include/pjsip/sip_transport_tcp.h index 317d7772..4f5664d4 100644 --- a/pjsip/include/pjsip/sip_transport_tcp.h +++ b/pjsip/include/pjsip/sip_transport_tcp.h @@ -38,11 +38,35 @@ PJ_BEGIN_DECL */ /** - * Create, register, and start TCP transport. + * The TCP incoming connection backlog number. + * Default: 5 + */ +#ifndef PJSIP_TCP_TRANSPORT_BACKLOG +# define PJSIP_TCP_TRANSPORT_BACKLOG 5 +#endif + + +/** + * Register support for SIP TCP transport by creating TCP listener on + * the specified address and port. This function will create an + * instance of SIP TCP transport factory and register it to the + * transport manager. * * @param endpt The SIP endpoint. - * @param local Local address to bind. - * @param async_cnt Number of simultaneous async operations. + * @param local Optional local address to bind, or specify the + * address to bind the server socket to. Both IP + * interface address and port fields are optional. + * If IP interface address is not specified, socket + * will be bound to PJ_INADDR_ANY. If port is not + * specified, socket will be bound to any port + * selected by the operating system. + * @param async_cnt Number of simultaneous asynchronous accept() + * operations to be supported. It is recommended that + * the number here corresponds to the number of + * processors in the system (or the number of SIP + * worker threads). + * @param p_factory Optional pointer to receive the instance of the + * SIP TCP transport factory just created. * * @return PJ_SUCCESS when the transport has been successfully * started and registered to transport manager, or @@ -50,7 +74,8 @@ PJ_BEGIN_DECL */ PJ_DECL(pj_status_t) pjsip_tcp_transport_start(pjsip_endpoint *endpt, const pj_sockaddr_in *local, - unsigned async_cnt); + unsigned async_cnt, + pjsip_tpfactory **p_factory); PJ_END_DECL diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 8b061c5b..004a41a0 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -104,8 +104,16 @@ typedef struct pjsua_acc */ typedef struct transport_data { - int index; - pjsip_transport *tp; + int index; + pjsip_transport_type_e type; + pjsip_host_port local_name; + + union { + pjsip_transport *tp; + pjsip_tpfactory *factory; + void *ptr; + } data; + } transport_data; |