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

« back to all changes in this revision

Viewing changes to reTurn/TcpServer.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 TCP_SERVER_HXX
 
2
#define TCP_SERVER_HXX
 
3
 
 
4
#include <asio.hpp>
 
5
#include <string>
 
6
#include <boost/noncopyable.hpp>
 
7
#include "TcpConnection.hxx"
 
8
#include "ConnectionManager.hxx"
 
9
#include "RequestHandler.hxx"
 
10
 
 
11
namespace reTurn {
 
12
 
 
13
class TcpServer
 
14
  : private boost::noncopyable
 
15
{
 
16
public:
 
17
  /// Create the server to listen on the specified TCP address and port
 
18
  explicit TcpServer(asio::io_service& ioService, RequestHandler& rqeuestHandler, const asio::ip::address& address, unsigned short port);
 
19
 
 
20
  void start();
 
21
 
 
22
private:
 
23
  /// Handle completion of an asynchronous accept operation.
 
24
  void handleAccept(const asio::error_code& e);
 
25
 
 
26
  /// The io_service used to perform asynchronous operations.
 
27
  asio::io_service& mIOService;
 
28
 
 
29
  /// Acceptor used to listen for incoming connections.
 
30
  asio::ip::tcp::acceptor mAcceptor;
 
31
 
 
32
  /// The connection manager which owns all live connections.
 
33
  ConnectionManager mConnectionManager;
 
34
 
 
35
  /// The next connection to be accepted.
 
36
  ConnectionPtr mNewConnection;
 
37
 
 
38
  /// The handler for all incoming requests.
 
39
  RequestHandler& mRequestHandler;
 
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
 ==================================================================== */