CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResolvConfEventHandler Class Reference

#include <resolv_conf_event_handler.h>

Inheritance diagram for ResolvConfEventHandler:
Collaboration diagram for ResolvConfEventHandler:

Public Types

typedef std::vector< std::pair
< int, std::string > > 
AddressList
 

Public Member Functions

 ResolvConfEventHandler (download::DownloadManager *download_manager, download::DownloadManager *external_download_manager)
 
virtual ~ResolvConfEventHandler ()
 
virtual bool Handle (const std::string &file_path, file_watcher::Event event, bool *clear_handler)
 
- Public Member Functions inherited from file_watcher::EventHandler
 EventHandler ()
 
virtual ~EventHandler ()
 

Static Public Member Functions

static void GetDnsAddresses (const std::string &resolv_file, AddressList *addresses)
 
static void SetDnsAddress (download::DownloadManager *download_manager, const AddressList &addresses)
 

Private Attributes

download::DownloadManagerdownload_manager_
 
download::DownloadManagerexternal_download_manager_
 

Detailed Description

Definition at line 21 of file resolv_conf_event_handler.h.

Member Typedef Documentation

typedef std::vector<std::pair<int, std::string> > ResolvConfEventHandler::AddressList

List of IP addresses

Each address is stored as a <TYPE, ADDRESS> pair, were TYPE is either 4 or 6.

Definition at line 29 of file resolv_conf_event_handler.h.

Constructor & Destructor Documentation

ResolvConfEventHandler::ResolvConfEventHandler ( download::DownloadManager download_manager,
download::DownloadManager external_download_manager 
)

Definition at line 40 of file resolv_conf_event_handler.cc.

ResolvConfEventHandler::~ResolvConfEventHandler ( )
virtual

Definition at line 46 of file resolv_conf_event_handler.cc.

Member Function Documentation

void ResolvConfEventHandler::GetDnsAddresses ( const std::string &  resolv_file,
AddressList addresses 
)
static

Returns any nameserver IP addresses from file

Reads a file, line by line. Returns the IP addresses corresponding to nameservers (i.e. from lines "nameserver <IP_ADDRESS>")

Definition at line 67 of file resolv_conf_event_handler.cc.

Referenced by Handle().

Here is the call graph for this function:

Here is the caller graph for this function:

bool ResolvConfEventHandler::Handle ( const std::string &  file_path,
file_watcher::Event  event,
bool *  clear_handler 
)
virtual

Handle function called per event

Parameters
file_path- the path of the file this event corresponds to
event- the type of event
clear_handler- (output) set this to true to have the event handler remove from the loop after this call

Should return false in case of failure.

Setting the clear_handler parameter to false means that the FileWatcher object will attempt to re-register the handler for the same file name in the case a file was delete - useful for continuously watching a file which may be deleted and recreated

Implements file_watcher::EventHandler.

Definition at line 48 of file resolv_conf_event_handler.cc.

Here is the call graph for this function:

void ResolvConfEventHandler::SetDnsAddress ( download::DownloadManager download_manager,
const AddressList addresses 
)
static

Definition at line 99 of file resolv_conf_event_handler.cc.

Referenced by Handle().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

download::DownloadManager* ResolvConfEventHandler::download_manager_
private

Definition at line 46 of file resolv_conf_event_handler.h.

Referenced by Handle().

download::DownloadManager* ResolvConfEventHandler::external_download_manager_
private

Definition at line 47 of file resolv_conf_event_handler.h.

Referenced by Handle().


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