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

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip/include/pjsip/sip_transport_udp.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: sip_transport_udp.h 3553 2011-05-05 06:14:19Z 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 __PJSIP_TRANSPORT_UDP_H__
21
 
#define __PJSIP_TRANSPORT_UDP_H__
22
 
 
23
 
/**
24
 
 * @file sip_transport_udp.h
25
 
 * @brief SIP UDP Transport.
26
 
 */
27
 
 
28
 
#include <pjsip/sip_transport.h>
29
 
 
30
 
PJ_BEGIN_DECL
31
 
 
32
 
/**
33
 
 * @defgroup PJSIP_TRANSPORT_UDP UDP Transport
34
 
 * @ingroup PJSIP_TRANSPORT
35
 
 * @brief API to create and register UDP transport.
36
 
 * @{
37
 
 * The functions below are used to create UDP transport and register
38
 
 * the transport to the framework.
39
 
 */
40
 
 
41
 
/**
42
 
 * Flag that can be specified when calling #pjsip_udp_transport_pause() or
43
 
 * #pjsip_udp_transport_restart().
44
 
 */
45
 
enum
46
 
{
47
 
    /**
48
 
     * This flag tells the transport to keep the existing/internal socket
49
 
     * handle.
50
 
     */
51
 
    PJSIP_UDP_TRANSPORT_KEEP_SOCKET     = 1,
52
 
 
53
 
    /**
54
 
     * This flag tells the transport to destroy the existing/internal socket
55
 
     * handle. Naturally this flag and PJSIP_UDP_TRANSPORT_KEEP_SOCKET are
56
 
     * mutually exclusive.
57
 
     */
58
 
    PJSIP_UDP_TRANSPORT_DESTROY_SOCKET  = 2
59
 
};
60
 
 
61
 
 
62
 
/**
63
 
 * Start UDP transport.
64
 
 *
65
 
 * @param endpt         The SIP endpoint.
66
 
 * @param local         Optional local address to bind. If this argument
67
 
 *                      is NULL, the UDP transport will be bound to arbitrary
68
 
 *                      UDP port.
69
 
 * @param a_name        Published address (only the host and port portion is
70
 
 *                      used). If this argument is NULL, then the bound address
71
 
 *                      will be used as the published address.
72
 
 * @param async_cnt     Number of simultaneous async operations.
73
 
 * @param p_transport   Pointer to receive the transport.
74
 
 *
75
 
 * @return              PJ_SUCCESS when the transport has been successfully
76
 
 *                      started and registered to transport manager, or
77
 
 *                      the appropriate error code.
78
 
 */
79
 
PJ_DECL(pj_status_t) pjsip_udp_transport_start(pjsip_endpoint *endpt,
80
 
                                               const pj_sockaddr_in *local,
81
 
                                               const pjsip_host_port *a_name,
82
 
                                               unsigned async_cnt,
83
 
                                               pjsip_transport **p_transport);
84
 
 
85
 
/**
86
 
 * Start IPv6 UDP transport.
87
 
 */
88
 
PJ_DECL(pj_status_t) pjsip_udp_transport_start6(pjsip_endpoint *endpt,
89
 
                                                const pj_sockaddr_in6 *local,
90
 
                                                const pjsip_host_port *a_name,
91
 
                                                unsigned async_cnt,
92
 
                                                pjsip_transport **p_transport);
93
 
 
94
 
 
95
 
/**
96
 
 * Attach IPv4 UDP socket as a new transport and start the transport.
97
 
 *
98
 
 * @param endpt         The SIP endpoint.
99
 
 * @param sock          UDP socket to use.
100
 
 * @param a_name        Published address (only the host and port portion is
101
 
 *                      used).
102
 
 * @param async_cnt     Number of simultaneous async operations.
103
 
 * @param p_transport   Pointer to receive the transport.
104
 
 *
105
 
 * @return              PJ_SUCCESS when the transport has been successfully
106
 
 *                      started and registered to transport manager, or
107
 
 *                      the appropriate error code.
108
 
 */
109
 
PJ_DECL(pj_status_t) pjsip_udp_transport_attach(pjsip_endpoint *endpt,
110
 
                                                pj_sock_t sock,
111
 
                                                const pjsip_host_port *a_name,
112
 
                                                unsigned async_cnt,
113
 
                                                pjsip_transport **p_transport);
114
 
 
115
 
 
116
 
/**
117
 
 * Attach IPv4 or IPv6 UDP socket as a new transport and start the transport.
118
 
 *
119
 
 * @param endpt         The SIP endpoint.
120
 
 * @param type          Transport type, which is PJSIP_TRANSPORT_UDP for IPv4
121
 
 *                      or PJSIP_TRANSPORT_UDP6 for IPv6 socket.
122
 
 * @param sock          UDP socket to use.
123
 
 * @param a_name        Published address (only the host and port portion is
124
 
 *                      used).
125
 
 * @param async_cnt     Number of simultaneous async operations.
126
 
 * @param p_transport   Pointer to receive the transport.
127
 
 *
128
 
 * @return              PJ_SUCCESS when the transport has been successfully
129
 
 *                      started and registered to transport manager, or
130
 
 *                      the appropriate error code.
131
 
 */
132
 
PJ_DECL(pj_status_t) pjsip_udp_transport_attach2(pjsip_endpoint *endpt,
133
 
                                                 pjsip_transport_type_e type,
134
 
                                                 pj_sock_t sock,
135
 
                                                 const pjsip_host_port *a_name,
136
 
                                                 unsigned async_cnt,
137
 
                                                 pjsip_transport **p_transport);
138
 
 
139
 
/**
140
 
 * Retrieve the internal socket handle used by the UDP transport. Note
141
 
 * that this socket normally is registered to ioqueue, so if application
142
 
 * wants to make use of this socket, it should temporarily pause the
143
 
 * transport.
144
 
 *
145
 
 * @param transport     The UDP transport.
146
 
 *
147
 
 * @return              The socket handle, or PJ_INVALID_SOCKET if no socket
148
 
 *                      is currently being used (for example, when transport
149
 
 *                      is being paused).
150
 
 */
151
 
PJ_DECL(pj_sock_t) pjsip_udp_transport_get_socket(pjsip_transport *transport);
152
 
 
153
 
 
154
 
/**
155
 
 * Temporarily pause or shutdown the transport. When transport is being
156
 
 * paused, it cannot be used by the SIP stack to send or receive SIP
157
 
 * messages.
158
 
 *
159
 
 * Two types of operations are supported by this function:
160
 
 *  - to temporarily make this transport unavailable for SIP uses, but
161
 
 *    otherwise keep the socket handle intact. Application then can
162
 
 *    retrieve the socket handle with #pjsip_udp_transport_get_socket()
163
 
 *    and use it to send/receive application data (for example, STUN
164
 
 *    messages). In this case, application should specify
165
 
 *    PJSIP_UDP_TRANSPORT_KEEP_SOCKET when calling this function, and
166
 
 *    also to specify this flag when calling #pjsip_udp_transport_restart()
167
 
 *    later.
168
 
 *  - to temporarily shutdown the transport, including closing down
169
 
 *    the internal socket handle. This is useful for example to
170
 
 *    temporarily suspend the application for an indefinite period. In
171
 
 *    this case, application should specify PJSIP_UDP_TRANSPORT_DESTROY_SOCKET
172
 
 *    flag when calling this function, and specify a new socket when
173
 
 *    calling #pjsip_udp_transport_restart().
174
 
 *
175
 
 * @param transport     The UDP transport.
176
 
 * @param option        Pause option.
177
 
 *
178
 
 * @return              PJ_SUCCESS if transport is paused successfully,
179
 
 *                      or the appropriate error code.
180
 
 */
181
 
PJ_DECL(pj_status_t) pjsip_udp_transport_pause(pjsip_transport *transport,
182
 
                                               unsigned option);
183
 
 
184
 
/**
185
 
 * Restart the transport. Several operations are supported by this function:
186
 
 *  - if transport was made temporarily unavailable to SIP stack with
187
 
 *    pjsip_udp_transport_pause() and PJSIP_UDP_TRANSPORT_KEEP_SOCKET,
188
 
 *    application can make the transport available to the SIP stack
189
 
 *    again, by specifying PJSIP_UDP_TRANSPORT_KEEP_SOCKET flag here.
190
 
 *  - if application wants to replace the internal socket with a new
191
 
 *    socket, it must specify PJSIP_UDP_TRANSPORT_DESTROY_SOCKET when
192
 
 *    calling this function, so that the internal socket will be destroyed
193
 
 *    if it hasn't been closed. In this case, application has two choices
194
 
 *    on how to create the new socket: 1) to let the transport create
195
 
 *    the new socket, in this case the \a sock option should be set
196
 
 *    to \a PJ_INVALID_SOCKET and optionally the \a local parameter can be
197
 
 *    filled with the desired address and port where the new socket
198
 
 *    should be bound to, or 2) to specify its own socket to be used
199
 
 *    by this transport, by specifying a valid socket in \a sock argument
200
 
 *    and set the \a local argument to NULL. In both cases, application
201
 
 *    may specify the published address of the socket in \a a_name
202
 
 *    argument.
203
 
 *
204
 
 * @param transport     The UDP transport.
205
 
 * @param option        Restart option.
206
 
 * @param sock          Optional socket to be used by the transport.
207
 
 * @param local         The address where the socket should be bound to.
208
 
 *                      If this argument is NULL, socket will be bound
209
 
 *                      to any available port.
210
 
 * @param a_name        Optionally specify the published address for
211
 
 *                      this transport. If the socket is not replaced
212
 
 *                      (PJSIP_UDP_TRANSPORT_KEEP_SOCKET flag is
213
 
 *                      specified), then if this argument is NULL, the
214
 
 *                      previous value will be used. If the socket is
215
 
 *                      replaced and this argument is NULL, the bound
216
 
 *                      address will be used as the published address
217
 
 *                      of the transport.
218
 
 *
219
 
 * @return              PJ_SUCCESS if transport can be restarted, or
220
 
 *                      the appropriate error code.
221
 
 */
222
 
PJ_DECL(pj_status_t) pjsip_udp_transport_restart(pjsip_transport *transport,
223
 
                                                 unsigned option,
224
 
                                                 pj_sock_t sock,
225
 
                                                 const pj_sockaddr_in *local,
226
 
                                                 const pjsip_host_port *a_name);
227
 
 
228
 
 
229
 
PJ_END_DECL
230
 
 
231
 
/**
232
 
 * @}
233
 
 */
234
 
 
235
 
#endif  /* __PJSIP_TRANSPORT_UDP_H__ */