30 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
66 for(
UINT32 i=0;i<=0xFFFF;i++)
100 memcpy(newEntry->
ip,ip,2);
104 UINT16 hashvalue=((ip[2]<<8)|ip[3]) % 0x10000;
116 if(memcmp(temp->
ip,ip,2)==0)
129 temp->
next = newEntry;
149 UINT16 hashvalue=((ip[2]<<8)|ip[3]) % 0x10000;
154 if(memcmp(entry->
ip,ip,2)==0) {
195 BEGIN_STACK(
"CATempIPBlockList::cleanupThreadMainLoop");
205 for(
UINT32 i=0;i<=0xFFFF;i++)
218 previous=entry->
next;
227 entry = previous->
next;
246 FINISH_STACK(
"CATempIPBlockList::cleanupThreadMainLoop");
struct _tempipblocklist_t TEMPIPBLOCKLISTENTRY
#define BEGIN_STACK(methodName)
#define FINISH_STACK(methodName)
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
SINT32 sSleep(UINT32 sec)
Sleeps sec Seconds.
#define THREAD_RETURN_SUCCESS
#define CLEANUP_THREAD_SLEEP_INTERVAL
static SINT32 printMsg(UINT32 typ, const char *format,...)
Writes a given message to the log.
The purpose of this class is storing the IPs of JAP users who tried to hack/attack the payment system...
UINT64 m_validTimeMillis
the time that each blocked IP should stay in the List
CAMutex * m_pMutex
Used for locking the datastructure to make it threadsafe.
CAThread * m_pCleanupThread
this thread cleans up the hashtable and removes old entries
PTEMPIPBLOCKLIST * m_hashTable
the buffer where the entries are stored
SINT32 insertIP(const UINT8 ip[4])
inserts an IP into the blocklist
volatile bool m_bRunCleanupThread
as long as true the clenaupthread does his job.
CATempIPBlockList(UINT64 validTimeMillis)
static THREAD_RETURN cleanupThreadMainLoop(void *param)
the cleanup thread main loop
SINT32 checkIP(const UINT8 ip[4])
check whether an IP is blocked
SINT32 start(void *param, bool bDaemon=false, bool bSilent=false)
Starts the execution of the main function of this thread.
SINT32 setMainLoop(THREAD_MAIN_TYP fnc)
Sets the main function which will be executed within this thread.
SINT32 join()
Waits for the main function to finish execution.
struct _tempipblocklist_t * next
Next element, NULL if element is the last one.
UINT64 validTimeMillis
Entry is valid until getCurrentTimeMillis() > validTimeMillis.
UINT8 ip[2]
First two Bytes of the IP-Address.