Browse handler to detect other Webview instances on the network. More...
#include "service_browse_handler.h"
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. | |
ServiceList & | service_list () |
Get the service list. |
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.
Definition at line 36 of file service_browse_handler.h.
typedef std::map<std::string, fawkes::NetworkService *> WebviewServiceBrowseHandler::ServiceList |
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.
WebviewServiceBrowseHandler::WebviewServiceBrowseHandler | ( | fawkes::Logger * | logger, | |
fawkes::NetworkService * | webview_service | |||
) |
Constructor.
logger | logger for informational logging | |
webview_service | service 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.
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.
name | name of the service | |
type | type of the service | |
domain | domain of the service |
Implements fawkes::ServiceBrowseHandler.
Definition at line 65 of file service_browse_handler.cpp.
References fawkes::Logger::log_warn().
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.
name | name of the service | |
type | type of the service | |
domain | domain of the service | |
host_name | name of the host that provides the service | |
addr | pointer to sockaddr struct of appropriate type for address | |
addr_size | size of addr struct | |
port | port of the service | |
txt | list of txt records. | |
flags | extra flags, see Avahi documentation |
Implements fawkes::ServiceBrowseHandler.
Definition at line 75 of file service_browse_handler.cpp.
References fawkes::Logger::log_debug().
WebviewServiceBrowseHandler::ServiceList & WebviewServiceBrowseHandler::service_list | ( | ) |
Get the service list.
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.
name | name of the service | |
type | type of the service | |
domain | domain of the service |
Implements fawkes::ServiceBrowseHandler.
Definition at line 114 of file service_browse_handler.cpp.
References fawkes::Logger::log_debug().