reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
UdpRelayServer.hxx
Go to the documentation of this file.
1#ifndef UDP_RELAY_SERVER_HXX
2#define UDP_RELAY_SERVER_HXX
3
4#include <asio.hpp>
5#ifdef USE_SSL
6#include <asio/ssl.hpp>
7#endif
8#include <string>
9#include "RequestHandler.hxx"
11
12namespace reTurn {
13
14class StunTuple;
15
17 : public AsyncUdpSocketBase
18{
19public:
21 explicit UdpRelayServer(asio::io_context& ioService, TurnAllocation& turnAllocation);
25
28
30 bool startReceiving();
31
33 void stop();
34
35private:
37 virtual void onReceiveSuccess(const asio::ip::address& address, unsigned short port, const std::shared_ptr<DataBuffer>& data);
38 virtual void onReceiveFailure(const asio::error_code& e);
39
41 virtual void onSendSuccess();
42 virtual void onSendFailure(const asio::error_code& e);
43
44 TurnAllocation& mTurnAllocation;
45 bool mStopping;
46 bool mBindSuccess;
47 asio::error_code mLastSendErrorCode; // Use to ensure we only log at Warning level once for a particular send error
48};
49
50typedef std::shared_ptr<UdpRelayServer> UdpRelayServerPtr;
51
52}
53
54#endif
55
56
57/* ====================================================================
58
59 Copyright (c) 2007-2008, Plantronics, Inc.
60 All rights reserved.
61
62 Redistribution and use in source and binary forms, with or without
63 modification, are permitted provided that the following conditions are
64 met:
65
66 1. Redistributions of source code must retain the above copyright
67 notice, this list of conditions and the following disclaimer.
68
69 2. Redistributions in binary form must reproduce the above copyright
70 notice, this list of conditions and the following disclaimer in the
71 documentation and/or other materials provided with the distribution.
72
73 3. Neither the name of Plantronics nor the names of its contributors
74 may be used to endorse or promote products derived from this
75 software without specific prior written permission.
76
77 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
78 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
79 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
80 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
81 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
82 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
83 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
87 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88
89 ==================================================================== */
UdpRelayServer & operator=(const UdpRelayServer &)=delete
bool startReceiving()
Starts processing.
UdpRelayServer(UdpRelayServer &&)=delete
UdpRelayServer & operator=(UdpRelayServer &&)=delete
UdpRelayServer(const UdpRelayServer &)=delete
void stop()
Causes this object to destroy itself safely (ie. waiting for asynchronous callbacks to finish)
std::shared_ptr< UdpRelayServer > UdpRelayServerPtr
void list()
Definition userAdmin.cxx:66