mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
update ICE to draft-19
Use real connectivity check states and procedure to nominate the candidate pair. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@301 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
3b480f911f
commit
c5d10e528f
3 changed files with 1000 additions and 529 deletions
|
|
@ -25,16 +25,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "ortp/ortp.h"
|
||||
|
||||
/* list of state for STUN connectivity check */
|
||||
#define ICE_PRUNED -1
|
||||
#define ICE_FROZEN 0
|
||||
#define ICE_WAITING 1
|
||||
#define ICE_IN_PROGRESS 2 /* STUN request was sent */
|
||||
#define ICE_SUCCEEDED 3
|
||||
#define ICE_FAILED 4 /* no answer or unrecoverable failure */
|
||||
|
||||
#define RECV_VALID 2
|
||||
#define SEND_VALID 3
|
||||
#define VALID 4
|
||||
#define INVALID 5
|
||||
|
||||
struct SdpCandidate {
|
||||
/* mandatory attributes: draft 19 */
|
||||
|
|
@ -61,12 +58,16 @@ struct CandidatePair {
|
|||
int rem_controlling;
|
||||
UInt96 tid;
|
||||
int connectivity_check;
|
||||
int retransmission_number;
|
||||
uint64_t retransmission_time;
|
||||
int nominated_pair;
|
||||
};
|
||||
|
||||
#define MAX_ICE_CANDIDATES 10
|
||||
|
||||
struct IceCheckList {
|
||||
struct CandidatePair cand_pairs[MAX_ICE_CANDIDATES];
|
||||
int nominated_pair_index;
|
||||
|
||||
char loc_ice_ufrag[256];
|
||||
char loc_ice_pwd[256];
|
||||
|
|
@ -80,16 +81,22 @@ struct IceCheckList {
|
|||
#define ICE_CL_COMPLETED 1
|
||||
#define ICE_CL_FAILED 2
|
||||
int state;
|
||||
|
||||
int RTO;
|
||||
int Ta;
|
||||
uint64_t keepalive_time;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
int ice_sound_send_stun_request(RtpSession *session, struct IceCheckList *checklist, int round);
|
||||
int ice_sound_send_stun_request(RtpSession *session, struct IceCheckList *checklist, uint64_t ctime);
|
||||
|
||||
int ice_process_stun_message(RtpSession *session, struct IceCheckList *checklist, OrtpEvent *evt);
|
||||
|
||||
int ice_restart(struct IceCheckList *checklist);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -29,8 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
struct SenderData {
|
||||
RtpSession *session;
|
||||
struct IceCheckList *check_lists; /* table of 10 cpair */
|
||||
int round;
|
||||
struct IceCheckList *check_lists; /* table of 10 cpair */
|
||||
uint32_t tsoff;
|
||||
uint32_t skip_until;
|
||||
int rate;
|
||||
|
|
@ -50,7 +49,6 @@ static void sender_init(MSFilter * f)
|
|||
|
||||
d->session = NULL;
|
||||
d->check_lists = NULL;
|
||||
d->round = 0;
|
||||
d->tsoff = 0;
|
||||
d->skip_until = 0;
|
||||
d->skip = FALSE;
|
||||
|
|
@ -90,6 +88,7 @@ static int sender_set_sdpcandidates(MSFilter * f, void *arg)
|
|||
|
||||
scs = (struct IceCheckList *) arg;
|
||||
d->check_lists = scs;
|
||||
ice_restart(d->check_lists);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +178,7 @@ static void sender_process(MSFilter * f)
|
|||
SenderData *d = (SenderData *) f->data;
|
||||
RtpSession *s = d->session;
|
||||
|
||||
struct IceCheckList *cp = d->check_lists;
|
||||
struct IceCheckList *cp = d->check_lists;
|
||||
mblk_t *im;
|
||||
uint32_t timestamp;
|
||||
|
||||
|
|
@ -232,9 +231,11 @@ static void sender_process(MSFilter * f)
|
|||
ms_filter_unlock(f);
|
||||
}
|
||||
|
||||
/* regularly send STUN request */
|
||||
ice_sound_send_stun_request(s, cp, d->round);
|
||||
d->round++;
|
||||
#if !defined(_WIN32_WCE)
|
||||
ice_sound_send_stun_request(s, cp, f->ticker->time);
|
||||
#else
|
||||
ice_sound_send_stun_request(s, cp, f->ticker->time));
|
||||
#endif
|
||||
}
|
||||
|
||||
static MSFilterMethod sender_methods[] = {
|
||||
|
|
@ -297,7 +298,7 @@ static void receiver_init(MSFilter * f)
|
|||
|
||||
d->ortp_event = ortp_ev_queue_new();
|
||||
d->session = NULL;
|
||||
d->check_lists = NULL;
|
||||
d->check_lists = NULL;
|
||||
d->rate = 8000;
|
||||
f->data = d;
|
||||
}
|
||||
|
|
@ -345,7 +346,8 @@ static int receiver_set_sdpcandidates(MSFilter * f, void *arg)
|
|||
return -1;
|
||||
|
||||
scs = (struct IceCheckList *) arg;
|
||||
d->check_lists = scs;
|
||||
d->check_lists = scs;
|
||||
ice_restart(d->check_lists);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -390,7 +392,7 @@ static void receiver_process(MSFilter * f)
|
|||
while (evt != NULL) {
|
||||
if (ortp_event_get_type(evt) ==
|
||||
ORTP_EVENT_STUN_PACKET_RECEIVED) {
|
||||
ice_process_stun_message(d->session, d->check_lists, evt);
|
||||
ice_process_stun_message(d->session, d->check_lists, evt);
|
||||
}
|
||||
if (ortp_event_get_type(evt) ==
|
||||
ORTP_EVENT_TELEPHONE_EVENT) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue