fawkes::NetworkService Class Reference
[Fawkes Network Communication]
Representation of a service announced or found via service discovery (i.e.
More...
#include <netcomm/service_discovery/service.h>
Public Member Functions | |
| NetworkService (const char *name, const char *type, const char *domain, const char *host, unsigned short int port) | |
| Constructor. | |
| NetworkService (const char *name, const char *type, const char *domain, const char *host, unsigned short int port, const struct sockaddr *addr, const socklen_t addr_size, std::list< std::string > &txt) | |
| Constructor. | |
| NetworkService (const char *name, const char *type, unsigned short int port) | |
| Constructor. | |
| NetworkService (const char *name, const char *type, const char *domain) | |
| Constructor. | |
| NetworkService (NetworkNameResolver *nnresolver, const char *name, const char *type, unsigned short int port) | |
| Constructor. | |
| NetworkService (const NetworkService *s) | |
| Copy constructor (pointer). | |
| NetworkService (const NetworkService &s) | |
| Copy constructor (reference). | |
| ~NetworkService () | |
| Destructor. | |
| void | add_txt (const char *txt) |
| Add a TXT record. | |
| void | set_txt (std::list< std::string > &txtlist) |
| Set TXT records all at once. | |
| void | set_name (const char *new_name) |
| Set name of service. | |
| const char * | name () const |
| Get name of service. | |
| const char * | type () const |
| Get type of service. | |
| const char * | domain () const |
| Get domain of service. | |
| const char * | host () const |
| Get host of service. | |
| std::string | addr_string () const |
| Get IP address of entry as string. | |
| unsigned short int | port () const |
| Get port of service. | |
| const std::list< std::string > & | txt () const |
| Get TXT record list of service. | |
| bool | operator== (const NetworkService &s) const |
| Equal operator for NetworkService reference. | |
| bool | operator== (const NetworkService *s) const |
| Equal operator for NetworkService pointer. | |
| bool | operator< (const NetworkService &s) const |
| Less than operator. | |
Detailed Description
Representation of a service announced or found via service discovery (i.e.mDNS/DNS-SD via Avahi). This class is used in the C++ wrapper to talk about services.
Definition at line 37 of file service.h.
Constructor & Destructor Documentation
| fawkes::NetworkService::NetworkService | ( | const char * | name, | |
| const char * | type, | |||
| const char * | domain, | |||
| const char * | host, | |||
| unsigned short int | port | |||
| ) |
Constructor.
This constructor sets all parameters.
- Parameters:
-
name name of service type type of service domain domain of service host host of service port port of service
Definition at line 57 of file service.cpp.
| fawkes::NetworkService::NetworkService | ( | const char * | name, | |
| const char * | type, | |||
| const char * | domain, | |||
| const char * | host, | |||
| unsigned short int | port, | |||
| const struct sockaddr * | addr, | |||
| const socklen_t | addr_size, | |||
| std::list< std::string > & | txt | |||
| ) |
Constructor.
This constructor sets all parameters.
- Parameters:
-
name name of service type type of service domain domain of service host host of service port port of service addr address of the service addr_size size in bytes of addr parameter txt list of TXT records
Definition at line 85 of file service.cpp.
| fawkes::NetworkService::NetworkService | ( | const char * | name, | |
| const char * | type, | |||
| unsigned short int | port | |||
| ) |
Constructor.
This constructor sets all parameters. Host and domain are the default values, which means local host name in domain .local (if not set otherwise in Avahi system configuration).
- Parameters:
-
name name of service type type of service port port of service
Definition at line 116 of file service.cpp.
| fawkes::NetworkService::NetworkService | ( | const char * | name, | |
| const char * | type, | |||
| const char * | domain | |||
| ) |
Constructor.
This constructor sets all parameters.
- Parameters:
-
name name of service type type of service domain domain of service
Definition at line 169 of file service.cpp.
| fawkes::NetworkService::NetworkService | ( | NetworkNameResolver * | nnresolver, | |
| const char * | name, | |||
| const char * | type, | |||
| unsigned short int | port | |||
| ) |
Constructor.
This constructor sets all parameters. Host and domain are the default values, which means local host name in domain .local (if not set otherwise in Avahi system configuration). This specific constructor allows the usage of a "%h" token in the name, which is replaced with the short hostname.
- Parameters:
-
nnresolver network name resolver to get the host from for the replacement of a h token. name name of service type type of service port port of service
Definition at line 143 of file service.cpp.
References fawkes::NetworkNameResolver::short_hostname().
| fawkes::NetworkService::NetworkService | ( | const NetworkService * | s | ) |
Copy constructor (pointer).
Create a copy of given NetworkService.
- Parameters:
-
s network service to copy from
Definition at line 199 of file service.cpp.
| fawkes::NetworkService::NetworkService | ( | const NetworkService & | s | ) |
Copy constructor (reference).
Create a copy of given NetworkService.
- Parameters:
-
s network service to copy from
Definition at line 226 of file service.cpp.
| fawkes::NetworkService::~NetworkService | ( | ) |
Member Function Documentation
| void fawkes::NetworkService::add_txt | ( | const char * | txt | ) |
Add a TXT record.
- Parameters:
-
txt TXT record to add, must be a "key=value" string.
Definition at line 253 of file service.cpp.
Referenced by WebviewThread::init().
| std::string fawkes::NetworkService::addr_string | ( | ) | const |
Get IP address of entry as string.
- Returns:
- IP address as string
- Exceptions:
-
NullPointerException thrown if the address has not been set
Definition at line 335 of file service.cpp.
| const char * fawkes::NetworkService::domain | ( | ) | const |
| const char * fawkes::NetworkService::host | ( | ) | const |
| const char * fawkes::NetworkService::name | ( | ) | const |
| bool fawkes::NetworkService::operator< | ( | const NetworkService & | s | ) | const |
Less than operator.
- Parameters:
-
s reference of service to compare to
- Returns:
- true, if either the type is less than (according to strcmp) or if types are equal if the service name is less than the given service's name.
Definition at line 383 of file service.cpp.
| bool fawkes::NetworkService::operator== | ( | const NetworkService * | s | ) | const |
Equal operator for NetworkService pointer.
- Parameters:
-
s pointer to service to compare to.
- Returns:
- true, if the services are the same (same name and type), false otherwise
Definition at line 370 of file service.cpp.
| bool fawkes::NetworkService::operator== | ( | const NetworkService & | s | ) | const |
Equal operator for NetworkService reference.
- Parameters:
-
s reference of service to compare to.
- Returns:
- true, if the services are the same (same name and type), false otherwise
Definition at line 358 of file service.cpp.
| unsigned short int fawkes::NetworkService::port | ( | ) | const |
| void fawkes::NetworkService::set_name | ( | const char * | new_name | ) |
| void fawkes::NetworkService::set_txt | ( | std::list< std::string > & | txtlist | ) |
Set TXT records all at once.
- Parameters:
-
txtlist list of TXT records
Definition at line 263 of file service.cpp.
| const std::list< std::string > & fawkes::NetworkService::txt | ( | ) | const |
Get TXT record list of service.
- Returns:
- TXT record list of service
Definition at line 347 of file service.cpp.
| const char * fawkes::NetworkService::type | ( | ) | const |
The documentation for this class was generated from the following files:
- src/libs/netcomm/service_discovery/service.h
- src/libs/netcomm/service_discovery/service.cpp

