CppCMS
booster/aio/acceptor.h
00001 //
00002 //  Copyright (C) 2009-2012 Artyom Beilis (Tonkikh)
00003 //
00004 //  Distributed under the Boost Software License, Version 1.0. (See
00005 //  accompanying file LICENSE_1_0.txt or copy at
00006 //  http://www.boost.org/LICENSE_1_0.txt)
00007 //
00008 #ifndef BOOSTER_AIO_ACCEPTOR_H
00009 #define BOOSTER_AIO_ACCEPTOR_H
00010 
00011 #include <booster/aio/types.h>
00012 #include <booster/callback.h>
00013 #include <booster/hold_ptr.h>
00014 #include <booster/noncopyable.h>
00015 #include <booster/aio/endpoint.h>
00016 #include <booster/aio/basic_socket.h>
00017 
00018 namespace booster {
00019 namespace aio {
00020         class io_service;
00021         class stream_socket;
00022 
00026         class BOOSTER_API acceptor : public basic_socket {
00027         public:
00028 
00032                 acceptor();
00036                 acceptor(io_service &srv);
00037                 ~acceptor();
00038 
00044                 void open(family_type d);
00050                 void open(family_type d,system::error_code &e);
00051 
00057                 void accept(stream_socket &s);
00063                 void accept(stream_socket &s,system::error_code &e);
00064 
00070                 void bind(endpoint const &ep);
00076                 void bind(endpoint const &ep,system::error_code &e);
00082                 void listen(int backlog);
00088                 void listen(int backlog,system::error_code &e);
00089 
00096                 void async_accept(stream_socket &s,event_handler const &h);
00097         
00098         private:
00099                 struct data;
00100                 hold_ptr<data> d;
00101         };
00102         
00103 } // aio
00104 } // booster
00105 
00106 #endif