Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | // Copyright (C) 1999-2005 Open Source Telecom Corporation. |
| 2 | // Copyright (C) 2006-2010 David Sugar, Tycho Softworks. |
| 3 | // |
| 4 | // This program is free software; you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation; either version 2 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program; if not, write to the Free Software |
| 16 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | // |
| 18 | // As a special exception, you may use this file as part of a free software |
| 19 | // library without restriction. Specifically, if other files instantiate |
| 20 | // templates or use macros or inline functions from this file, or you compile |
| 21 | // this file and link it with other files to produce an executable, this |
| 22 | // file does not by itself cause the resulting executable to be covered by |
| 23 | // the GNU General Public License. This exception does not however |
| 24 | // invalidate any other reasons why the executable file might be covered by |
| 25 | // the GNU General Public License. |
| 26 | // |
| 27 | // This exception applies only to the code released under the name GNU |
| 28 | // ccRTP. If you copy code from other releases into a copy of GNU |
| 29 | // ccRTP, as the General Public License permits, the exception does |
| 30 | // not apply to the code that you add in this way. To avoid misleading |
| 31 | // anyone as to the status of such modified files, you must delete |
| 32 | // this exception notice from them. |
| 33 | // |
| 34 | // If you write modifications of your own for GNU ccRTP, it is your choice |
| 35 | // whether to permit this exception to apply to your modifications. |
| 36 | // If you do not wish that, delete this exception notice. |
| 37 | // |
| 38 | // RTPDuplex class implementation |
| 39 | // |
| 40 | |
| 41 | #include "private.h" |
| 42 | #include <ccrtp/ext.h> |
| 43 | |
Alexandre Lision | ddd731e | 2014-01-31 11:50:08 -0500 | [diff] [blame] | 44 | NAMESPACE_COMMONCPP |
Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 45 | |
| 46 | RTPDuplex::RTPDuplex(const InetAddress &ia, tpport_t local, tpport_t remote) : |
| 47 | RTPDataQueue(), UDPReceive(ia, local), UDPTransmit(ia, remote) |
| 48 | { |
| 49 | dataBasePort = local; |
| 50 | } |
| 51 | |
| 52 | RTPDuplex::~RTPDuplex() |
| 53 | { |
| 54 | // Terminate both sockets. |
| 55 | endTransmitter(); |
| 56 | endReceiver(); |
| 57 | } |
| 58 | |
| 59 | UDPSocket::Error RTPDuplex::connect(const InetHostAddress &ia, tpport_t port) |
| 60 | { |
| 61 | UDPTransmit::Error rtn; |
| 62 | |
| 63 | if(!port) |
| 64 | port = dataBasePort; |
| 65 | |
| 66 | rtn = UDPTransmit::connect(ia, port); |
| 67 | |
| 68 | if(!rtn) |
| 69 | rtn = UDPReceive::connect(ia, port + 1); |
| 70 | if(rtn) |
| 71 | return rtn; |
| 72 | |
| 73 | enableStack(); |
| 74 | |
| 75 | return UDPTransmit::errSuccess; |
| 76 | } |
| 77 | |
Alexandre Lision | ddd731e | 2014-01-31 11:50:08 -0500 | [diff] [blame] | 78 | END_NAMESPACE |
Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 79 | |
| 80 | /** EMACS ** |
| 81 | * Local variables: |
| 82 | * mode: c++ |
| 83 | * c-basic-offset: 4 |
| 84 | * End: |
| 85 | */ |
| 86 | |
| 87 | |
| 88 | |