Vidalia 0.2.10
Public Member Functions | Protected Member Functions | Private Attributes

GeoIpResolver Class Reference

#include <GeoIpResolver.h>

List of all members.

Public Member Functions

 GeoIpResolver (QObject *parent=0)
bool setLocalDatabase (const QString &databaseFile)
void setUseLocalDatabase (bool useLocalDatabase)
GeoIpRecord resolve (const QHostAddress &ip)

Protected Member Functions

GeoIpRecord resolveUsingTor (const QHostAddress &ip)
GeoIpRecord resolveUsingLocalDatabase (const QHostAddress &ip)

Private Attributes

bool _useLocalDatabase

Detailed Description

Definition at line 36 of file GeoIpResolver.h.


Constructor & Destructor Documentation

GeoIpResolver::GeoIpResolver ( QObject *  parent = 0)

Default constructor.

Definition at line 24 of file GeoIpResolver.cpp.


Member Function Documentation

GeoIpRecord GeoIpResolver::resolve ( const QHostAddress &  ip)

Resolves a single IP to a geographic location and returns the result on success. On failure, this returns a default-constructed GeoIpRecord object.

Resolves a single IP to a geographic location.

Definition at line 79 of file GeoIpResolver.cpp.

References _useLocalDatabase, resolveUsingLocalDatabase(), and resolveUsingTor().

Referenced by NetViewer::addRouter().

GeoIpRecord GeoIpResolver::resolveUsingLocalDatabase ( const QHostAddress &  ip) [protected]

Maps ip to an approximate geographic location using a local GeoIP database and returns the result on success.

See also:
setLocalDatabase()
setUseLocalDatabase()

Definition at line 59 of file GeoIpResolver.cpp.

References GeoIpDatabase::CityDatabase, CountryInfo::countryLocation(), and CountryInfo::countryName().

Referenced by resolve().

GeoIpRecord GeoIpResolver::resolveUsingTor ( const QHostAddress &  ip) [protected]

Maps ip to a country code using Tor, and then maps the country code to a geographic location using the built-in country-to-coordinate database.

Definition at line 46 of file GeoIpResolver.cpp.

References CountryInfo::countryLocation(), CountryInfo::countryName(), TorControl::ipToCountry(), and Vidalia::torControl().

Referenced by resolve().

bool GeoIpResolver::setLocalDatabase ( const QString &  databaseFile)

Sets the local database file to databaseFile. Returns true if databaseFile could be opened for reading. Otherwise, returns false.

See also:
setUseLocalDatabase()

Definition at line 30 of file GeoIpResolver.cpp.

Referenced by NetViewer::setupGeoIpResolver().

void GeoIpResolver::setUseLocalDatabase ( bool  useLocalDatabase)

Enables or disables the use of a local GeoIP database, depending on the value of useLocalDatabase.

See also:
setLocalDatabase()

Definition at line 40 of file GeoIpResolver.cpp.

References _useLocalDatabase.

Referenced by NetViewer::setupGeoIpResolver().


Member Data Documentation

Definition at line 85 of file GeoIpResolver.h.

Referenced by resolve(), and setUseLocalDatabase().


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