Mixe for Privacy and Anonymity in the Internet
Defines | Functions
CAAccountingInstance.cpp File Reference
#include "StdAfx.h"
#include "CAAccountingInstance.hpp"
#include "CAAccountingControlChannel.hpp"
#include "CABase64.hpp"
#include "CAMsg.hpp"
#include "CAUtil.hpp"
#include "CASignature.hpp"
#include "CAThreadPool.hpp"
#include "CAXMLErrorMessage.hpp"
#include "Hashtable.hpp"
#include "packetintro.h"
#include "CALibProxytest.hpp"
Include dependency graph for CAAccountingInstance.cpp:

Go to the source code of this file.

Defines

#define JAP_DIGEST_LENGTH   28

Functions

bool testAndSetLoginOwner (struct AccountLoginHashEntry *loginEntry, 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, 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, fmHashTableEntry *ownerRef)
 test whether this entry is currently resrved by an ongoing login process.
bool testLoginEntryOwner_internal (struct AccountLoginHashEntry *loginEntry, fmHashTableEntry *ownerRef)

Define Documentation

#define JAP_DIGEST_LENGTH   28

Definition at line 49 of file CAAccountingInstance.cpp.


Function Documentation

bool isLoginOngoing ( struct AccountLoginHashEntry loginEntry,
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,
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,
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,
fmHashTableEntry ownerRef 
) [inline]

Definition at line 3848 of file CAAccountingInstance.cpp.

References AccountLoginHashEntry::ownerRef.

Referenced by resetLoginOngoing(), and testLoginEntryOwner().

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