reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TurnAsyncUdpSocket.cxx
Go to the documentation of this file.
2#include "rutil/Lock.hxx"
3
4// Remove warning about 'this' use in initiator list - pointer is only stored
5#if defined(WIN32) && !defined(__GNUC__)
6#pragma warning( disable : 4355 ) // using this in base member initializer list
7#endif
8
9using namespace std;
10using namespace resip;
11
12#if defined(WIN32) && !defined(__GNUC__)
13#pragma warning( disable : 4355 )
14#endif
15
16namespace reTurn {
17
18TurnAsyncUdpSocket::TurnAsyncUdpSocket(asio::io_context& ioService,
19 TurnAsyncSocketHandler* turnAsyncSocketHandler,
20 const asio::ip::address& address,
21 unsigned short port) :
22 TurnAsyncSocket(ioService, *this, turnAsyncSocketHandler, address, port),
23 AsyncUdpSocketBase(ioService)
24{
26 mBindError = bind(address, port);
27}
28
29void
30TurnAsyncUdpSocket::onConnectSuccess()
31{
32 {
35 }
37}
38
39void
40TurnAsyncUdpSocket::onConnectFailure(const asio::error_code& e)
41{
44}
45
46void
47TurnAsyncUdpSocket::onReceiveSuccess(const asio::ip::address& address, unsigned short port, const std::shared_ptr<DataBuffer>& data)
48{
49 handleReceivedData(address, port, data);
51}
52
53void
54TurnAsyncUdpSocket::onReceiveFailure(const asio::error_code& e)
55{
56 if (e.value() == 234) // ?jjg? ERROR_MORE_DATA -- is this right on all platforms?
57 {
59 }
60 else
61 {
64 }
65}
66
67void
68TurnAsyncUdpSocket::onSendSuccess()
69{
72}
73
74void
75TurnAsyncUdpSocket::onSendFailure(const asio::error_code& e)
76{
79}
80
81} // namespace
82
83
84/* ====================================================================
85
86 Copyright (c) 2008-2026, SIP Specturm, Inc. http://sipspectrum.com
87 Copyright (c) 2007-2008, Plantronics, Inc.
88 All rights reserved.
89
90 Redistribution and use in source and binary forms, with or without
91 modification, are permitted provided that the following conditions are
92 met:
93
94 1. Redistributions of source code must retain the above copyright
95 notice, this list of conditions and the following disclaimer.
96
97 2. Redistributions in binary form must reproduce the above copyright
98 notice, this list of conditions and the following disclaimer in the
99 documentation and/or other materials provided with the distribution.
100
101 3. Neither the name of Plantronics nor the names of its contributors
102 may be used to endorse or promote products derived from this
103 software without specific prior written permission.
104
105 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
106 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
107 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
108 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
109 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
110 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
111 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
112 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
113 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
114 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
115 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
116
117 ==================================================================== */
asio::ip::address mConnectedAddress
Connected Info and State.
asio::error_code bind(const asio::ip::address &address, unsigned short port) override
Note: The following API's are thread safe and queue the request to be handled by the ioService thread...
void setTransportType(TransportType transport)
Definition StunTuple.hxx:42
virtual void onReceiveFailure(unsigned int socketDesc, const asio::error_code &e)=0
virtual void onSendSuccess(unsigned int socketDesc)=0
virtual void onSendFailure(unsigned int socketDesc, const asio::error_code &e)=0
virtual void onConnectFailure(unsigned int socketDesc, const asio::error_code &e)=0
virtual void onConnectSuccess(unsigned int socketDesc, const asio::ip::address &address, unsigned short port)=0
resip::RecursiveMutex mHandlerMutex
void handleReceivedData(const asio::ip::address &address, unsigned short port, const std::shared_ptr< DataBuffer > &data)
TurnAsyncSocketHandler * mTurnAsyncSocketHandler
virtual unsigned int getSocketDescriptor()
TurnAsyncUdpSocket(asio::io_context &ioService, TurnAsyncSocketHandler *turnAsyncSocketHandler, const asio::ip::address &address, unsigned short port)
dcm! – add UnusedChecking(_enum) below;
std::unique_lock< RecursiveMutex > RecursiveLock
Definition Lock.hxx:29