#include <addressmap.h>
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 |
Definition at line 40 of file addressmap.h.
Types of address mappings.
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 44 of file addressmap.h.
AddressMap::AddressMap | ( | ) | [inline] |
Constructor. Creates an empty table for storing address mappinsgs.
Definition at line 52 of file addressmap.h.
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 40 of file addressmap.cpp.
References DATE_FMT, and vInfo.
Referenced by NetViewer::customEvent(), TorControl::getAddressMap(), and reverse().
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 55 of file addressmap.cpp.
References DATE_FMT.
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 79 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.
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 88 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 97 of file addressmap.cpp.
References add().
Referenced by NetViewer::loadAddressMap().
bool AddressMap::isExpired | ( | addr_map_entry_t | entry | ) | const [private] |
Returns true if entry is expired; false otherwise.
Definition at line 69 of file addressmap.cpp.
Referenced by isMapped(), and mappedTo().