reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
AsyncTcpSocketBase.hxx
Go to the documentation of this file.
1#ifndef ASYNC_TCP_SOCKET_BASE_HXX
2#define ASYNC_TCP_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 AsyncTcpSocketBase(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 virtual void setConnectedAddressAndPort(); // Used by server side so that get fn's will work
29 asio::ip::address getSenderEndpointAddress() override;
30 unsigned short getSenderEndpointPort() override;
31
32protected:
33 void handleReadHeader(const asio::error_code& e) override;
34 void handleTcpResolve(const asio::error_code& ec, const asio::ip::tcp::resolver::results_type& endpoints) override;
35 void handleConnect(const asio::error_code& ec, const asio::ip::tcp::endpoint& endpoint) override;
36
37 asio::ip::tcp::socket mSocket;
38 asio::ip::tcp::resolver mResolver;
39};
40
41}
42
43#endif
44
45
46/* ====================================================================
47
48 Copyright (c) 2007-2008, Plantronics, Inc.
49 All rights reserved.
50
51 Redistribution and use in source and binary forms, with or without
52 modification, are permitted provided that the following conditions are
53 met:
54
55 1. Redistributions of source code must retain the above copyright
56 notice, this list of conditions and the following disclaimer.
57
58 2. Redistributions in binary form must reproduce the above copyright
59 notice, this list of conditions and the following disclaimer in the
60 documentation and/or other materials provided with the distribution.
61
62 3. Neither the name of Plantronics nor the names of its contributors
63 may be used to endorse or promote products derived from this
64 software without specific prior written permission.
65
66 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
67 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
68 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
69 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
70 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
71 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
72 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
73 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
74 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
75 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
76 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
77
78 ==================================================================== */
void handleReadHeader(const asio::error_code &e) override
asio::ip::address getSenderEndpointAddress() override
void connect(const std::string &address, unsigned short port) override
unsigned int getSocketDescriptor() override
asio::ip::tcp::socket mSocket
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::tcp::resolver mResolver
void handleConnect(const asio::error_code &ec, const asio::ip::tcp::endpoint &endpoint) override
void handleTcpResolve(const asio::error_code &ec, const asio::ip::tcp::resolver::results_type &endpoints) override
void transportSend(const StunTuple &destination, std::vector< asio::const_buffer > &buffers) override
unsigned short getSenderEndpointPort() override
void list()
Definition userAdmin.cxx:66