Mixe for Privacy and Anonymity in the Internet
Classes | Defines | Functions
CAAccountingInstance.hpp File Reference
#include "doxygen.h"
#include "CAFirstMix.hpp"
#include "CAFirstMixChannelList.hpp"
#include "CASymCipher.hpp"
#include "CAQueue.hpp"
#include "CAThread.hpp"
#include "CATempIPBlockList.hpp"
#include "CAThreadPool.hpp"
#include "CAAccountingDBInterface.hpp"
#include "CAAccountingBIInterface.hpp"
#include "CAAccountingControlChannel.hpp"
#include "CAAccountingSettleThread.hpp"
#include "CACmdLnOptions.hpp"
#include "Hashtable.hpp"
#include "CAMix.hpp"
#include "xml/DOM_Output.hpp"
#include "CAStatusManager.hpp"
Include dependency graph for CAAccountingInstance.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AccountLoginHashEntry
struct  SettleEntry
class  CAAccountingInstance
 This is the AI (accounting instance or abrechnungsinstanz in german) class. More...
struct  CAAccountingInstance::t_aiqueueitem

Defines

#define CHALLENGE_TIMEOUT   15
#define HARD_LIMIT_TIMEOUT   30
#define AUTH_TIMEOUT   15
#define CRITICAL_SUBSEQUENT_BI_CONN_ERRORS   5
#define CLIENT_VERSION_STR_LEN   20
#define PREPAID_PROTO_CLIENT_VERSION   "00.10.057"
#define CRITICAL_SETTLE_FLAGS   (AUTH_INVALID_ACCOUNT | AUTH_ACCOUNT_EMPTY | AUTH_BLOCKED | AUTH_UNKNOWN)

Functions

bool testAndSetLoginOwner (struct AccountLoginHashEntry *loginEntry, struct t_fmhashtableentry *ownerRef)
 if the current login entry isn't locked by a login thread the calling login-thread obtains ownership
bool resetLoginOngoing (struct AccountLoginHashEntry *loginEntry, struct t_fmhashtableentry *ownerRef)
 indicates that the ongoing login process for this entry is finished but doesn't reset ownership.
bool testLoginEntryOwner (struct AccountLoginHashEntry *loginEntry, fmHashTableEntry *ownerRef)
 tests whether the corresponding ownerEntry owns this loginEntry.
bool isLoginOngoing (struct AccountLoginHashEntry *loginEntry, struct t_fmhashtableentry *ownerRef)
 test whether this entry is currently resrved by an ongoing login process.
bool testLoginEntryOwner_internal (struct AccountLoginHashEntry *loginEntry, struct t_fmhashtableentry *ownerRef)

Define Documentation

#define AUTH_TIMEOUT   15

Definition at line 62 of file CAAccountingInstance.hpp.

#define CHALLENGE_TIMEOUT   15

Definition at line 60 of file CAAccountingInstance.hpp.

#define CLIENT_VERSION_STR_LEN   20

Definition at line 68 of file CAAccountingInstance.hpp.

Referenced by CAAccountingInstance::finishLoginProcess().

#define HARD_LIMIT_TIMEOUT   30
#define PREPAID_PROTO_CLIENT_VERSION   "00.10.057"

Function Documentation

bool isLoginOngoing ( struct AccountLoginHashEntry loginEntry,
struct t_fmhashtableentry ownerRef 
)

test whether this entry is currently resrved by an ongoing login process.

Definition at line 3839 of file CAAccountingInstance.cpp.

References CAMutex::lock(), AccountLoginHashEntry::loginOngoing, AccountLoginHashEntry::ownerLock, and CAMutex::unlock().

Referenced by CAAccountingInstance::cleanupTableEntry().

{
  bool ret;
  loginEntry->ownerLock->lock();
  ret = loginEntry->loginOngoing;
  loginEntry->ownerLock->unlock();
  return ret;
}

Here is the call graph for this function:

bool resetLoginOngoing ( struct AccountLoginHashEntry loginEntry,
struct t_fmhashtableentry ownerRef 
)

indicates that the ongoing login process for this entry is finished but doesn't reset ownership.

Definition at line 3806 of file CAAccountingInstance.cpp.

References CAMutex::lock(), AccountLoginHashEntry::loginOngoing, AccountLoginHashEntry::ownerLock, testLoginEntryOwner_internal(), and CAMutex::unlock().

Referenced by CAAccountingInstance::unlockLogin().

{
  bool success = false;
  loginEntry->ownerLock->lock();
  success = testLoginEntryOwner_internal(loginEntry, ownerRef);
  if(success)
  {
    loginEntry->loginOngoing = false;
    //CAMsg::printMsg(LOG_DEBUG,"resetted for %x.\n", loginEntry->ownerRef);
  }
  /*else
  {
    CAMsg::printMsg(LOG_DEBUG,"not resetted for %x.\n", loginEntry->ownerRef);
  }*/
  loginEntry->ownerLock->unlock();
  return success;
}

Here is the call graph for this function:

bool testAndSetLoginOwner ( struct AccountLoginHashEntry loginEntry,
struct t_fmhashtableentry ownerRef 
)

if the current login entry isn't locked by a login thread the calling login-thread obtains ownership

Definition at line 3763 of file CAAccountingInstance.cpp.

References CAMutex::lock(), AccountLoginHashEntry::loginOngoing, AccountLoginHashEntry::ownerLock, AccountLoginHashEntry::ownerRef, and CAMutex::unlock().

Referenced by CAAccountingInstance::handleChallengeResponse_internal().

{
  bool success = false;
  loginEntry->ownerLock->lock();
  success = !loginEntry->loginOngoing;
  if(success)
  {
    //CAMsg::printMsg(LOG_DEBUG,"login free, owner %x \n", loginEntry->ownerRef);
    loginEntry->ownerRef = ownerRef;
    loginEntry->loginOngoing = true;
  }
  /*else
  {
    CAMsg::printMsg(LOG_DEBUG,"login ongoing, owner %x \n", loginEntry->ownerRef);
  }*/
  loginEntry->ownerLock->unlock();
  return success;
}

Here is the call graph for this function:

bool testLoginEntryOwner ( struct AccountLoginHashEntry loginEntry,
fmHashTableEntry ownerRef 
)

tests whether the corresponding ownerEntry owns this loginEntry.

Definition at line 3827 of file CAAccountingInstance.cpp.

References CAMutex::lock(), AccountLoginHashEntry::ownerLock, testLoginEntryOwner_internal(), and CAMutex::unlock().

Referenced by CAAccountingInstance::cleanupTableEntry().

{
  bool ret;
  loginEntry->ownerLock->lock();
  ret = testLoginEntryOwner_internal(loginEntry, ownerRef);
  loginEntry->ownerLock->unlock();
  return ret;
}

Here is the call graph for this function:

bool testLoginEntryOwner_internal ( struct AccountLoginHashEntry loginEntry,
struct t_fmhashtableentry ownerRef 
) [inline]

Definition at line 3848 of file CAAccountingInstance.cpp.

References AccountLoginHashEntry::ownerRef.

Referenced by resetLoginOngoing(), and testLoginEntryOwner().

{
  return (loginEntry->ownerRef == ownerRef);
}