/[resiprocate]/main/reTurn/TcpServer.hxx
ViewVC logotype

Contents of /main/reTurn/TcpServer.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11159 - (show annotations) (download)
Fri Apr 25 14:03:32 2014 UTC (5 years, 6 months ago) by sgodin
File MIME type: text/plain
File size: 2831 byte(s)
-modified asio and boost include file ordering to avoid multiply defined symbol errors on linking
 -in preparation for upgrade of asio drop and support for latest boost 
 -include asio/ssh.hpp everywhere asio.hpp is included
 -include boost headers before others, to ensure we are not redefining stdint definitions in some includes
  and not others

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

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27