AddressMap Class Reference

#include <AddressMap.h>

List of all members.

Public Types

enum  AddressMapType { AddressMapAll, AddressMapConfig, AddressMapCache, AddressMapControl }

Public Member Functions

 AddressMap ()
void add (const QString &from, const QString &to, const QDateTime &expires)
void add (const QString &mapping)
bool isMapped (const QString &addr) const
QString mappedTo (const QString &addr) const
AddressMap reverse () const

Private Member Functions

bool isExpired (const AddressMapEntry &entry) const

Detailed Description

Definition at line 29 of file AddressMap.h.


Member Enumeration Documentation

Types of address mappings.

Enumerator:
AddressMapAll 

All address mapping types.

AddressMapConfig 

Address mappings set in the torrc.

AddressMapCache 

Address mappings cached by Tor.

AddressMapControl 

Address mappings set by a controller.

Definition at line 33 of file AddressMap.h.


Constructor & Destructor Documentation

AddressMap::AddressMap (  )  [inline]

Constructor. Creates an empty table for storing address mappinsgs.

Definition at line 41 of file AddressMap.h.


Member Function Documentation

void AddressMap::add ( const QString &  mapping  ) 

Adds a new address mapping or updates an existing one based on fields parsed from mapping.

Adds a new address mapping by parsing the fields in mapping, which should be formatted as follows:

Address SP Address SP Expiry Expiry = DQUOTE ISOTime DQUOTE / "NEVER"

Definition at line 47 of file AddressMap.cpp.

References add(), and DATE_FMT.

void AddressMap::add ( const QString &  from,
const QString &  to,
const QDateTime &  expires 
)

Adds a new address mapping or updates an existing one for the address specified by from. The mapping will remain valid until the date in expires.

Adds a new address mapping from the address from to the address to, that expires at expires.

Definition at line 30 of file AddressMap.cpp.

References DATE_FMT, and tc::debug().

Referenced by add(), NetViewer::addressMapped(), TorControl::getAddressMap(), and reverse().

bool AddressMap::isExpired ( const AddressMapEntry entry  )  const [private]

Returns true if entry is expired; false otherwise.

Definition at line 67 of file AddressMap.cpp.

Referenced by isMapped(), and mappedTo().

bool AddressMap::isMapped ( const QString &  addr  )  const

Returns true if the address map table contains a mapping for addr that is not expired.

Returns true if there exists a mapping for addr and that mapping is not expired.

Definition at line 77 of file AddressMap.cpp.

References isExpired().

Referenced by NetViewer::addStream().

QString AddressMap::mappedTo ( const QString &  addr  )  const

Returns the address to which addr is currently mapped. If there is no mapping for addr (or the mapping is expired), then an empty string is returned.

Definition at line 86 of file AddressMap.cpp.

References isExpired().

Referenced by NetViewer::addStream().

AddressMap AddressMap::reverse (  )  const

Returns the reverse of this address map.

Returns the reverse of this address map by swapping each address in the address map with its mapped address. The expiration times are unaltered.

Definition at line 95 of file AddressMap.cpp.

References add().

Referenced by NetViewer::loadAddressMap().


The documentation for this class was generated from the following files:
Generated on Mon Aug 30 22:58:56 2010 for Vidalia by  doxygen 1.6.3