~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjmedia/include/pjmedia/transport_ice.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: transport_ice.h 4350 2013-02-15 03:57:31Z nanang $ */
 
2
/* 
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
19
 */
 
20
#ifndef __PJMEDIA_TRANSPORT_ICE_H__
 
21
#define __PJMEDIA_TRANSPORT_ICE_H__
 
22
 
 
23
 
 
24
/**
 
25
 * @file transport_ice.h
 
26
 * @brief ICE capable media transport.
 
27
 */
 
28
 
 
29
#include <pjmedia/stream.h>
 
30
#include <pjnath/ice_strans.h>
 
31
 
 
32
 
 
33
/**
 
34
 * @defgroup PJMEDIA_TRANSPORT_ICE ICE Media Transport 
 
35
 * @ingroup PJMEDIA_TRANSPORT
 
36
 * @brief Interactive Connectivity Establishment (ICE) transport
 
37
 * @{
 
38
 *
 
39
 * This describes the implementation of media transport using
 
40
 * Interactive Connectivity Establishment (ICE) protocol.
 
41
 */
 
42
 
 
43
PJ_BEGIN_DECL
 
44
 
 
45
 
 
46
/**
 
47
 * Structure containing callbacks to receive ICE notifications.
 
48
 */
 
49
typedef struct pjmedia_ice_cb
 
50
{
 
51
    /**
 
52
     * This callback will be called when ICE negotiation completes.
 
53
     *
 
54
     * @param tp        PJMEDIA ICE transport.
 
55
     * @param op        The operation
 
56
     * @param status    Operation status.
 
57
     */
 
58
    void    (*on_ice_complete)(pjmedia_transport *tp,
 
59
                               pj_ice_strans_op op,
 
60
                               pj_status_t status);
 
61
 
 
62
} pjmedia_ice_cb;
 
63
 
 
64
 
 
65
/**
 
66
 * This structure specifies ICE transport specific info. This structure
 
67
 * will be filled in media transport specific info.
 
68
 */
 
69
typedef struct pjmedia_ice_transport_info
 
70
{
 
71
    /**
 
72
     * Specifies whether ICE is used, i.e. SDP offer and answer indicates
 
73
     * that both parties support ICE and ICE should be used for the session.
 
74
     */
 
75
    pj_bool_t active;
 
76
 
 
77
    /**
 
78
     * ICE sesion state.
 
79
     */
 
80
    pj_ice_strans_state sess_state;
 
81
 
 
82
    /**
 
83
     * Session role.
 
84
     */
 
85
    pj_ice_sess_role role;
 
86
 
 
87
    /**
 
88
     * Number of components in the component array. Before ICE negotiation
 
89
     * is complete, the number represents the number of components of the
 
90
     * local agent. After ICE negotiation has been completed successfully,
 
91
     * the number represents the number of common components between local
 
92
     * and remote agents.
 
93
     */
 
94
    unsigned comp_cnt;
 
95
 
 
96
    /**
 
97
     * Array of ICE components. Typically the first element denotes RTP and
 
98
     * second element denotes RTCP.
 
99
     */
 
100
    struct
 
101
    {
 
102
        /**
 
103
         * Local candidate type.
 
104
         */
 
105
        pj_ice_cand_type    lcand_type;
 
106
 
 
107
        /**
 
108
         * The local address.
 
109
         */
 
110
        pj_sockaddr         lcand_addr;
 
111
 
 
112
        /**
 
113
         * Remote candidate type.
 
114
         */
 
115
        pj_ice_cand_type    rcand_type;
 
116
 
 
117
        /**
 
118
         * Remote address.
 
119
         */
 
120
        pj_sockaddr         rcand_addr;
 
121
 
 
122
    } comp[2];
 
123
 
 
124
} pjmedia_ice_transport_info;
 
125
 
 
126
 
 
127
/**
 
128
 * Options that can be specified when creating ICE transport.
 
129
 */
 
130
enum pjmedia_transport_ice_options
 
131
{
 
132
    /**
 
133
     * Normally when remote doesn't use ICE, the ICE transport will 
 
134
     * continuously check the source address of incoming packets to see 
 
135
     * if it is different than the configured remote address, and switch 
 
136
     * the remote address to the source address of the packet if they 
 
137
     * are different after several packets are received.
 
138
     * Specifying this option will disable this feature.
 
139
     */
 
140
    PJMEDIA_ICE_NO_SRC_ADDR_CHECKING = 1
 
141
};
 
142
 
 
143
 
 
144
/**
 
145
 * Create the Interactive Connectivity Establishment (ICE) media transport
 
146
 * using the specified configuration. When STUN or TURN (or both) is used,
 
147
 * the creation operation will complete asynchronously, when STUN resolution
 
148
 * and TURN allocation completes. When the initialization completes, the
 
149
 * \a on_ice_complete() complete will be called with \a op parameter equal
 
150
 * to PJ_ICE_STRANS_OP_INIT.
 
151
 *
 
152
 * In addition, this transport will also notify the application about the
 
153
 * result of ICE negotiation, also in \a on_ice_complete() callback. In this
 
154
 * case the callback will be called with \a op parameter equal to
 
155
 * PJ_ICE_STRANS_OP_NEGOTIATION.
 
156
 *
 
157
 * Other than this, application should use the \ref PJMEDIA_TRANSPORT API
 
158
 * to manipulate this media transport.
 
159
 *
 
160
 * @param endpt         The media endpoint.
 
161
 * @param name          Optional name to identify this ICE media transport
 
162
 *                      for logging purposes.
 
163
 * @param comp_cnt      Number of components to be created.
 
164
 * @param cfg           Pointer to configuration settings.
 
165
 * @param cb            Optional structure containing ICE specific callbacks.
 
166
 * @param p_tp          Pointer to receive the media transport instance.
 
167
 *
 
168
 * @return              PJ_SUCCESS on success, or the appropriate error code.
 
169
 */
 
170
PJ_DECL(pj_status_t) pjmedia_ice_create(pjmedia_endpt *endpt,
 
171
                                        const char *name,
 
172
                                        unsigned comp_cnt,
 
173
                                        const pj_ice_strans_cfg *cfg,
 
174
                                        const pjmedia_ice_cb *cb,
 
175
                                        pjmedia_transport **p_tp);
 
176
 
 
177
 
 
178
/**
 
179
 * The same as #pjmedia_ice_create() with additional \a options param.
 
180
 *
 
181
 * @param endpt         The media endpoint.
 
182
 * @param name          Optional name to identify this ICE media transport
 
183
 *                      for logging purposes.
 
184
 * @param comp_cnt      Number of components to be created.
 
185
 * @param cfg           Pointer to configuration settings.
 
186
 * @param cb            Optional structure containing ICE specific callbacks.
 
187
 * @param options       Options, see #pjmedia_transport_ice_options.
 
188
 * @param p_tp          Pointer to receive the media transport instance.
 
189
 *
 
190
 * @return              PJ_SUCCESS on success, or the appropriate error code.
 
191
 */
 
192
PJ_DECL(pj_status_t) pjmedia_ice_create2(pjmedia_endpt *endpt,
 
193
                                         const char *name,
 
194
                                         unsigned comp_cnt,
 
195
                                         const pj_ice_strans_cfg *cfg,
 
196
                                         const pjmedia_ice_cb *cb,
 
197
                                         unsigned options,
 
198
                                         pjmedia_transport **p_tp);
 
199
 
 
200
/**
 
201
 * The same as #pjmedia_ice_create2() with additional \a user_data param.
 
202
 *
 
203
 * @param endpt         The media endpoint.
 
204
 * @param name          Optional name to identify this ICE media transport
 
205
 *                      for logging purposes.
 
206
 * @param comp_cnt      Number of components to be created.
 
207
 * @param cfg           Pointer to configuration settings.
 
208
 * @param cb            Optional structure containing ICE specific callbacks.
 
209
 * @param options       Options, see #pjmedia_transport_ice_options.
 
210
 * @param user_data     User data to be attached to the transport.
 
211
 * @param p_tp          Pointer to receive the media transport instance.
 
212
 *
 
213
 * @return              PJ_SUCCESS on success, or the appropriate error code.
 
214
 */
 
215
PJ_DECL(pj_status_t) pjmedia_ice_create3(pjmedia_endpt *endpt,
 
216
                                         const char *name,
 
217
                                         unsigned comp_cnt,
 
218
                                         const pj_ice_strans_cfg *cfg,
 
219
                                         const pjmedia_ice_cb *cb,
 
220
                                         unsigned options,
 
221
                                         void *user_data,
 
222
                                         pjmedia_transport **p_tp);
 
223
 
 
224
PJ_END_DECL
 
225
 
 
226
 
 
227
/**
 
228
 * @}
 
229
 */
 
230
 
 
231
 
 
232
#endif  /* __PJMEDIA_TRANSPORT_ICE_H__ */
 
233
 
 
234