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:

Public Types

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

Public Member Functions

 WebviewServiceBrowseHandler (fawkes::Logger *logger, fawkes::NetworkService *webview_service)
 Constructor. More...
 
virtual void all_for_now ()
 All results have been retrieved. More...
 
virtual void cache_exhausted ()
 Cache exhausted. More...
 
virtual void browse_failed (const char *name, const char *type, const char *domain)
 Failed to browse for a given service. More...
 
virtual void service_added (const char *name, const char *type, const char *domain, const char *host_name, const char *interface, 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. More...
 
virtual void service_removed (const char *name, const char *type, const char *domain)
 A service has been removed from the network. More...
 
ServiceListservice_list ()
 Get the service list. More...
 
- Public Member Functions inherited from fawkes::ServiceBrowseHandler
virtual ~ServiceBrowseHandler ()
 Virtual destructor. More...
 

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

◆ ServiceList

A map of services.

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

Definition at line 64 of file service_browse_handler.h.

Constructor & Destructor Documentation

◆ WebviewServiceBrowseHandler()

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

◆ all_for_now()

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 58 of file service_browse_handler.cpp.

◆ browse_failed()

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 72 of file service_browse_handler.cpp.

◆ cache_exhausted()

void WebviewServiceBrowseHandler::cache_exhausted ( )
virtual

Cache exhausted.

Implements fawkes::ServiceBrowseHandler.

Definition at line 65 of file service_browse_handler.cpp.

◆ service_added()

void WebviewServiceBrowseHandler::service_added ( const char *  name,
const char *  type,
const char *  domain,
const char *  host_name,
const char *  interface,
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
interfacename of network interface to reach 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 82 of file service_browse_handler.cpp.

◆ service_list()

WebviewServiceBrowseHandler::ServiceList & WebviewServiceBrowseHandler::service_list ( )

Get the service list.

Returns
a list of services found on the network.

Definition at line 139 of file service_browse_handler.cpp.

Referenced by WebviewFooterGenerator::html_footer().

◆ service_removed()

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 122 of file service_browse_handler.cpp.


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