|
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 00029 #ifndef CATEMPIPBLOCKLIST_HPP 00030 #define CATEMPIPBLOCKLIST_HPP 00031 00032 #ifndef ONLY_LOCAL_PROXY 00033 00034 #include "CAThread.hpp" 00035 #include "CAMutex.hpp" 00036 00037 struct _tempipblocklist_t 00038 { 00040 struct _tempipblocklist_t* next; 00041 00043 UINT64 validTimeMillis; 00045 UINT8 ip[2]; 00046 }; 00047 00048 typedef struct _tempipblocklist_t TEMPIPBLOCKLISTENTRY; 00049 typedef struct _tempipblocklist_t* PTEMPIPBLOCKLIST; 00050 00061 class CATempIPBlockList 00062 { 00063 public: 00064 CATempIPBlockList(UINT64 validTimeMillis); 00065 00066 ~CATempIPBlockList(); 00067 00074 SINT32 insertIP(const UINT8 ip[4]); 00075 00082 SINT32 checkIP(const UINT8 ip[4]); 00083 00088 void setValidTimeMillis(UINT64 millis); 00089 00090 UINT32 count() 00091 { 00092 return m_iEntries; 00093 } 00094 00095 private: 00097 volatile bool m_bRunCleanupThread; 00098 00100 CAThread * m_pCleanupThread; 00101 00103 static THREAD_RETURN cleanupThreadMainLoop(void *param); 00104 00106 UINT64 m_validTimeMillis; 00107 00109 PTEMPIPBLOCKLIST* m_hashTable; 00110 00112 CAMutex * m_pMutex; 00113 00114 UINT32 m_iEntries; 00115 }; 00116 00117 #endif //ONLY_LOCAL_PROXY 00118 #endif
1.7.6.1