Mixe for Privacy and Anonymity in the Internet
CAListenerInterface.hpp
Go to the documentation of this file.
00001 #ifndef _CALISTENERINTERFAC__
00002 #define _CALISTENERINTERFAC__
00003 #include "typedefs.hpp"
00004 #include "CASocketAddr.hpp"
00005 
00006 class CAListenerInterface
00007   {
00008     private:
00009       CAListenerInterface(void);
00010     
00011     public:     
00012       CAListenerInterface(const CAListenerInterface& l)//Copy constructor
00013         {
00014           m_Type=l.m_Type;
00015           m_bHidden=l.m_bHidden;
00016           m_bVirtual=l.m_bVirtual;
00017           if(l.m_pAddr!=NULL)
00018             m_pAddr=l.m_pAddr->clone();
00019           else
00020             m_pAddr=NULL;
00021           if(l.m_strHostname!=NULL)
00022             {
00023               UINT32 i=strlen((char*)l.m_strHostname);
00024               m_strHostname=new UINT8[i+1];
00025               memcpy(m_strHostname,l.m_strHostname,i);
00026               m_strHostname[i]=0;
00027             }
00028           else
00029             m_strHostname=NULL;
00030         }
00031       CAListenerInterface& operator=(const CAListenerInterface&); //Zuweisungsoperator
00032       ~CAListenerInterface(void);
00033 #ifndef ONLY_LOCAL_PROXY
00034       static CAListenerInterface* getInstance(const DOMNode* node);
00035       static CAListenerInterface** getInstance(DOMElement* a_elemListenerInterfaces, UINT32& r_length);
00036 #endif
00037       static CAListenerInterface* getInstance(NetworkType type,const UINT8* path); //constructs a Unix Domain ListenerInterface
00038       static CAListenerInterface* getInstance(NetworkType type,const UINT8* hostnameOrIP,UINT16 port); //constructs a TCP/IP ListenerInterface
00039 
00040     public:
00041       NetworkType getType() const
00042         {
00043           return m_Type;
00044         }
00045       SINT32 getHostName(UINT8* buff,UINT32 bufflen) const;
00046       
00047       CASocketAddr* getAddr() const
00048         {
00049           return m_pAddr->clone();
00050         }
00051       
00052       bool isHidden() const
00053         {
00054           return m_bHidden;
00055         }
00056       bool isVirtual() const
00057         {
00058           return m_bVirtual;
00059         }
00060       char* getHostname() { return (char*)m_strHostname; }
00061 #ifndef ONLY_LOCAL_PROXY
00062       SINT32 toDOMElement(DOMElement* & elem,XERCES_CPP_NAMESPACE::DOMDocument* ownerDoc) const;
00063       static const char* XML_ELEMENT_CONTAINER_NAME;
00064       static const char* XML_ELEMENT_NAME;
00065 #endif
00066 
00067   private:
00068       CASocketAddr* m_pAddr;
00069       UINT8*        m_strHostname; 
00070       NetworkType   m_Type;
00071       bool          m_bHidden;
00072       bool          m_bVirtual;
00073   };
00074 
00075 #endif