]> sjero.net Git - linphone/blob - linphone/mediastreamer2/include/mediastreamer2/ice.h
remote ortp and add it as a submodule instead.
[linphone] / linphone / mediastreamer2 / include / mediastreamer2 / ice.h
1 /*
2 mediastreamer2 library - modular sound and video processing and streaming
3 Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19
20 #ifndef ice_hh
21 #define ice_hh
22
23 #include "msfilter.h"
24 #include "ortp/stun_udp.h"
25 #include "ortp/stun.h"
26 #include "ortp/ortp.h"
27
28 /* list of state for STUN connectivity check */
29 #define ICE_PRUNED -1
30 #define ICE_FROZEN 0
31 #define ICE_WAITING 1
32 #define ICE_IN_PROGRESS 2 /* STUN request was sent */
33 #define ICE_SUCCEEDED 3
34 #define ICE_FAILED 4 /* no answer or unrecoverable failure */
35
36
37 struct SdpCandidate {
38         /* mandatory attributes: draft 19 */
39         int foundation;
40         int component_id;
41         char transport[20];
42         int priority;
43         char conn_addr[64];
44         int conn_port;
45         char cand_type[20];
46         char rel_addr[64];
47         int rel_port;
48
49         /* optionnal attributes: draft 19 */
50         char extension_attr[512]; /* *(SP extension-att-name SP extension-att-value) */
51 };
52
53 struct CandidatePair {
54
55     struct SdpCandidate local_candidate;
56     struct SdpCandidate remote_candidate;
57     long long pair_priority;
58     /* additionnal information */
59     int rem_controlling;
60     UInt96 tid;
61     int connectivity_check;
62         int retransmission_number;
63         uint64_t retransmission_time;
64         int nominated_pair;
65 };
66
67 #define MAX_ICE_CANDIDATES 10
68
69 struct IceCheckList {
70     struct CandidatePair cand_pairs[MAX_ICE_CANDIDATES];
71         int nominated_pair_index;
72
73     char loc_ice_ufrag[256];
74     char loc_ice_pwd[256];
75     char rem_ice_ufrag[256];
76     char rem_ice_pwd[256];
77
78     int rem_controlling;
79     uint64_t tiebreak_value;
80
81 #define ICE_CL_RUNNING 0
82 #define ICE_CL_COMPLETED 1
83 #define ICE_CL_FAILED 2
84     int state;
85
86     int RTO;
87     int Ta;
88         uint64_t keepalive_time;
89 };
90
91 #define MS_ICE_SET_SESSION                      MS_FILTER_METHOD(MS_ICE_ID,0,RtpSession*)
92 #define MS_ICE_SET_CANDIDATEPAIRS       MS_FILTER_METHOD(MS_ICE_ID,1,struct CandidatePair*)
93
94 extern MSFilterDesc ms_ice_desc;
95
96 #endif