Mixe for Privacy and Anonymity in the Internet
CAListenerInterface.hpp
Go to the documentation of this file.
1 #ifndef _CALISTENERINTERFAC__
2 #define _CALISTENERINTERFAC__
3 #include "typedefs.hpp"
4 #include "CASocketAddr.hpp"
5 
7  {
8  private:
10 
11  public:
12  CAListenerInterface(const CAListenerInterface& l)//Copy constructor
13  {
14  m_Type=l.m_Type;
17  if(l.m_pAddr!=NULL)
18  m_pAddr=l.m_pAddr->clone();
19  else
20  m_pAddr=NULL;
21  if(l.m_strHostname!=NULL)
22  {
23  UINT32 i=strlen((char*)l.m_strHostname);
24  m_strHostname=new UINT8[i+1];
25  memcpy(m_strHostname,l.m_strHostname,i);
26  m_strHostname[i]=0;
27  }
28  else
29  m_strHostname=NULL;
30  }
31  CAListenerInterface& operator=(const CAListenerInterface&); //Zuweisungsoperator
33 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
34  static CAListenerInterface* getInstance(const DOMNode* node);
35  static CAListenerInterface** getInstance(DOMElement* a_elemListenerInterfaces, UINT32& r_length);
36 #endif
37  static CAListenerInterface* getInstance(NetworkType type,const UINT8* path); //constructs a Unix Domain ListenerInterface
38  static CAListenerInterface* getInstance(NetworkType type,const UINT8* hostnameOrIP,UINT16 port); //constructs a TCP/IP or UDP/IP ListenerInterface
39 
40  public:
42  {
43  return m_Type;
44  }
45  SINT32 getHostName(UINT8* buff,UINT32 bufflen) const;
46 
48  {
49  return m_pAddr->clone();
50  }
51 
52  bool isHidden() const
53  {
54  return m_bHidden;
55  }
56  bool isVirtual() const
57  {
58  return m_bVirtual;
59  }
60  char* getHostname() { return (char*)m_strHostname; }
61 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
62  SINT32 toDOMElement(DOMElement* & elem,XERCES_CPP_NAMESPACE::DOMDocument* ownerDoc) const;
63  static const char* XML_ELEMENT_CONTAINER_NAME;
64  static const char* XML_ELEMENT_NAME;
65 #endif
66 
67  private:
71  bool m_bHidden;
72  bool m_bVirtual;
73  };
74 
75 #endif
unsigned short UINT16
Definition: basetypedefs.h:133
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
static const char * XML_ELEMENT_CONTAINER_NAME
CAListenerInterface & operator=(const CAListenerInterface &)
SINT32 getHostName(UINT8 *buff, UINT32 bufflen) const
CASocketAddr * getAddr() const
CAListenerInterface(const CAListenerInterface &l)
static const char * XML_ELEMENT_NAME
SINT32 toDOMElement(DOMElement *&elem, XERCES_CPP_NAMESPACE::DOMDocument *ownerDoc) const
NetworkType getType() const
static CAListenerInterface * getInstance(const DOMNode *node)
This is an abstract class for representing a socket address used in CASocket, CADatagramSocket and CA...
virtual CASocketAddr * clone() const =0
Creates a copy of the Address.
NetworkType
Definition: typedefs.hpp:30
UINT8 type
Definition: typedefs.hpp:1