reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
AsyncUdpSocketBase.hxx
Go to the documentation of this file.
1#ifndef ASYNC_UDP_SOCKET_BASE_HXX
2#define ASYNC_UDP_SOCKET_BASE_HXX
3
4#include <asio.hpp>
5#ifdef USE_SSL
6#include <asio/ssl.hpp>
7#endif
8
9#include "AsyncSocketBase.hxx"
10
11namespace reTurn {
12
14{
15public:
16 explicit AsyncUdpSocketBase(asio::io_context& ioService);
17
18 unsigned int getSocketDescriptor() override;
19
20 asio::error_code bind(const asio::ip::address& address, unsigned short port) override;
21 void connect(const std::string& address, unsigned short port) override;
22
23 void transportReceive() override;
24 void transportFramedReceive() override;
25 void transportSend(const StunTuple& destination, std::vector<asio::const_buffer>& buffers) override;
26 void transportClose() override;
27
28 asio::ip::address getSenderEndpointAddress() override;
29 unsigned short getSenderEndpointPort() override;
30
31protected:
32 asio::ip::udp::socket mSocket;
33 asio::ip::udp::resolver mResolver;
34
36 asio::ip::udp::endpoint mSenderEndpoint;
37
38 void handleUdpResolve(const asio::error_code& ec,
39 const asio::ip::udp::resolver::results_type& endpoints) override;
40
41private:
42
43};
44
45}
46
47#endif
48
49
50/* ====================================================================
51
52 Copyright (c) 2007-2008, Plantronics, Inc.
53 All rights reserved.
54
55 Redistribution and use in source and binary forms, with or without
56 modification, are permitted provided that the following conditions are
57 met:
58
59 1. Redistributions of source code must retain the above copyright
60 notice, this list of conditions and the following disclaimer.
61
62 2. Redistributions in binary form must reproduce the above copyright
63 notice, this list of conditions and the following disclaimer in the
64 documentation and/or other materials provided with the distribution.
65
66 3. Neither the name of Plantronics nor the names of its contributors
67 may be used to endorse or promote products derived from this
68 software without specific prior written permission.
69
70 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
71 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
72 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
73 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
74 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
75 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
76 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
77 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
80 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
81
82 ==================================================================== */
void handleUdpResolve(const asio::error_code &ec, const asio::ip::udp::resolver::results_type &endpoints) override
asio::ip::udp::socket mSocket
void transportSend(const StunTuple &destination, std::vector< asio::const_buffer > &buffers) override
asio::ip::address getSenderEndpointAddress() override
void connect(const std::string &address, unsigned short port) override
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...
asio::ip::udp::resolver mResolver
unsigned short getSenderEndpointPort() override
asio::ip::udp::endpoint mSenderEndpoint
Endpoint info for current sender.
unsigned int getSocketDescriptor() override
void list()
Definition userAdmin.cxx:66