ANNA Suite  2020b
Multipurpose development suite for Telco applications
AccessPoint.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
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 //
7 
8 
9 #ifndef anna_comm_AccessPoint_hpp
10 #define anna_comm_AccessPoint_hpp
11 
12 #include <sys/un.h>
13 
15 
17 
18 namespace anna {
19 
20 namespace xml {
21 class Node;
22 }
23 
24 namespace comm {
25 
26 class Socket;
27 
37 class AccessPoint {
38 public:
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) {;}
42 
43  ~AccessPoint() { delete a_path; }
44 
45  const INetAddress& getINetAddress() const { return a_inetAddress; }
46  const std::string& getPath() const { return *a_path; }
47 
48  void clear() { a_inetAddress.clear(); delete a_path; a_path = NULL; }
49  bool isNull() const { return a_path == NULL && a_inetAddress.isNull(); }
50 
51  bool operator == (const AccessPoint&) const ;
52  AccessPoint& operator = (const INetAddress&) ;
53  AccessPoint& operator = (const std::string& path) ;
54  AccessPoint& operator = (const AccessPoint&) ;
55 
56  void asString(std::string& msg) const ;
57 
58  void asXML(const char* name, xml::Node* parent) const noexcept(false);
59 
60  std::string serialize() const ;
61 
62  void translate(const Socket&, sockaddr*&, int& len) noexcept(false);
63 
64 private:
65  const Socket* a_owner;
66  std::string* a_path;
67  INetAddress a_inetAddress;
68  sockaddr_in a_sockaddr_in;
69  sockaddr_un a_sockaddr_un;
70 };
71 
72 }
73 }
74 
75 #endif
76 
Definition: INetAddress.hpp:34
AccessPoint(const std::string &path)
Definition: AccessPoint.hpp:40
const std::string & getPath() const
Definition: AccessPoint.hpp:46
Definition: Node.hpp:56
bool isNull() const
Definition: AccessPoint.hpp:49
AccessPoint(const INetAddress &inetAddress)
Definition: AccessPoint.hpp:41
const INetAddress & getINetAddress() const
Definition: AccessPoint.hpp:45
AccessPoint()
Definition: AccessPoint.hpp:39
Definition: Socket.hpp:39
xml::Node Node
Definition: Node.hpp:21
Definition: app.hpp:12
~AccessPoint()
Definition: AccessPoint.hpp:43
void clear()
Definition: AccessPoint.hpp:48
Definition: AccessPoint.hpp:37