1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_comm_AccessPoint_hpp
10 #define anna_comm_AccessPoint_hpp
14 #include <anna/core/RuntimeException.hpp>
16 #include <anna/comm/INetAddress.hpp>
29 Estructura para mantener la informacion de los extremos de un Socket.
31 Dependiendo del tipo de Socket puede tener un punto local y/o un punto
35 \warning This should be internally used
39 AccessPoint() : a_path(NULL) {;}
40 AccessPoint(const std::string& path) : a_path(new std::string(path)) {;}
41 AccessPoint(const INetAddress& inetAddress) : a_path(NULL), a_inetAddress(inetAddress) {;}
43 ~AccessPoint() { delete a_path; }
45 const INetAddress& getINetAddress() const throw() { return a_inetAddress; }
46 const std::string& getPath() const throw() { return *a_path; }
48 void clear() throw() { a_inetAddress.clear(); delete a_path; a_path = NULL; }
49 bool isNull() const throw() { return a_path == NULL && a_inetAddress.isNull(); }
51 bool operator == (const AccessPoint&) const throw();
52 AccessPoint& operator = (const INetAddress&) throw();
53 AccessPoint& operator = (const std::string& path) throw();
54 AccessPoint& operator = (const AccessPoint&) throw();
56 void asString(std::string& msg) const throw();
58 void asXML(const char* name, xml::Node* parent) const throw(RuntimeException);
60 std::string serialize() const throw();
62 void translate(const Socket&, sockaddr*&, int& len) throw(RuntimeException);
65 const Socket* a_owner;
66 INetAddress a_inetAddress;
68 sockaddr_in a_sockaddr_in;
69 sockaddr_un a_sockaddr_un;