1
#ifndef ASYNC_TCP_SOCKET_BASE_HXX
2
#define ASYNC_TCP_SOCKET_BASE_HXX
5
#include <boost/bind.hpp>
7
#include "AsyncSocketBase.hxx"
11
class AsyncTcpSocketBase : public AsyncSocketBase
14
AsyncTcpSocketBase(asio::io_service& ioService);
15
virtual ~AsyncTcpSocketBase();
17
virtual unsigned int getSocketDescriptor();
19
virtual asio::error_code bind(const asio::ip::address& address, unsigned short port);
20
virtual void connect(const std::string& address, unsigned short port);
22
virtual void transportReceive();
23
virtual void transportFramedReceive();
24
virtual void transportSend(const StunTuple& destination, std::vector<asio::const_buffer>& buffers);
25
virtual void transportClose();
27
virtual void setConnectedAddressAndPort(); // Used by server side so that get fn's will work
28
virtual const asio::ip::address getSenderEndpointAddress();
29
virtual unsigned short getSenderEndpointPort();
32
virtual void handleReadHeader(const asio::error_code& e);
33
virtual void handleTcpResolve(const asio::error_code& ec, asio::ip::tcp::resolver::iterator endpoint_iterator);
34
virtual void handleConnect(const asio::error_code& ec, asio::ip::tcp::resolver::iterator endpoint_iterator);
36
asio::ip::tcp::socket mSocket;
37
asio::ip::tcp::resolver mResolver;
47
/* ====================================================================
49
Copyright (c) 2007-2008, Plantronics, Inc.
52
Redistribution and use in source and binary forms, with or without
53
modification, are permitted provided that the following conditions are
56
1. Redistributions of source code must retain the above copyright
57
notice, this list of conditions and the following disclaimer.
59
2. Redistributions in binary form must reproduce the above copyright
60
notice, this list of conditions and the following disclaimer in the
61
documentation and/or other materials provided with the distribution.
63
3. Neither the name of Plantronics nor the names of its contributors
64
may be used to endorse or promote products derived from this
65
software without specific prior written permission.
67
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
68
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
69
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
70
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
71
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
72
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
73
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
74
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
75
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
76
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
77
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79
==================================================================== */