diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-12-01 08:59:25 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-12-01 08:59:25 +0000 |
commit | 223903c913565d00e54b55f9685a174f1f31ed49 (patch) | |
tree | c87466c8a333649fb6ca436199bd6f4f217d527c /pjsip/include | |
parent | 2e6a62f43b622320d69971cfc07a68ab59e29f1b (diff) |
Ticket #421: initial IPv6 support: UDP transport
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1602 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r-- | pjsip/include/pjsip/sip_transport.h | 22 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_transport_udp.h | 35 | ||||
-rw-r--r-- | pjsip/include/pjsip/sip_types.h | 11 |
3 files changed, 64 insertions, 4 deletions
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h index 9f1ff044..6097abab 100644 --- a/pjsip/include/pjsip/sip_transport.h +++ b/pjsip/include/pjsip/sip_transport.h @@ -133,6 +133,15 @@ PJ_DECL(pjsip_transport_type_e) pjsip_transport_get_type_from_flag(unsigned flag); /** + * Get the socket address family of a given transport type. + * + * @param type Transport type. + * + * @return Transport type. + */ +PJ_DECL(int) pjsip_transport_type_get_af(pjsip_transport_type_e type); + +/** * Get transport flag from type. * * @param type Transport type. @@ -162,6 +171,15 @@ pjsip_transport_get_default_port_for_type(pjsip_transport_type_e type); */ PJ_DECL(const char*) pjsip_transport_get_type_name(pjsip_transport_type_e t); +/** + * Get longer description for the specified transport type. + * + * @param t Transport type. + * + * @return Transport description. + */ +PJ_DECL(const char*) pjsip_transport_get_type_desc(pjsip_transport_type_e t); + /***************************************************************************** @@ -307,7 +325,7 @@ struct pjsip_rx_data int src_addr_len; /** The IP source address string (NULL terminated). */ - char src_name[16]; + char src_name[PJ_INET6_ADDRSTRLEN]; /** The IP source port number. */ int src_port; @@ -506,7 +524,7 @@ struct pjsip_tx_data pjsip_transport *transport; /**< Transport being used. */ pj_sockaddr dst_addr; /**< Destination address. */ int dst_addr_len; /**< Length of address. */ - char dst_name[16]; /**< Destination address. */ + char dst_name[PJ_INET6_ADDRSTRLEN]; /**< Destination address. */ int dst_port; /**< Destination port. */ } tp_info; diff --git a/pjsip/include/pjsip/sip_transport_udp.h b/pjsip/include/pjsip/sip_transport_udp.h index 5fdf9dcf..74bb5ff3 100644 --- a/pjsip/include/pjsip/sip_transport_udp.h +++ b/pjsip/include/pjsip/sip_transport_udp.h @@ -82,7 +82,17 @@ PJ_DECL(pj_status_t) pjsip_udp_transport_start(pjsip_endpoint *endpt, pjsip_transport **p_transport); /** - * Attach UDP socket as a new transport and start the transport. + * Start IPv6 UDP transport. + */ +PJ_DECL(pj_status_t) pjsip_udp_transport_start6(pjsip_endpoint *endpt, + const pj_sockaddr_in6 *local, + const pjsip_host_port *a_name, + unsigned async_cnt, + pjsip_transport **p_transport); + + +/** + * Attach IPv4 UDP socket as a new transport and start the transport. * * @param endpt The SIP endpoint. * @param sock UDP socket to use. @@ -103,6 +113,29 @@ PJ_DECL(pj_status_t) pjsip_udp_transport_attach(pjsip_endpoint *endpt, /** + * Attach IPv4 or IPv6 UDP socket as a new transport and start the transport. + * + * @param endpt The SIP endpoint. + * @param type Transport type, which is PJSIP_TRANSPORT_UDP for IPv4 + * or PJSIP_TRANSPORT_UDP6 for IPv6 socket. + * @param sock UDP socket to use. + * @param a_name Published address (only the host and port portion is + * used). + * @param async_cnt Number of simultaneous async operations. + * @param p_transport Pointer to receive the transport. + * + * @return PJ_SUCCESS when the transport has been successfully + * started and registered to transport manager, or + * the appropriate error code. + */ +PJ_DECL(pj_status_t) pjsip_udp_transport_attach2(pjsip_endpoint *endpt, + pjsip_transport_type_e type, + pj_sock_t sock, + const pjsip_host_port *a_name, + unsigned async_cnt, + pjsip_transport **p_transport); + +/** * Retrieve the internal socket handle used by the UDP transport. Note * that this socket normally is registered to ioqueue, so if application * wants to make use of this socket, it should temporarily pause the diff --git a/pjsip/include/pjsip/sip_types.h b/pjsip/include/pjsip/sip_types.h index d248b358..404dc8d4 100644 --- a/pjsip/include/pjsip/sip_types.h +++ b/pjsip/include/pjsip/sip_types.h @@ -82,7 +82,16 @@ typedef enum pjsip_transport_type_e PJSIP_TRANSPORT_LOOP_DGRAM, /** Start of user defined transport */ - PJSIP_TRANSPORT_START_OTHER + PJSIP_TRANSPORT_START_OTHER, + + /** Start of IPv6 transports */ + PJSIP_TRANSPORT_IPV6 = 128, + + /** UDP over IPv6 */ + PJSIP_TRANSPORT_UDP6 = PJSIP_TRANSPORT_UDP + PJSIP_TRANSPORT_IPV6, + + /** TCP over IPv6 */ + PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6 } pjsip_transport_type_e; |