|
Mixe for Privacy and Anonymity in the Internet
|
00001 /* 00002 * Copyright (c) 2006, The JAP-Team 00003 * All rights reserved. 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, 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 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * - Neither the name of the University of Technology Dresden, Germany nor 00015 * the names of its contributors may be used to endorse or promote 00016 * products derived from this software without specific prior written 00017 * permission. 00018 * 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00022 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00023 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE 00031 */ 00032 #ifndef __CA_CHAINTABLE__ 00033 #define __CA_CHAINTABLE__ 00034 #ifndef ONLY_LOCAL_PROXY 00035 #include "../CAMutex.hpp" 00036 #include "../CAThread.hpp" 00037 #include "CAChain.hpp" 00038 00039 struct t_chaintableEntry { 00040 t_chaintableEntry* rightEntry; 00041 t_chaintableEntry** rightEntryPointerOfLeftEntry; 00042 CAChain* chain; 00043 }; 00044 00045 struct t_chaintableIterator { 00046 t_chaintableEntry* currentEntry; 00047 bool removeEntry; 00048 UINT16 nextHashkey; 00049 }; 00050 00051 00052 class CAChainTable { 00053 public: 00054 CAChainTable(void); 00055 ~CAChainTable(void); 00056 CAChain* getEntry(UINT8* a_chainId); 00057 CAChain* createEntry(); 00058 void deleteEntry(UINT8* a_chainId); 00059 UINT32 getSize(); 00060 CAChain* getFirstEntry(); 00061 CAChain* getNextEntry(); 00062 #ifdef DELAY_CHANNELS 00063 void setDelayParameters(UINT32 a_initialBucketSize, UINT32 a_delayBucketGrow, UINT32 a_delayBucketGrowInterval); 00064 #endif 00065 00066 private: 00067 t_chaintableEntry** m_pChainTable; 00068 CAMutex* m_pMutex; 00069 UINT32 m_chaintableSize; 00070 t_chaintableIterator* m_pChaintableIterator; 00071 00072 t_chaintableEntry* getEntryInternal(UINT8* a_chainId); 00073 00074 #ifdef DELAY_CHANNELS 00075 CAMutex* m_pDelayBucketMutex; 00076 SINT32* m_pDelayBuckets; 00077 CAThread* m_pDelayBucketsLoop; 00078 volatile bool m_delayBucketsLoopRun; 00079 volatile UINT32 m_initialBucketSize; 00080 volatile UINT32 m_delayBucketGrow; 00081 volatile UINT32 m_delayBucketGrowInterval; 00082 00083 friend THREAD_RETURN lml_chaintableDelayBucketsLoop(void* a_param); 00084 #endif 00085 00086 void removeEntryInternal(t_chaintableEntry* a_entry); 00087 void getNextEntryInternal(t_chaintableIterator* a_iterator); 00088 00089 }; 00090 #endif //__CA_CHAINTABLE__ 00091 #endif //ONLY_LOCAL_PROXY
1.7.6.1