|
Mixe for Privacy and Anonymity in the Internet
|
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 __CAMIDDLEMIX__ 00029 #define __CAMIDDLEMIX__ 00030 00031 #include "CAMix.hpp" 00032 #include "CAMuxSocket.hpp" 00033 #include "CAASymCipher.hpp" 00034 #include "CAMiddleMixChannelList.hpp" 00035 //#include "CASignature.hpp" 00036 #include "CAInfoService.hpp" 00037 #include "CAMixWithReplayDB.hpp" 00038 00039 class CAMiddleMix:public 00040 #ifdef REPLAY_DETECTION 00041 CAMixWithReplayDB 00042 #else 00043 CAMix 00044 #endif 00045 { 00046 public: 00047 CAMiddleMix() 00048 { 00049 m_pMiddleMixChannelList=NULL; 00050 m_pMuxOut=NULL;m_pMuxIn=NULL;m_pRSA=NULL; 00051 //m_pSignature=NULL; 00052 m_pMultiSignature=NULL; 00053 m_pInfoService=NULL; 00054 m_pQueueSendToMixBefore=m_pQueueSendToMixAfter=NULL; 00055 #ifdef DYNAMIC_MIX 00056 m_bBreakNeeded = false; 00057 #endif 00058 } 00059 virtual ~CAMiddleMix(){clean();}; 00060 tMixType getType() const 00061 { 00062 return CAMix::MIDDLE_MIX; 00063 } 00064 friend THREAD_RETURN mm_loopSendToMixBefore(void*); 00065 friend THREAD_RETURN mm_loopSendToMixAfter(void*); 00066 friend THREAD_RETURN mm_loopReadFromMixBefore(void*); 00067 friend THREAD_RETURN mm_loopReadFromMixAfter(void*); 00068 friend THREAD_RETURN mm_loopDownStream(void *); 00069 00070 private: 00071 SINT32 loop(); 00072 SINT32 init(); 00073 SINT32 initOnce(); 00074 SINT32 clean(); 00075 SINT32 connectToNextMix(CASocketAddr* a_pAddrNext); 00076 #ifdef DYNAMIC_MIX 00077 bool m_bBreakNeeded; 00078 #endif 00079 00085 virtual SINT32 initMixCascadeInfo(DOMElement* & ) 00086 { 00087 return E_SUCCESS; 00088 } 00089 00090 virtual SINT32 processKeyExchange(); 00091 00092 private: 00093 CAMuxSocket* m_pMuxIn; 00094 CAMuxSocket* m_pMuxOut; 00095 CAASymCipher* m_pRSA; 00096 00097 //CASignature* m_pSignature; 00098 volatile bool m_bRun; 00099 CAMiddleMixChannelList* m_pMiddleMixChannelList; 00100 //CAInfoService* m_pInfoService; 00101 // friend THREAD_RETURN mm_loopDownStream(void *p); 00102 protected: 00103 CAQueue* m_pQueueSendToMixBefore; 00104 CAQueue* m_pQueueSendToMixAfter; 00105 00106 UINT32 m_u32KeepAliveRecvInterval2; 00107 UINT32 m_u32KeepAliveSendInterval2; 00108 00109 #ifdef DYNAMIC_MIX 00110 void stopCascade() 00111 { 00112 m_bRun = false; 00113 } 00114 #endif 00115 }; 00116 00117 #ifdef LOG_CRIME 00118 static void crimeSurveillanceUpstream(MIXPACKET *pMixPacket, HCHANNEL prevMixChannel); 00119 #endif 00120 00121 #endif
1.7.6.1