Vidalia  0.3.1
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
GeoIpResolver Class Reference

#include <GeoIpResolver.h>

Inheritance diagram for GeoIpResolver:

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 35 of file GeoIpResolver.h.

Constructor & Destructor Documentation

GeoIpResolver::GeoIpResolver ( QObject *  parent = 0)

Default constructor.

Definition at line 23 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 78 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 58 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 45 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 29 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 39 of file GeoIpResolver.cpp.

References _useLocalDatabase.

Referenced by NetViewer::setupGeoIpResolver().

Member Data Documentation

bool GeoIpResolver::_useLocalDatabase
private

Definition at line 84 of file GeoIpResolver.h.

Referenced by resolve(), and setUseLocalDatabase().


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