reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TurnAsyncTcpSocket.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
18TurnAsyncTcpSocket::TurnAsyncTcpSocket(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 AsyncTcpSocketBase(ioService)
24{
26 mBindError = bind(address, port);
27}
28
29void
30TurnAsyncTcpSocket::onConnectSuccess()
31{
32 {
35 }
37}
38
39void
40TurnAsyncTcpSocket::onConnectFailure(const asio::error_code& e)
41{
44}
45
46void
47TurnAsyncTcpSocket::onReceiveSuccess(const asio::ip::address& address, unsigned short port, const std::shared_ptr<DataBuffer>& data)
48{
49 handleReceivedData(address, port, data);
51}
52
53void
54TurnAsyncTcpSocket::onReceiveFailure(const asio::error_code& e)
55{
58}
59
60void
61TurnAsyncTcpSocket::onSendSuccess()
62{
65}
66
67void
68TurnAsyncTcpSocket::onSendFailure(const asio::error_code& e)
69{
72}
73
74} // namespace
75
76
77/* ====================================================================
78
79 Copyright (c) 2008-2026, SIP Specturm, Inc. http://sipspectrum.com
80 Copyright (c) 2007-2008, Plantronics, Inc.
81 All rights reserved.
82
83 Redistribution and use in source and binary forms, with or without
84 modification, are permitted provided that the following conditions are
85 met:
86
87 1. Redistributions of source code must retain the above copyright
88 notice, this list of conditions and the following disclaimer.
89
90 2. Redistributions in binary form must reproduce the above copyright
91 notice, this list of conditions and the following disclaimer in the
92 documentation and/or other materials provided with the distribution.
93
94 3. Neither the name of Plantronics nor the names of its contributors
95 may be used to endorse or promote products derived from this
96 software without specific prior written permission.
97
98 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
99 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
100 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
101 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
102 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
103 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
104 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
105 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
106 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
107 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
108 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109
110 ==================================================================== */
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
TurnAsyncTcpSocket(asio::io_context &ioService, TurnAsyncSocketHandler *turnAsyncSocketHandler, const asio::ip::address &address=UnspecifiedIpAddress, unsigned short port=0)
virtual unsigned int getSocketDescriptor()
dcm! – add UnusedChecking(_enum) below;
std::unique_lock< RecursiveMutex > RecursiveLock
Definition Lock.hxx:29