CppCMS
acceptor.h
1 //
2 // Copyright (C) 2009-2012 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #ifndef BOOSTER_AIO_ACCEPTOR_H
9 #define BOOSTER_AIO_ACCEPTOR_H
10 
11 #include <booster/aio/types.h>
12 #include <booster/callback.h>
13 #include <booster/hold_ptr.h>
14 #include <booster/noncopyable.h>
15 #include <booster/aio/endpoint.h>
16 #include <booster/aio/basic_socket.h>
17 
18 namespace booster {
19 namespace aio {
20  class io_service;
21  class stream_socket;
22 
26  class BOOSTER_API acceptor : public basic_socket {
27  public:
28 
32  acceptor();
36  acceptor(io_service &srv);
37  ~acceptor();
38 
44  void open(family_type d);
50  void open(family_type d,system::error_code &e);
51 
57  void accept(stream_socket &s);
63  void accept(stream_socket &s,system::error_code &e);
64 
73  void bind(endpoint const &ep);
82  void bind(endpoint const &ep,system::error_code &e);
88  void listen(int backlog);
94  void listen(int backlog,system::error_code &e);
95 
102  void async_accept(stream_socket &s,event_handler const &h);
103 
104  private:
105  struct data;
106  hold_ptr<data> d;
107  };
108 
109 } // aio
110 } // booster
111 
112 #endif
this class represents the connection endpoint, that is generally sockaddr structure in Berkeley socke...
Definition: endpoint.h:26
This class represents a basic Socket object.
Definition: basic_socket.h:26
Definition: callback.h:18
The lightweight object that carries a error code information and its category.
Definition: system_error.h:83
family_type
Definition: types.h:68
this class represents a socket that accepts incoming connections
Definition: acceptor.h:26
This object represents a stream socket: TCP/IP IPv4 or IPv6 or Unix domain stream socket...
Definition: stream_socket.h:31
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
this is the central event loop that dispatches all requests.
Definition: io_service.h:37