diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-10-25 09:02:07 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-10-25 09:02:07 +0000 |
commit | fdc0f2ecdb18b9176f87f55ee17f054ce107e8c7 (patch) | |
tree | 768b9507e60426fcabcc8b4ce2540ae727cf7ffa /pjnath/include | |
parent | 2053af19e76b9c13e8bdebb13669cf915dc49981 (diff) |
Initial commit for ticket #950: QoS support:
- implementation:
- PJLIB (sock_qos*.*)
- added QoS support in:
- SIP UDP transport,
- SIP TCP transport,
- media UDP transport (done in pjsua-lib),
- pjnath ICE stream transport,
- pjnath STUN socket,
- pjnath TURN client
- added QoS options in pjsua-lib:
- QoS fields in pjsua_transport_config
- added "--set-qos" parameter in pjsua
Notes:
- QoS in TLS transport is not yet implemented, waiting for #957
- build ok on VS6, VS2005 (multiple targets), Carbide, and Mingw
- no run-time testing yet
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2966 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/include')
-rw-r--r-- | pjnath/include/pjnath/config.h | 4 | ||||
-rw-r--r-- | pjnath/include/pjnath/ice_strans.h | 35 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_sock.h | 27 | ||||
-rw-r--r-- | pjnath/include/pjnath/turn_sock.h | 49 |
4 files changed, 111 insertions, 4 deletions
diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h index f265e2c7..196f2d53 100644 --- a/pjnath/include/pjnath/config.h +++ b/pjnath/include/pjnath/config.h @@ -250,14 +250,14 @@ * the maximum number of components (PJ_ICE_MAX_COMP) value. */ #ifndef PJ_ICE_COMP_BITS -# define PJ_ICE_COMP_BITS 3 +# define PJ_ICE_COMP_BITS 1 #endif /** * Maximum number of ICE components. */ -#define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS) +#define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS) /** * Use the priority value according to the ice-draft. diff --git a/pjnath/include/pjnath/ice_strans.h b/pjnath/include/pjnath/ice_strans.h index c021dde7..43a837da 100644 --- a/pjnath/include/pjnath/ice_strans.h +++ b/pjnath/include/pjnath/ice_strans.h @@ -271,6 +271,13 @@ typedef struct pj_ice_strans_cfg */ struct { /** + * Optional TURN socket settings. The default values will be + * initialized by #pj_turn_sock_cfg_default(). This contains + * settings such as QoS. + */ + pj_turn_sock_cfg cfg; + + /** * Specify the TURN server domain or hostname or IP address. * If DNS SRV resolution is required, application must fill * in this setting with the domain name of the TURN server @@ -324,6 +331,34 @@ typedef struct pj_ice_strans_cfg } turn; + /** + * Component specific settings, which will override the settings in + * the STUN and TURN settings above. For example, setting the QoS + * parameters here allows the application to have different QoS + * traffic type for RTP and RTCP component. + */ + struct { + /** + * QoS traffic type to be set on this transport. When application + * wants to apply QoS tagging to the transport, it's preferable to + * set this field rather than \a qos_param fields since this is + * more portable. + * + * Default value is PJ_QOS_TYPE_BEST_EFFORT. + */ + pj_qos_type qos_type; + + /** + * Set the low level QoS parameters to the transport. This is a + * lower level operation than setting the \a qos_type field and + * may not be supported on all platforms. + * + * By default all settings in this structure are disabled. + */ + pj_qos_params qos_params; + + } comp[PJ_ICE_MAX_COMP]; + } pj_ice_strans_cfg; diff --git a/pjnath/include/pjnath/stun_sock.h b/pjnath/include/pjnath/stun_sock.h index b196b325..95625c93 100644 --- a/pjnath/include/pjnath/stun_sock.h +++ b/pjnath/include/pjnath/stun_sock.h @@ -28,6 +28,7 @@ #include <pjlib-util/resolver.h> #include <pj/ioqueue.h> #include <pj/sock.h> +#include <pj/sock_qos.h> PJ_BEGIN_DECL @@ -247,6 +248,32 @@ typedef struct pj_stun_sock_cfg */ int ka_interval; + /** + * QoS traffic type to be set on this transport. When application wants + * to apply QoS tagging to the transport, it's preferable to set this + * field rather than \a qos_param fields since this is more portable. + * + * Default value is PJ_QOS_TYPE_BEST_EFFORT. + */ + pj_qos_type qos_type; + + /** + * Set the low level QoS parameters to the transport. This is a lower + * level operation than setting the \a qos_type field and may not be + * supported on all platforms. + * + * By default all settings in this structure are disabled. + */ + pj_qos_params qos_params; + + /** + * Specify if STUN socket should ignore any errors when setting the QoS + * traffic type/parameters. + * + * Default: PJ_TRUE + */ + pj_bool_t qos_ignore_error; + } pj_stun_sock_cfg; diff --git a/pjnath/include/pjnath/turn_sock.h b/pjnath/include/pjnath/turn_sock.h index f6776b83..fe034612 100644 --- a/pjnath/include/pjnath/turn_sock.h +++ b/pjnath/include/pjnath/turn_sock.h @@ -25,6 +25,7 @@ * @brief TURN relay using UDP client as transport protocol */ #include <pjnath/turn_session.h> +#include <pj/sock_qos.h> PJ_BEGIN_DECL @@ -101,6 +102,48 @@ typedef struct pj_turn_sock_cb /** + * This structure describes options that can be specified when creating + * the TURN socket. Application should call #pj_turn_sock_cfg_default() + * to initialize this structure with its default values before using it. + */ +typedef struct pj_turn_sock_cfg +{ + /** + * QoS traffic type to be set on this transport. When application wants + * to apply QoS tagging to the transport, it's preferable to set this + * field rather than \a qos_param fields since this is more portable. + * + * Default value is PJ_QOS_TYPE_BEST_EFFORT. + */ + pj_qos_type qos_type; + + /** + * Set the low level QoS parameters to the transport. This is a lower + * level operation than setting the \a qos_type field and may not be + * supported on all platforms. + * + * By default all settings in this structure are not set. + */ + pj_qos_params qos_params; + + /** + * Specify if STUN socket should ignore any errors when setting the QoS + * traffic type/parameters. + * + * Default: PJ_TRUE + */ + pj_bool_t qos_ignore_error; + +} pj_turn_sock_cfg; + + +/** + * Initialize pj_turn_sock_cfg structure with default values. + */ +PJ_DECL(void) pj_turn_sock_cfg_default(pj_turn_sock_cfg *cfg); + + +/** * Create a TURN transport instance with the specified address family and * connection type. Once TURN transport instance is created, application * must call pj_turn_sock_alloc() to allocate a relay address in the TURN @@ -114,7 +157,9 @@ typedef struct pj_turn_sock_cb * @param conn_type Connection type to the TURN server. Both TCP and * UDP are supported. * @param cb Callback to receive events from the TURN transport. - * @param options Option flags, currently this value must be zero. + * @param setting Optional settings to be specified to the transport. + * If this parameter is NULL, default values will be + * used. * @param user_data Arbitrary application data to be associated with * this transport. * @param p_turn_sock Pointer to receive the created instance of the @@ -127,7 +172,7 @@ PJ_DECL(pj_status_t) pj_turn_sock_create(pj_stun_config *cfg, int af, pj_turn_tp_type conn_type, const pj_turn_sock_cb *cb, - unsigned options, + const pj_turn_sock_cfg *setting, void *user_data, pj_turn_sock **p_turn_sock); |