00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BOOSTER_AIO_BASIC_SOCKET_H
00009 #define BOOSTER_AIO_BASIC_SOCKET_H
00010
00011 #include <booster/aio/types.h>
00012 #include <booster/hold_ptr.h>
00013 #include <booster/noncopyable.h>
00014 #include <booster/aio/endpoint.h>
00015 #include <booster/aio/basic_io_device.h>
00016
00017 namespace booster {
00018 namespace aio {
00019
00020 class io_service;
00021
00022
00026 class BOOSTER_API basic_socket : public basic_io_device {
00027 public:
00031 basic_socket();
00035 basic_socket(io_service &srv);
00036 ~basic_socket();
00037
00043 void open(family_type d,socket_type t);
00049 void open(family_type d,socket_type t,system::error_code &e);
00050
00056 endpoint local_endpoint(system::error_code &e);
00062 endpoint local_endpoint();
00063
00069 endpoint remote_endpoint(system::error_code &e);
00075 endpoint remote_endpoint();
00076
00080 typedef enum {
00081 tcp_no_delay,
00082 keep_alive,
00083 reuse_address
00084 } boolean_option_type;
00085
00091 bool get_option(boolean_option_type opt,system::error_code &e);
00096 bool get_option(boolean_option_type opt);
00102 void set_option(boolean_option_type opt,bool v,system::error_code &e);
00108 void set_option(boolean_option_type opt,bool v);
00109
00110 private:
00111 struct data;
00112 hold_ptr<data> d;
00113 };
00114
00115 }
00116 }
00117
00118 #endif