Ignore:
Timestamp:
May 10, 2016 5:13:57 AM (8 years ago)
Author:
nanang
Message:

Close #1915: Added API pjsip_udp_transport_start2() that can create both IPv4 and IPv6 SIP UDP transports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_transport_udp.h

    r3553 r5284  
    2727 
    2828#include <pjsip/sip_transport.h> 
     29#include <pj/sock_qos.h> 
    2930 
    3031PJ_BEGIN_DECL 
     
    5859    PJSIP_UDP_TRANSPORT_DESTROY_SOCKET  = 2 
    5960}; 
     61 
     62 
     63/** 
     64 * Settings to be specified when creating the UDP transport. Application  
     65 * should initialize this structure with its default values by calling  
     66 * pjsip_udp_transport_cfg_default(). 
     67 */ 
     68typedef struct pjsip_udp_transport_cfg 
     69{ 
     70    /** 
     71     * Address family to use. Valid values are pj_AF_INET() and 
     72     * pj_AF_INET6(). Default is pj_AF_INET(). 
     73     */ 
     74    int                 af; 
     75 
     76    /** 
     77     * Address to bind the socket to. 
     78     */ 
     79    pj_sockaddr         bind_addr; 
     80 
     81    /** 
     82     * Optional published address, which is the address to be 
     83     * advertised as the address of this SIP transport.  
     84     * By default the bound address will be used as the published address. 
     85     */ 
     86    pjsip_host_port     addr_name; 
     87 
     88    /** 
     89     * Number of simultaneous asynchronous accept() operations to be  
     90     * supported. It is recommended that the number here corresponds to  
     91     * the number of processors in the system (or the number of SIP 
     92     * worker threads). 
     93     * 
     94     * Default: 1 
     95     */ 
     96    unsigned            async_cnt; 
     97 
     98    /** 
     99     * QoS traffic type to be set on this transport. When application wants 
     100     * to apply QoS tagging to the transport, it's preferable to set this 
     101     * field rather than \a qos_param fields since this is more portable. 
     102     * 
     103     * Default is QoS not set. 
     104     */ 
     105    pj_qos_type         qos_type; 
     106 
     107    /** 
     108     * Set the low level QoS parameters to the transport. This is a lower 
     109     * level operation than setting the \a qos_type field and may not be 
     110     * supported on all platforms. 
     111     * 
     112     * Default is QoS not set. 
     113     */ 
     114    pj_qos_params       qos_params; 
     115 
     116    /** 
     117     * Specify options to be set on the transport.  
     118     * 
     119     * By default there is no options. 
     120     *  
     121     */ 
     122    pj_sockopt_params   sockopt_params; 
     123 
     124} pjsip_udp_transport_cfg; 
     125 
     126 
     127/** 
     128 * Initialize pjsip_udp_transport_cfg structure with default values for 
     129 * the specifed address family. 
     130 * 
     131 * @param cfg           The structure to initialize. 
     132 * @param af            Address family to be used. 
     133 */ 
     134PJ_DECL(void) pjsip_udp_transport_cfg_default(pjsip_udp_transport_cfg *cfg, 
     135                                              int af); 
     136 
     137 
     138/** 
     139 * Start UDP IPv4/IPv6 transport. 
     140 * 
     141 * @param endpt         The SIP endpoint. 
     142 * @param cfg           UDP transport settings. Application should initialize 
     143 *                      this setting with #pjsip_udp_transport_cfg_default(). 
     144 * @param p_transport   Pointer to receive the transport. 
     145 * 
     146 * @return              PJ_SUCCESS when the transport has been successfully 
     147 *                      started and registered to transport manager, or 
     148 *                      the appropriate error code. 
     149 */ 
     150PJ_DECL(pj_status_t) pjsip_udp_transport_start2( 
     151                                        pjsip_endpoint *endpt, 
     152                                        const pjsip_udp_transport_cfg *cfg, 
     153                                        pjsip_transport **p_transport); 
    60154 
    61155 
Note: See TracChangeset for help on using the changeset viewer.