~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to reTurn/AsyncTcpSocketBase.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ASYNC_TCP_SOCKET_BASE_HXX
 
2
#define ASYNC_TCP_SOCKET_BASE_HXX
 
3
 
 
4
#include <asio.hpp>
 
5
#include <boost/bind.hpp>
 
6
 
 
7
#include "AsyncSocketBase.hxx"
 
8
 
 
9
namespace reTurn {
 
10
 
 
11
class AsyncTcpSocketBase : public AsyncSocketBase
 
12
{
 
13
public:
 
14
   AsyncTcpSocketBase(asio::io_service& ioService); 
 
15
   virtual ~AsyncTcpSocketBase();
 
16
 
 
17
   virtual unsigned int getSocketDescriptor();
 
18
 
 
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);  
 
21
 
 
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();
 
26
 
 
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();
 
30
 
 
31
protected:
 
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);
 
35
 
 
36
   asio::ip::tcp::socket mSocket;
 
37
   asio::ip::tcp::resolver mResolver;
 
38
 
 
39
private:
 
40
};
 
41
 
 
42
}
 
43
 
 
44
#endif 
 
45
 
 
46
 
 
47
/* ====================================================================
 
48
 
 
49
 Copyright (c) 2007-2008, Plantronics, Inc.
 
50
 All rights reserved.
 
51
 
 
52
 Redistribution and use in source and binary forms, with or without
 
53
 modification, are permitted provided that the following conditions are 
 
54
 met:
 
55
 
 
56
 1. Redistributions of source code must retain the above copyright 
 
57
    notice, this list of conditions and the following disclaimer. 
 
58
 
 
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. 
 
62
 
 
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. 
 
66
 
 
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.
 
78
 
 
79
 ==================================================================== */