Fawkes API
Fawkes Development Version
|
Representation of a service announced or found via service discovery (i.e. More...
#include <>>
Public Member Functions | |
NetworkService (const char *name, const char *type, const char *domain, const char *host, unsigned short int port) | |
Constructor. More... | |
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. More... | |
NetworkService (const char *name, const char *type, unsigned short int port) | |
Constructor. More... | |
NetworkService (const char *name, const char *type, const char *domain) | |
Constructor. More... | |
NetworkService (NetworkNameResolver *nnresolver, const char *name, const char *type, unsigned short int port) | |
Constructor. More... | |
NetworkService (const NetworkService *s) | |
Copy constructor (pointer). More... | |
NetworkService (const NetworkService &s) | |
Copy constructor (reference). More... | |
~NetworkService () | |
Destructor. More... | |
void | add_txt (const char *format,...) |
Add a TXT record. More... | |
void | set_txt (std::list< std::string > &txtlist) |
Set TXT records all at once. More... | |
void | set_name (const char *new_name) |
Set name of service. More... | |
void | set_modified_name (const char *new_name) const |
Set modified name of service. More... | |
const char * | name () const |
Get name of service. More... | |
const char * | modified_name () const |
Get modified name of service. More... | |
const char * | type () const |
Get type of service. More... | |
const char * | domain () const |
Get domain of service. More... | |
const char * | host () const |
Get host of service. More... | |
std::string | addr_string () const |
Get IP address of entry as string. More... | |
unsigned short int | port () const |
Get port of service. More... | |
const std::list< std::string > & | txt () const |
Get TXT record list of service. More... | |
bool | operator== (const NetworkService &s) const |
Equal operator for NetworkService reference. More... | |
bool | operator== (const NetworkService *s) const |
Equal operator for NetworkService pointer. More... | |
bool | operator< (const NetworkService &s) const |
Less than operator. More... | |
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.
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.
name | name of service |
type | type of service |
domain | domain of service |
host | host of service |
port | port of service |
Definition at line 60 of file service.cpp.
References port().
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.
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 89 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).
name | name of service |
type | type of service |
port | port of service |
Definition at line 123 of file service.cpp.
References port().
fawkes::NetworkService::NetworkService | ( | const char * | name, |
const char * | type, | ||
const char * | domain | ||
) |
Constructor.
This constructor sets all parameters.
name | name of service |
type | type of service |
domain | domain of service |
Definition at line 178 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.
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 151 of file service.cpp.
References name(), port(), and fawkes::NetworkNameResolver::short_hostname().
fawkes::NetworkService::NetworkService | ( | const NetworkService * | s | ) |
Copy constructor (pointer).
Create a copy of given NetworkService.
s | network service to copy from |
Definition at line 210 of file service.cpp.
fawkes::NetworkService::NetworkService | ( | const NetworkService & | s | ) |
Copy constructor (reference).
Create a copy of given NetworkService.
s | network service to copy from |
Definition at line 241 of file service.cpp.
fawkes::NetworkService::~NetworkService | ( | ) |
Destructor.
Definition at line 196 of file service.cpp.
void fawkes::NetworkService::add_txt | ( | const char * | format, |
... | |||
) |
Add a TXT record.
format | format for TXT record to add, must be a "key=value" string, takes the same arguments as sprintf. |
Definition at line 273 of file service.cpp.
Referenced by XmlRpcThread::init().
std::string fawkes::NetworkService::addr_string | ( | ) | const |
Get IP address of entry as string.
NullPointerException | thrown if the address has not been set |
Definition at line 389 of file service.cpp.
Referenced by NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
const char * fawkes::NetworkService::domain | ( | ) | const |
Get domain of service.
Definition at line 358 of file service.cpp.
Referenced by Firestation::get_window(), fawkes::AvahiThread::unpublish_service(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
const char * fawkes::NetworkService::host | ( | ) | const |
Get host of service.
Definition at line 368 of file service.cpp.
Referenced by Firestation::get_window(), fawkes::AvahiThread::unpublish_service(), FuseViewerGtkWindow::~FuseViewerGtkWindow(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
const char * fawkes::NetworkService::modified_name | ( | ) | const |
Get modified name of service.
The modified name is the original name with a suffix that has been added to resolve a name collision.
Definition at line 338 of file service.cpp.
Referenced by fawkes::AvahiThread::unpublish_service().
const char * fawkes::NetworkService::name | ( | ) | const |
Get name of service.
Definition at line 312 of file service.cpp.
Referenced by Firestation::get_window(), NetworkService(), fawkes::AvahiThread::unpublish_service(), FuseViewerGtkWindow::~FuseViewerGtkWindow(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
bool fawkes::NetworkService::operator< | ( | const NetworkService & | s | ) | const |
Less than operator.
s | reference of service to compare to |
Definition at line 453 of file service.cpp.
bool fawkes::NetworkService::operator== | ( | const NetworkService & | s | ) | const |
Equal operator for NetworkService reference.
s | reference of service to compare to. |
Definition at line 428 of file service.cpp.
bool fawkes::NetworkService::operator== | ( | const NetworkService * | s | ) | const |
Equal operator for NetworkService pointer.
s | pointer to service to compare to. |
Definition at line 440 of file service.cpp.
unsigned short int fawkes::NetworkService::port | ( | ) | const |
Get port of service.
Definition at line 378 of file service.cpp.
Referenced by Firestation::get_window(), NetworkService(), fawkes::AvahiThread::unpublish_service(), FuseViewerGtkWindow::~FuseViewerGtkWindow(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().
void fawkes::NetworkService::set_modified_name | ( | const char * | new_name | ) | const |
Set modified name of service.
The modified name is the original name with a suffix that has been added to resolve a name collision.
new_name | new name |
Definition at line 324 of file service.cpp.
Referenced by fawkes::AvahiThread::unpublish_service().
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.
txtlist | list of TXT records |
Definition at line 291 of file service.cpp.
const std::list< std::string > & fawkes::NetworkService::txt | ( | ) | const |
Get TXT record list of service.
Definition at line 417 of file service.cpp.
Referenced by NetworkService(), and fawkes::AvahiThread::unpublish_service().
const char * fawkes::NetworkService::type | ( | ) | const |
Get type of service.
Definition at line 348 of file service.cpp.
Referenced by Firestation::get_window(), fawkes::AvahiThread::unpublish_service(), and NetLogGuiGtkWindow::~NetLogGuiGtkWindow().