Mixe for Privacy and Anonymity in the Internet
CAMix.hpp
Go to the documentation of this file.
00001 /*
00002  Copyright (c) 2000, The JAP-Team
00003  All rights reserved.
00004  Redistribution and use in source and binary forms, with or without modification,
00005  are permitted provided that the following conditions are met:
00006 
00007  - Redistributions of source code must retain the above copyright notice,
00008  this list of conditions and the following disclaimer.
00009 
00010  - Redistributions in binary form must reproduce the above copyright notice,
00011  this list of conditions and the following disclaimer in the documentation and/or
00012  other materials provided with the distribution.
00013 
00014  - Neither the name of the University of Technology Dresden, Germany nor the names of its contributors
00015  may be used to endorse or promote products derived from this software without specific
00016  prior written permission.
00017 
00018 
00019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
00020  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00021  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
00022  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00024  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00025  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00027  */
00028 #ifndef __CAMIX__
00029 #define __CAMIX__
00030 
00031 #ifndef ONLY_LOCAL_PROXY
00032 
00033 class CAMultiSignature;
00034 class CAInfoService;
00035 //class DOM_Element;
00036 class CAControlChannelDispatcher;
00037 
00038 #ifdef DATA_RETENTION_LOG
00039 #include "CADataRetentionLog.hpp"
00040 #endif
00041 
00042 #define KEYINFO_NODE_TNC_INFOS "TermsAndConditionsInfos"
00043 #define KEYINFO_NODE_TNC_INFO "TermsAndConditionsInfo"
00044 
00045 #define KEYINFO_NODE_EXTENSIONS "Extensions"
00046 #define KEYINFO_NODE_TNC_EXTENSION "TermsAndConditionsExtension"
00047 
00048 class CAMix
00049   {
00050   public:
00051     enum tMixType
00052       {
00053       FIRST_MIX,
00054       MIDDLE_MIX,
00055       LAST_MIX,
00056       JAP
00057       };
00058 
00059     static const UINT32 TIMEOUT_MIX_CONNECTION_ESTABLISHEMENT;
00060 
00061   public:
00062     CAMix();
00063     virtual ~CAMix();
00064     SINT32 start();
00065     virtual SINT32 reconfigure()
00066       {
00067         return E_SUCCESS;
00068       }
00069     virtual tMixType getType() const =0;
00070 
00071     virtual void shutDown()
00072       {
00073         m_bShutDown = true;
00074       }
00075 
00076     virtual bool isShutDown()
00077       {
00078         return m_bShutDown;
00079       }
00080 
00081 #ifdef DYNAMIC_MIX
00082     void setReconfiguring(bool a_val)
00083       {
00084         m_bReconfiguring = a_val;
00085       }
00086     SINT32 dynaReconfigure(bool a_bChangeMixType);
00087 #endif
00088 
00095     SINT32 getMixCascadeInfo(XERCES_CPP_NAMESPACE::DOMDocument* & docMixCascadeInfo)
00096       {
00097         if (m_docMixCascadeInfo != NULL)
00098           {
00099             docMixCascadeInfo = m_docMixCascadeInfo;
00100             return E_SUCCESS;
00101           }
00102         else
00103           {
00104             return E_UNKNOWN;
00105           }
00106       }
00107 
00108     // added by ronin <ronin2@web.de>
00109     bool acceptsReconfiguration()
00110       {
00111         return m_acceptReconfiguration;
00112       }
00113 
00114     CAControlChannelDispatcher* getDownstreamControlChannelDispatcher() const
00115       {
00116         return m_pMuxInControlChannelDispatcher;
00117       }
00118 
00119     CAControlChannelDispatcher* getUpstreamControlChannelDispatcher() const
00120       {
00121         return m_pMuxOutControlChannelDispatcher;
00122       }
00123 
00124     UINT32 getLastConnectionTime()
00125       {
00126         return m_lLastConnectionTime;
00127       }
00128 
00129     bool isConnected()
00130       {
00131         return m_bConnected;
00132       }
00133   protected:
00134 #ifdef DYNAMIC_MIX
00135     virtual void stopCascade() =0;
00136     bool m_bLoop;
00137     bool m_bCascadeEstablished;
00138     bool m_bReconfigured;
00139 #endif
00140     bool m_bReconfiguring;
00141     volatile bool m_bShutDown;
00142     virtual SINT32 clean()=0;
00143     virtual SINT32 initOnce();
00144     virtual SINT32 init()=0;
00145     virtual SINT32 loop()=0;
00146 
00147     SINT32 checkCompatibility(DOMNode* a_parent, const char* a_mixPosition);
00148     SINT32 appendCompatibilityInfo(DOMNode* a_parent);
00149     SINT32 addMixInfo(DOMNode* a_element, bool a_bForceFirstNode);
00150 
00157     DOMNode *appendTermsAndConditionsExtension(XERCES_CPP_NAMESPACE::DOMDocument *doc,
00158         DOMElement *root);
00159 
00164     DOMNode *termsAndConditionsInfoNode(XERCES_CPP_NAMESPACE::DOMDocument *ownerDoc);
00165 
00166     // added by ronin <ronin2@web.de>
00167     virtual SINT32 processKeyExchange()=0;
00168     /*{
00169      return E_SUCCESS;
00170      }*/
00171 
00172     // added by ronin <ronin2@web.de>
00173     virtual SINT32 initMixCascadeInfo(DOMElement* elemMixes);
00174 
00175     SINT32 signXML(DOMNode* a_element);
00176 
00177     //CASignature* m_pSignature;
00178     CAMultiSignature* m_pMultiSignature;
00179     CAInfoService* m_pInfoService;
00180 
00181     UINT32 m_u32KeepAliveRecvInterval;
00182     UINT32 m_u32KeepAliveSendInterval;
00183 
00184     bool m_acceptReconfiguration;
00185     volatile bool m_bConnected;
00186     volatile UINT32 m_lLastConnectionTime;
00187     // added by ronin <ronin2@web.de>
00188     XERCES_CPP_NAMESPACE::DOMDocument* m_docMixCascadeInfo;
00189 
00190     CAControlChannelDispatcher* m_pMuxOutControlChannelDispatcher;
00191     CAControlChannelDispatcher* m_pMuxInControlChannelDispatcher;
00192 
00193 #ifdef DATA_RETENTION_LOG
00194     CADataRetentionLog* m_pDataRetentionLog;
00195 #endif
00196 
00197   private:
00198     // added by ronin <ronin2@web.de>
00199     bool needAutoConfig();
00200   };
00201 #endif
00202 #endif //ONLY_LOCAL_PROXY