Fawkes API Fawkes Development Version

WebviewServiceBrowseHandler Class Reference

Browse handler to detect other Webview instances on the network. More...

#include "service_browse_handler.h"

Inheritance diagram for WebviewServiceBrowseHandler:

List of all members.

Public Types

typedef std::map< std::string,
fawkes::NetworkService * > 
ServiceList
 A map of services.

Public Member Functions

 WebviewServiceBrowseHandler (fawkes::Logger *logger, fawkes::NetworkService *webview_service)
 Constructor.
virtual void all_for_now ()
 All results have been retrieved.
virtual void cache_exhausted ()
 Cache exhausted.
virtual void browse_failed (const char *name, const char *type, const char *domain)
 Failed to browse for a given service.
virtual void service_added (const char *name, const char *type, const char *domain, const char *host_name, const struct sockaddr *addr, const socklen_t addr_size, uint16_t port, std::list< std::string > &txt, int flags)
 A service has been announced on the network.
virtual void service_removed (const char *name, const char *type, const char *domain)
 A service has been removed from the network.
ServiceListservice_list ()
 Get the service list.

Detailed Description

Browse handler to detect other Webview instances on the network.

This browse handler is used to compile a list of other webview instances on the local network. It is used to show a list of hosts in the footer of webview pages.

Author:
Tim Niemueller

Definition at line 36 of file service_browse_handler.h.


Member Typedef Documentation

A map of services.

Maps service names to NetworkService instances describing the service in more detail.

Definition at line 62 of file service_browse_handler.h.


Constructor & Destructor Documentation

WebviewServiceBrowseHandler::WebviewServiceBrowseHandler ( fawkes::Logger logger,
fawkes::NetworkService webview_service 
)

Constructor.

Parameters:
loggerlogger for informational logging
webview_serviceservice of our own service as it was announced on the network, used to filter it out from the list of services.

Definition at line 42 of file service_browse_handler.cpp.


Member Function Documentation

void WebviewServiceBrowseHandler::all_for_now ( ) [virtual]

All results have been retrieved.

If you read the DNS-SD specs you will see that there is no explicit "not existent" or "end of records" message - it cannot be. But after some time it is assumed that there are no more records. If that is the case this method is called.

Implements fawkes::ServiceBrowseHandler.

Definition at line 51 of file service_browse_handler.cpp.

void WebviewServiceBrowseHandler::browse_failed ( const char *  name,
const char *  type,
const char *  domain 
) [virtual]

Failed to browse for a given service.

Parameters:
namename of the service
typetype of the service
domaindomain of the service

Implements fawkes::ServiceBrowseHandler.

Definition at line 65 of file service_browse_handler.cpp.

void WebviewServiceBrowseHandler::cache_exhausted ( ) [virtual]

Cache exhausted.

Implements fawkes::ServiceBrowseHandler.

Definition at line 58 of file service_browse_handler.cpp.

void WebviewServiceBrowseHandler::service_added ( const char *  name,
const char *  type,
const char *  domain,
const char *  host_name,
const struct sockaddr *  addr,
const socklen_t  addr_size,
uint16_t  port,
std::list< std::string > &  txt,
int  flags 
) [virtual]

A service has been announced on the network.

Parameters:
namename of the service
typetype of the service
domaindomain of the service
host_namename of the host that provides the service
addrpointer to sockaddr struct of appropriate type for address
addr_sizesize of addr struct
portport of the service
txtlist of txt records.
flagsextra flags, see Avahi documentation

Implements fawkes::ServiceBrowseHandler.

Definition at line 75 of file service_browse_handler.cpp.

WebviewServiceBrowseHandler::ServiceList & WebviewServiceBrowseHandler::service_list ( )

Get the service list.

Returns:
a list of services found on the network.

Definition at line 131 of file service_browse_handler.cpp.

Referenced by WebviewFooterGenerator::html_footer().

void WebviewServiceBrowseHandler::service_removed ( const char *  name,
const char *  type,
const char *  domain 
) [virtual]

A service has been removed from the network.

Parameters:
namename of the service
typetype of the service
domaindomain of the service

Implements fawkes::ServiceBrowseHandler.

Definition at line 114 of file service_browse_handler.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends