1
/* $Id: transport_udp.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
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.
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.
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
20
#ifndef __PJMEDIA_TRANSPORT_UDP_H__
21
#define __PJMEDIA_TRANSPORT_UDP_H__
25
* @file transport_udp.h
26
* @brief Stream transport with UDP.
29
#include <pjmedia/stream.h>
33
* @defgroup PJMEDIA_TRANSPORT_UDP UDP Media Transport
34
* @ingroup PJMEDIA_TRANSPORT
35
* @brief Implementation of media transport with UDP sockets.
38
* The UDP media transport is the standard based media transport
39
* as described by RFC 3550/3551. It can be used to facilitate RTP/RTCP
40
* unicast or multicast communication.
47
* Options that can be specified when creating UDP transport.
49
enum pjmedia_transport_udp_options
52
* Normally the UDP transport will continuously check the source address
53
* of incoming packets to see if it is different than the configured
54
* remote address, and switch the remote address to the source address
55
* of the packet if they are different after several packets are
57
* Specifying this option will disable this feature.
59
PJMEDIA_UDP_NO_SRC_ADDR_CHECKING = 1
64
* Create an RTP and RTCP sockets and bind the sockets to the specified
65
* port to create media transport.
67
* @param endpt The media endpoint instance.
68
* @param name Optional name to be assigned to the transport.
69
* @param port UDP port number for the RTP socket. The RTCP port number
70
* will be set to one above RTP port.
71
* @param options Options, bitmask of #pjmedia_transport_udp_options.
72
* @param p_tp Pointer to receive the transport instance.
74
* @return PJ_SUCCESS on success.
76
PJ_DECL(pj_status_t) pjmedia_transport_udp_create(pjmedia_endpt *endpt,
80
pjmedia_transport **p_tp);
84
* Create an RTP and RTCP sockets and bind the sockets to the specified
85
* address and port to create media transport.
87
* @param endpt The media endpoint instance.
88
* @param name Optional name to be assigned to the transport.
89
* @param addr Optional local address to bind the sockets to. If this
90
* argument is NULL or empty, the sockets will be bound
92
* @param port UDP port number for the RTP socket. The RTCP port number
93
* will be set to one above RTP port.
94
* @param options Options, bitmask of #pjmedia_transport_udp_options.
95
* @param p_tp Pointer to receive the transport instance.
97
* @return PJ_SUCCESS on success.
99
PJ_DECL(pj_status_t) pjmedia_transport_udp_create2(pjmedia_endpt *endpt,
101
const pj_str_t *addr,
104
pjmedia_transport **p_tp);
107
* Another variant of #pjmedia_transport_udp_create() which allows
108
* the creation of IPv6 transport.
110
* @param endpt The media endpoint instance.
111
* @param af Address family, which can be pj_AF_INET() for IPv4 or
112
* pj_AF_INET6() for IPv6.
113
* @param name Optional name to be assigned to the transport.
114
* @param addr Optional local address to bind the sockets to. If this
115
* argument is NULL or empty, the sockets will be bound
117
* @param port UDP port number for the RTP socket. The RTCP port number
118
* will be set to one above RTP port.
119
* @param options Options, bitmask of #pjmedia_transport_udp_options.
120
* @param p_tp Pointer to receive the transport instance.
122
* @return PJ_SUCCESS on success.
124
PJ_DECL(pj_status_t) pjmedia_transport_udp_create3(pjmedia_endpt *endpt,
127
const pj_str_t *addr,
130
pjmedia_transport **p_tp);
134
* Create UDP stream transport from existing sockets. Use this function when
135
* the sockets have previously been created.
137
* @param endpt The media endpoint instance.
138
* @param name Optional name to be assigned to the transport.
139
* @param si Media socket info containing the RTP and RTCP sockets.
140
* @param options Options, bitmask of #pjmedia_transport_udp_options.
141
* @param p_tp Pointer to receive the transport instance.
143
* @return PJ_SUCCESS on success.
145
PJ_DECL(pj_status_t) pjmedia_transport_udp_attach(pjmedia_endpt *endpt,
147
const pjmedia_sock_info *si,
149
pjmedia_transport **p_tp);
160
#endif /* __PJMEDIA_TRANSPORT_UDP_H__ */