diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-05-29 13:04:03 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-05-29 13:04:03 +0000 |
commit | 08640cc9411ca092e6456304bcce41f81b3bd3ce (patch) | |
tree | 6d1ad4e6304b1fb8d95b00858648cfbcd829a2ea /pjnath/include | |
parent | ad8907b8ea9f5715c05b19b41ea7b85509591153 (diff) |
Integration of Sipit24 branch, many tickets involved:
- #793: AMR encoder should regard 'mode-set' param specified by remote decoder.
- #831: Automatically switch to TCP transport when sending large request
- #832: Support for outbound proxy setting without using Route header
- #849: Modify conference audio switch behavior in connecting ports.
- #850: Remove 'Require=replaces' param in 'Refer-To' header (in call transfer with replaces).
- #851: Support for regular nomination in ICE
- #852: --ip-addr support for IPv6 for media transport in pjsua
- #854: Adding SOFTWARE attribute in all outgoing requests may cause compatibility problem with older STUN server (thanks Alexei Kuznetsov for the report)
- #855: Bug in digit map frequencies for DTMF digits (thanks FCCH for the report)
- #856: Put back the ICE candidate priority values according to the default values in the draft-mmusic-ice
- #857: Support for ICE keep-alive with Binding indication
- #858: Do not authenticate STUN 438 response
- #859: AMR-WB format param in the SDP is not negotiated correctly.
- #867: Return error instead of asserting when PJSUA-LIB fails to open log file
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2724 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath/include')
-rw-r--r-- | pjnath/include/pjnath/config.h | 75 | ||||
-rw-r--r-- | pjnath/include/pjnath/errno.h | 7 | ||||
-rw-r--r-- | pjnath/include/pjnath/ice_session.h | 90 | ||||
-rw-r--r-- | pjnath/include/pjnath/ice_strans.h | 41 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_msg.h | 4 | ||||
-rw-r--r-- | pjnath/include/pjnath/stun_session.h | 12 |
6 files changed, 209 insertions, 20 deletions
diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h index f9552721..f265e2c7 100644 --- a/pjnath/include/pjnath/config.h +++ b/pjnath/include/pjnath/config.h @@ -259,12 +259,23 @@ */ #define PJ_ICE_MAX_COMP (2<<PJ_ICE_COMP_BITS) +/** + * Use the priority value according to the ice-draft. + */ +#ifndef PJNATH_ICE_PRIO_STD +# define PJNATH_ICE_PRIO_STD 1 +#endif + /** * The number of bits to represent candidate type preference. */ #ifndef PJ_ICE_CAND_TYPE_PREF_BITS -# define PJ_ICE_CAND_TYPE_PREF_BITS 2 +# if PJNATH_ICE_PRIO_STD +# define PJ_ICE_CAND_TYPE_PREF_BITS 8 +# else +# define PJ_ICE_CAND_TYPE_PREF_BITS 2 +# endif #endif @@ -324,32 +335,74 @@ /** + * For a controlled agent, specify how long it wants to wait (in milliseconds) + * for the controlling agent to complete sending connectivity check with + * nominated flag set to true for all components after the controlled agent + * has found that all connectivity checks in its checklist have been completed + * and there is at least one successful (but not nominated) check for every + * component. + * + * When selecting the value, bear in mind that the connectivity check from + * controlling agent may be delayed because of delay in receiving SDP answer + * from the controlled agent. + * + * Application may set this value to -1 to disable this timer. + * + * Default: 10000 (milliseconds) + */ +#ifndef ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT +# define ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT 10000 +#endif + + +/** + * For controlling agent if it uses regular nomination, specify the delay to + * perform nominated check (connectivity check with USE-CANDIDATE attribute) + * after all components have a valid pair. + * + * Default: 4*PJ_STUN_RTO_VALUE (milliseconds) + */ +#ifndef PJ_ICE_NOMINATED_CHECK_DELAY +# define PJ_ICE_NOMINATED_CHECK_DELAY (4*PJ_STUN_RTO_VALUE) +#endif + + +/** * Minimum interval value to be used for sending STUN keep-alive on the ICE - * stream transport, in seconds. This minimum interval, plus a random value - * which maximum is PJ_ICE_ST_KEEP_ALIVE_MAX_RAND, specify the actual interval + * session, in seconds. This minimum interval, plus a random value + * which maximum is PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND, specify the actual interval * of the STUN keep-alive. * - * Default: 20 seconds + * Default: 15 seconds * - * @see PJ_ICE_ST_KEEP_ALIVE_MAX_RAND + * @see PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND */ -#ifndef PJ_ICE_ST_KEEP_ALIVE_MIN -# define PJ_ICE_ST_KEEP_ALIVE_MIN 20 +#ifndef PJ_ICE_SESS_KEEP_ALIVE_MIN +# define PJ_ICE_SESS_KEEP_ALIVE_MIN 20 #endif +/* Warn about deprecated macro */ +#ifdef PJ_ICE_ST_KEEP_ALIVE_MIN +# error PJ_ICE_ST_KEEP_ALIVE_MIN is deprecated +#endif /** * To prevent STUN keep-alives to be sent simultaneously, application should - * add random interval to minimum interval (PJ_ICE_ST_KEEP_ALIVE_MIN). This + * add random interval to minimum interval (PJ_ICE_SESS_KEEP_ALIVE_MIN). This * setting specifies the maximum random value to be added to the minimum * interval, in seconds. * * Default: 5 seconds * - * @see PJ_ICE_ST_KEEP_ALIVE_MIN + * @see PJ_ICE_SESS_KEEP_ALIVE_MIN */ -#ifndef PJ_ICE_ST_KEEP_ALIVE_MAX_RAND -# define PJ_ICE_ST_KEEP_ALIVE_MAX_RAND 5 +#ifndef PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND +# define PJ_ICE_SESS_KEEP_ALIVE_MAX_RAND 5 +#endif + +/* Warn about deprecated macro */ +#ifdef PJ_ICE_ST_KEEP_ALIVE_MAX_RAND +# error PJ_ICE_ST_KEEP_ALIVE_MAX_RAND is deprecated #endif diff --git a/pjnath/include/pjnath/errno.h b/pjnath/include/pjnath/errno.h index e17f9460..2bc47dc1 100644 --- a/pjnath/include/pjnath/errno.h +++ b/pjnath/include/pjnath/errno.h @@ -196,7 +196,12 @@ * host candidate. */ #define PJNATH_EICENOHOSTCAND (PJNATH_ERRNO_START+92) /* 370092 */ - +/** + * @hideinitializer + * Controlled agent timed-out in waiting for the controlling agent to + * send nominated check after all connectivity checks have completed. + */ +#define PJNATH_EICENOMTIMEOUT (PJNATH_ERRNO_START+93) /* 370093 */ /************************************************************ * TURN ERROR CODES diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h index 18f7ffd6..e606f075 100644 --- a/pjnath/include/pjnath/ice_session.h +++ b/pjnath/include/pjnath/ice_session.h @@ -176,13 +176,20 @@ typedef struct pj_ice_sess_check pj_ice_sess_check; typedef struct pj_ice_sess_comp { /** - * The pointer to ICE check which was nominated for this component. - * The value will be NULL if a nominated check has not been found - * for this component. + * Pointer to ICE check with highest priority which connectivity check + * has been successful. The value will be NULL if a no successful check + * has not been found for this component. */ pj_ice_sess_check *valid_check; /** + * Pointer to ICE check with highest priority which connectivity check + * has been successful and it has been nominated. The value may be NULL + * if there is no such check yet. + */ + pj_ice_sess_check *nominated_check; + + /** * The STUN session to be used to send and receive STUN messages for this * component. */ @@ -553,6 +560,44 @@ typedef struct pj_ice_rx_check /** + * This structure describes various ICE session options. Application + * configure the ICE session with these options by calling + * #pj_ice_sess_set_options(). + */ +typedef struct pj_ice_sess_options +{ + /** + * Specify whether to use aggressive nomination. + */ + pj_bool_t aggressive; + + /** + * For controlling agent if it uses regular nomination, specify the delay + * to perform nominated check (connectivity check with USE-CANDIDATE + * attribute) after all components have a valid pair. + * + * Default value is PJ_ICE_NOMINATED_CHECK_DELAY. + */ + unsigned nominated_check_delay; + + /** + * For a controlled agent, specify how long it wants to wait (in + * milliseconds) for the controlling agent to complete sending + * connectivity check with nominated flag set to true for all components + * after the controlled agent has found that all connectivity checks in + * its checklist have been completed and there is at least one successful + * (but not nominated) check for every component. + * + * Default value for this option is + * ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT. Specify -1 to disable + * this timer. + */ + int controlled_agent_want_nom_timeout; + +} pj_ice_sess_options; + + +/** * This structure describes the ICE session. For this version of PJNATH, * an ICE session corresponds to a single media stream (unlike the ICE * session described in the ICE standard where an ICE session covers the @@ -569,11 +614,13 @@ struct pj_ice_sess void *user_data; /**< App. data. */ pj_mutex_t *mutex; /**< Mutex. */ pj_ice_sess_role role; /**< ICE role. */ + pj_ice_sess_options opt; /**< Options */ pj_timestamp tie_breaker; /**< Tie breaker value */ pj_uint8_t *prefs; /**< Type preference. */ + pj_bool_t is_nominating; /**< Nominating stage */ pj_bool_t is_complete; /**< Complete? */ pj_status_t ice_status; /**< Error status. */ - pj_timer_entry completion_timer; /**< To call callback. */ + pj_timer_entry timer; /**< ICE timer. */ pj_ice_sess_cb cb; /**< Callback. */ pj_stun_config stun_cfg; /**< STUN settings. */ @@ -589,6 +636,7 @@ struct pj_ice_sess /* Components */ unsigned comp_cnt; /**< # of components. */ pj_ice_sess_comp comp[PJ_ICE_MAX_COMP]; /**< Component array */ + unsigned comp_ka; /**< Next comp for KA */ /* Local candidates */ unsigned lcand_cnt; /**< # of local cand. */ @@ -654,6 +702,12 @@ PJ_DECL(void) pj_ice_calc_foundation(pj_pool_t *pool, pj_ice_cand_type type, const pj_sockaddr *base_addr); +/** + * Initialize ICE session options with library default values. + * + * @param opt ICE session options. + */ +PJ_DECL(void) pj_ice_sess_options_default(pj_ice_sess_options *opt); /** * Create ICE session with the specified role and number of components. @@ -689,6 +743,34 @@ PJ_DECL(pj_status_t) pj_ice_sess_create(pj_stun_config *stun_cfg, pj_ice_sess **p_ice); /** + * Get the value of various options of the ICE session. + * + * @param ice The ICE session. + * @param opt The options to be initialized with the values + * from the ICE session. + * + * @return PJ_SUCCESS on success, or the appropriate error. + */ +PJ_DECL(pj_status_t) pj_ice_sess_get_options(pj_ice_sess *ice, + pj_ice_sess_options *opt); + +/** + * Specify various options for this ICE session. Application MUST only + * call this function after the ICE session has been created but before + * any connectivity check is started. + * + * Application should call #pj_ice_sess_get_options() to initialize the + * options with their default values. + * + * @param ice The ICE session. + * @param opt Options to be applied to the ICE session. + * + * @return PJ_SUCCESS on success, or the appropriate error. + */ +PJ_DECL(pj_status_t) pj_ice_sess_set_options(pj_ice_sess *ice, + const pj_ice_sess_options *opt); + +/** * Destroy ICE session. This will cancel any connectivity checks currently * running, if any, and any other events scheduled by this session, as well * as all memory resources. diff --git a/pjnath/include/pjnath/ice_strans.h b/pjnath/include/pjnath/ice_strans.h index 02397073..28487870 100644 --- a/pjnath/include/pjnath/ice_strans.h +++ b/pjnath/include/pjnath/ice_strans.h @@ -197,6 +197,13 @@ typedef struct pj_ice_strans_cfg pj_dns_resolver *resolver; /** + * This contains various STUN session options. Once the ICE stream + * transport is created, application may also change the options + * with #pj_ice_strans_set_options(). + */ + pj_ice_sess_options opt; + + /** * STUN and local transport settings. This specifies the * settings for local UDP socket, which will be resolved * to get the STUN mapped address. @@ -209,12 +216,12 @@ typedef struct pj_ice_strans_cfg pj_stun_sock_cfg cfg; /** - * Disable host candidates. When this option is set, no - * host candidates will be added. + * Maximum number of host candidates to be added. If the + * value is zero, no host candidates will be added. * - * Default: PJ_FALSE + * Default: 64 */ - pj_bool_t no_host_cands; + unsigned max_host_cands; /** * Include loopback addresses in the host candidates. @@ -386,6 +393,32 @@ PJ_DECL(void*) pj_ice_strans_get_user_data(pj_ice_strans *ice_st); /** + * Get the value of various options of the ICE stream transport. + * + * @param ice_st The ICE stream transport. + * @param opt The options to be initialized with the values + * from the ICE stream transport. + * + * @return PJ_SUCCESS on success, or the appropriate error. + */ +PJ_DECL(pj_status_t) pj_ice_strans_get_options(pj_ice_strans *ice_st, + pj_ice_sess_options *opt); + +/** + * Specify various options for this ICE stream transport. Application + * should call #pj_ice_strans_get_options() to initialize the options + * with their default values. + * + * @param ice_st The ICE stream transport. + * @param opt Options to be applied to this ICE stream transport. + * + * @return PJ_SUCCESS on success, or the appropriate error. + */ +PJ_DECL(pj_status_t) pj_ice_strans_set_options(pj_ice_strans *ice_st, + const pj_ice_sess_options *opt); + + +/** * Initialize the ICE session in the ICE stream transport. * When application is about to send an offer containing ICE capability, * or when it receives an offer containing ICE capability, it must diff --git a/pjnath/include/pjnath/stun_msg.h b/pjnath/include/pjnath/stun_msg.h index 57fc38c4..5339f1b2 100644 --- a/pjnath/include/pjnath/stun_msg.h +++ b/pjnath/include/pjnath/stun_msg.h @@ -197,6 +197,10 @@ typedef enum pj_stun_msg_type */ PJ_STUN_BINDING_ERROR_RESPONSE = 0x0111, + /** + * Binding Indication (ICE) + */ + PJ_STUN_BINDING_INDICATION = 0x0011, /** * STUN SHARED-SECRET reqeust. diff --git a/pjnath/include/pjnath/stun_session.h b/pjnath/include/pjnath/stun_session.h index 2a6fd022..686a09a1 100644 --- a/pjnath/include/pjnath/stun_session.h +++ b/pjnath/include/pjnath/stun_session.h @@ -485,6 +485,18 @@ PJ_DECL(pj_status_t) pj_stun_session_set_credential(pj_stun_session *sess, */ PJ_DECL(void) pj_stun_session_set_log(pj_stun_session *sess, unsigned flags); +/** + * Configure whether the STUN session should utilize FINGERPRINT in + * outgoing messages. + * + * @param sess The STUN session instance. + * @param use Boolean for the setting. + * + * @return The previous configured value of FINGERPRINT + * utilization of the sessoin. + */ +PJ_DECL(pj_bool_t) pj_stun_session_use_fingerprint(pj_stun_session *sess, + pj_bool_t use); /** * Create a STUN request message. After the message has been successfully |