29 #ifndef __CAFIRSTMIX__
30 #define __CAFIRSTMIX__
32 #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_FIRST_MIX
52 #ifdef REPLAY_DETECTION
59 #define TNC_SREQUEST "TermsAndConditionsRequest"
60 #define TNC_RESPONSE "TermsAndConditionsResponse"
61 #define TNC_SINTERRUPT "TermsAndConditionsInterrupt"
62 #define TNC_REQ_TRANSLATION "Translation"
63 #define TNC_RESOURCES "Resources"
64 #define TNC_RESOURCE_TEMPLATE "Template"
65 #define TNC_TEMPLATE_ROOT_ELEMENT "TermsAndConditionsTemplate"
66 #define TNC_RESOURCE_CUSTOMIZED_SECT "CustomizedSections"
68 #define TNC_RESPONSE_INVALID_REQUEST "InvalidTermsAndConditionsRequest"
69 #define TNC_CONFIRM_REQ "TermsAndConditionsConfirm"
138 pNewEntry->
pQueue = pQueue;
148 #ifndef LOCK_FREE_LIST
152 while (pEntry != NULL)
157 #ifndef LOCK_FREE_LIST
164 #ifndef LOCK_FREE_LIST
175 while (pEntry != NULL)
179 if (pLastEntry != NULL)
199 UINT32 nrChannels = 10000;
200 UINT32 nrAccess = 10000000;
202 printf(
"%u Channel test - %u accesses\n",nrChannels,nrAccess);
203 for (
UINT32 i = 0; i < nrChannels; i++)
206 add(pChannels[i], NULL);
211 for (
UINT32 i = 0; i < nrAccess; i++)
221 printf(
"Duration: %u ms\n",
diff64(endTime, startTime));
230 #ifdef REPLAY_DETECTION
247 nrOfOpenedChannels = 0;
248 currentOpenedChannels = 0;
260 #ifndef MULTI_THREADED_PACKET_PROCESSING
281 #ifdef LOG_PACKET_TIMES
282 m_pLogPacketStats=NULL;
292 m_bBreakNeeded =
false;
392 #ifdef REPLAY_DETECTION
397 #ifndef COUNTRY_STATS
412 #ifndef COUNTRY_STATS
450 #ifdef LOG_PACKET_TIMES
451 CALogPacketStats* m_pLogPacketStats;
463 #ifndef MULTI_THREADED_PACKET_PROCESSING
522 UINT32 nrOfOpenedChannels;
523 UINT32 currentOpenedChannels;
544 #ifdef REPLAY_DETECTION
struct t_FirstMixChannelToQueueList_entry tFirstMixChannelToQueueListEntry
THREAD_RETURN fm_loopSendToMix(void *)
How to end this thread: 0.
THREAD_RETURN fm_loopDoUserLogin(void *param)
THREAD_RETURN fm_loopLog(void *)
THREAD_RETURN iplist_loopDoLogCountries(void *param)
THREAD_RETURN fm_loopAcceptUsers(void *)
THREAD_RETURN fm_loopReadFromMix(void *)
THREAD_RETURN fm_loopReadFromUsers(void *)
SINT32 getcurrentTimeMillis(UINT64 &u64Time)
Gets the current Systemtime in milli seconds.
SINT32 getRandom(UINT32 *val)
Gets 32 random bits.
UINT32 diff64(const UINT64 &bigop, const UINT64 &smallop)
Data structure that stores all information about the currently open Mix channels.
SINT32 add(HCHANNEL channel, CAQueue *pQueue)
CAFirstMixChannelToQueueList()
tFirstMixChannelToQueueListEntry ** m_pHeads
CAQueue * get(HCHANNEL channel)
SINT32 removeChannel(HCHANNEL channel)
CAThread * m_pthreadReadFromMix
CASocket ** m_arrSocketsIn
SINT32 updateCountryStats(const UINT8 ip[4], UINT32 a_countryID, bool bRemove)
Update the statisitics of the countries users come from.
const XMLCh * TNC_CONFIRM
friend THREAD_RETURN fm_loopSendToMix(void *)
How to end this thread: 0.
UINT32 m_nrOfTermsAndConditionsTemplates
virtual SINT32 processKeyExchange()
SINT32 doUserLogin(CAMuxSocket *pNewUSer, UINT8 perrIP[4])
tMixParameters * getMixParameters()
Returns the ordered list of the mix parameters from the first mix to the last mix.
CAMutex * getLoginMutex()
termsAndConditionMixAnswer_t * handleTermsAndConditionsLogin(XERCES_CPP_NAMESPACE::DOMDocument *request)
friend THREAD_RETURN fm_loopDoUserLogin(void *param)
SINT32 getLevel(SINT32 *puser, SINT32 *prisk, SINT32 *ptraffic)
SINT32 getMixedPackets(UINT64 &ppackets)
SINT32 initCountryStats(char *db_host, char *db_user, char *db_passwd)
CAMutex * m_pmutexNewConnections
tMixParameters * m_arMixParameters
CAThread * m_pthreadAcceptUsers
CAQueue * m_pQueueSendToMix
DOMNode * getTermsAndConditionsTemplate(UINT8 *templateRefID)
volatile UINT32 m_newConnections
friend THREAD_RETURN fm_loopLog(void *)
friend THREAD_RETURN iplist_loopDoLogCountries(void *param)
SINT32 incUsers(LP_fmHashTableEntry pHashEntry)
volatile bool m_bRunLogCountries
CASocketGroupEpoll * m_psocketgroupUsersWrite
UINT32 m_nrOfTermsAndConditionsDefs
XERCES_CPP_NAMESPACE::DOMDocument * m_templatesOwner
static const UINT32 MAX_CONCURRENT_NEW_CONNECTIONS
CAThread * m_threadLogLoop
const XMLCh * TNC_INTERRUPT
CAThread * m_pthreadSendToMix
UINT64 m_u64LastTimestampReceived
CASocketGroupEpoll * m_psocketgroupUsersRead
CATempIPBlockList * m_pIPBlockList
tUINT32withLock * m_PacketsPerCountryOUT
SINT32 doUserLogin_internal(CAMuxSocket *pNewUSer, UINT8 perrIP[4])
Sends and receives all data neccessary for a User to "login".
CAMutex * m_pmutexMixedPackets
friend THREAD_RETURN fm_loopAcceptUsers(void *)
SINT32 setMixParameters(const tMixParameters ¶ms)
Sets the parameters for the mix specified in the params.m_strMixID field.
friend THREAD_RETURN fm_loopReadFromMix(void *)
SINT32 sendReplayTimestampRequestsToAllMixes()
virtual SINT32 initOnce()
SINT32 isAllowedToPassRestrictions(CASocket *pNewMuxSocket)
SINT32 decUsers(LP_fmHashTableEntry pHashEntry)
CAFirstMixChannelList * m_pChannelList
TermsAndConditions * getTermsAndConditions(const UINT8 *opSki)
tUINT32withLock * m_PacketsPerCountryIN
SINT32 handleTermsAndConditionsExtension(DOMElement *extensionRoot)
bool forceKickout(fmHashTableEntry *pHashTableEntry, const XERCES_CPP_NAMESPACE::DOMDocument *pErrDoc=NULL)
CAThreadPool * m_pthreadsLogin
TermsAndConditions ** m_tnCDefs
const XMLCh * TNC_REQUEST
CAQueue * m_pQueueReadFromMix
volatile UINT32 * m_CountryStats
SINT32 initMixParameters(DOMElement *elemMixes)
Initialises the MixParameters info for each mix form the <Mixes> element received from the second mix...
CAMutex * m_pmutexLoginThreads
SINT32 deleteCountryStats()
SINT32 connectToNextMix(CASocketAddr *a_pAddrNext)
SINT32 handleKeyInfoExtensions(DOMElement *root)
XERCES_CPP_NAMESPACE::DOMDocument * m_docMixCascadeInfo
The purpose of this class is to store a list of IP-Addresses.
CAInfoService * m_pInfoService
This class (interface) adds the functionality used by last and middle mixes to detecte replays.
This is a simple FIFO-Queue.
This is an abstract class for representing a socket address used in CASocket, CADatagramSocket and CA...
The purpose of this class is storing the IPs of JAP users who tried to hack/attack the payment system...
t_FirstMixChannelToQueueList_entry * next