CppCMS
booster/aio/endpoint.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_ENDPOINT_H
00009 #define BOOSTER_AIO_ENDPOINT_H
00010 
00011 #include <booster/config.h>
00012 #include <booster/copy_ptr.h>
00013 #include <booster/aio/types.h>
00014 #include <string>
00015 
00016 extern "C" {
00017         struct sockaddr;
00018 };
00019 
00020 namespace booster {
00021 namespace aio {
00026         class BOOSTER_API endpoint {
00027         public:
00028                 endpoint();
00029                 endpoint(endpoint const &);
00030                 endpoint const &operator = (endpoint const &);
00031                 ~endpoint();
00032                 
00038                 endpoint(std::string const &ip,int port);
00039 
00045                 void ip(std::string const &);
00051                 void port(int);
00052 
00058                 std::string ip() const;
00064                 int port() const;
00065 
00066 #ifndef BOOSTER_WIN32
00067 
00068 
00069 
00070 
00071 
00072                 endpoint(std::string const &);
00078                 void path(std::string const &);
00085                 std::string path() const;
00086 #endif
00087 
00093                 family_type family() const;
00094                 
00098                 void raw(sockaddr const *p,int size);
00102                 typedef std::pair<sockaddr const *,int> native_address_type;
00106                 native_address_type raw() const;
00107 
00108         private:
00109                 void throw_invalid() const;
00110                 struct data;
00111                 copy_ptr<data> d;
00112         };
00113 } // aio
00114 } // booster
00115 
00116 
00117 
00118 #endif