0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
IOHandlerAccept.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
28 #ifndef AsyncComm_IOHandlerAccept_h
29 #define AsyncComm_IOHandlerAccept_h
30 
31 #include "HandlerMap.h"
32 #include "IOHandler.h"
34 
35 namespace Hypertable {
36 
43  class IOHandlerAccept : public IOHandler {
44 
45  public:
46 
54  IOHandlerAccept(int sd, const DispatchHandlerPtr &dhp,
56  : IOHandler(sd, dhp), m_handler_map(hmap), m_handler_factory(chfp) {
57  memcpy(&m_addr, &m_local_addr, sizeof(InetAddr));
58  }
59 
61  virtual ~IOHandlerAccept() { }
62 
72  bool handle_event(struct pollfd *event,
73  ClockT::time_point arrival_time) override;
74 
75 #if defined(__APPLE__) || defined(__FreeBSD__)
76 
85  bool handle_event(struct kevent *event,
86  ClockT::time_point arrival_time) override;
87 #elif defined(__linux__)
88 
96  bool handle_event(struct epoll_event *event,
97  ClockT::time_point arrival_time) override;
98 #elif defined(__sun__)
99 
109  bool handle_event(port_event_t *event,
110  ClockT::time_point arrival_time) override;
111 #else
113 #endif
114 
115  private:
116 
137 
140 
145  };
147 }
148 
149 #endif // AsyncComm_IOHandlerAccept_h
150 
Declarations for ConnectionHandlerFactory.
virtual ~IOHandlerAccept()
Destructor.
chrono::time_point< fast_clock > time_point
Definition: fast_clock.h:42
HandlerMapPtr m_handler_map
Handler map.
ConnectionHandlerFactoryPtr m_handler_factory
Connection handler factory for creating default dispatch handlers for incoming connections.
std::shared_ptr< HandlerMap > HandlerMapPtr
Smart pointer to HandlerMap.
Definition: HandlerMap.h:437
std::shared_ptr< ConnectionHandlerFactory > ConnectionHandlerFactoryPtr
Smart pointer to ConnectionHandlerFactory.
Encapsulate an internet address.
Definition: InetAddr.h:66
Base class for socket descriptor I/O handlers.
Definition: IOHandler.h:76
bool handle_incoming_connection()
Handles incoming connection requests.
Declarations for HandlerMap.
Hypertable definitions
std::shared_ptr< DispatchHandler > DispatchHandlerPtr
Smart pointer to DispatchHandler.
IOHandlerAccept(int sd, const DispatchHandlerPtr &dhp, HandlerMapPtr &hmap, ConnectionHandlerFactoryPtr &chfp)
Constructor.
I/O handler for accept (listen) sockets.
InetAddr m_addr
Handler socket address.
Definition: IOHandler.h:457
bool handle_event(struct pollfd *event, ClockT::time_point arrival_time) override
Handle poll() interface events.
Declarations for IOHandler.
InetAddr m_local_addr
Local address of connection.
Definition: IOHandler.h:460