AddressMap Class Reference

#include <addressmap.h>

List of all members.

Public Types

enum  AddressMapType { AddressMapAll, AddressMapConfig, AddressMapCache, AddressMapControl }

Public Member Functions

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

Private Member Functions

bool isExpired (addr_map_entry_t 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 ( 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 44 of file addressmap.cpp.

References add(), and DATE_FMT.

void AddressMap::add ( QString  from,
QString  to,
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 28 of file addressmap.cpp.

References DATE_FMT, and tc::debug().

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

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

Returns true if entry is expired; false otherwise.

Definition at line 64 of file addressmap.cpp.

Referenced by isMapped(), and mappedTo().

bool AddressMap::isMapped ( 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 74 of file addressmap.cpp.

References isExpired().

Referenced by NetViewer::addStream().

QString AddressMap::mappedTo ( 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 83 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 92 of file addressmap.cpp.

References add().

Referenced by NetViewer::loadAddressMap().


The documentation for this class was generated from the following files:

Generated on 28 Dec 2009 for Vidalia by  doxygen 1.6.1