diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2013-09-25 04:57:26 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2013-09-25 04:57:26 +0000 |
commit | 68c5969bfbdfefb1b9df97b88fa9cb0c7e94d785 (patch) | |
tree | ef059dcbc568bdc1c116d7b12228f2ebf8703d51 /pjnath | |
parent | d13ad1cce90aa7c3b92a4702015ae09586d2b789 (diff) |
Fix #1700: Added PJ_ICE_CAND_TYPE_MAX to represent the number ICE candidate types.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4602 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r-- | pjnath/include/pjnath/ice_session.h | 7 | ||||
-rw-r--r-- | pjnath/src/pjnath/ice_session.c | 6 | ||||
-rw-r--r-- | pjnath/src/pjnath/ice_strans.c | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/pjnath/include/pjnath/ice_session.h b/pjnath/include/pjnath/ice_session.h index 8cd45864..d850301a 100644 --- a/pjnath/include/pjnath/ice_session.h +++ b/pjnath/include/pjnath/ice_session.h @@ -154,7 +154,12 @@ typedef enum pj_ice_cand_type * ICE relayed candidate, which represents the address allocated in * TURN server. */ - PJ_ICE_CAND_TYPE_RELAYED + PJ_ICE_CAND_TYPE_RELAYED, + + /** + * Number of defined ICE candidate types. + */ + PJ_ICE_CAND_TYPE_MAX } pj_ice_cand_type; diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index 5dfbef7d..a4068714 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -80,7 +80,7 @@ enum timer_type }; /* Candidate type preference */ -static pj_uint8_t cand_type_prefs[4] = +static pj_uint8_t cand_type_prefs[PJ_ICE_CAND_TYPE_MAX] = { #if PJ_ICE_CAND_TYPE_PREF_BITS < 8 /* Keep it to 2 bits */ @@ -545,9 +545,9 @@ PJ_DEF(pj_status_t) pj_ice_sess_set_prefs(pj_ice_sess *ice, { unsigned i; PJ_ASSERT_RETURN(ice && prefs, PJ_EINVAL); - ice->prefs = (pj_uint8_t*) pj_pool_calloc(ice->pool, PJ_ARRAY_SIZE(prefs), + ice->prefs = (pj_uint8_t*) pj_pool_calloc(ice->pool, PJ_ICE_CAND_TYPE_MAX, sizeof(pj_uint8_t)); - for (i=0; i<4; ++i) { + for (i=0; i<PJ_ICE_CAND_TYPE_MAX; ++i) { #if PJ_ICE_CAND_TYPE_PREF_BITS < 8 pj_assert(prefs[i] < (2 << PJ_ICE_CAND_TYPE_PREF_BITS)); #endif diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c index 0907af0a..86031d98 100644 --- a/pjnath/src/pjnath/ice_strans.c +++ b/pjnath/src/pjnath/ice_strans.c @@ -65,7 +65,7 @@ enum tp_type /* The candidate type preference when STUN candidate is used */ -static pj_uint8_t srflx_pref_table[4] = +static pj_uint8_t srflx_pref_table[PJ_ICE_CAND_TYPE_MAX] = { #if PJNATH_ICE_PRIO_STD 100, /**< PJ_ICE_HOST_PREF */ |