Fawkes API
Fawkes Development Version
|
Avahi main thread. More...
#include <netcomm/dns-sd/avahi_thread.h>
Public Member Functions | |
AvahiThread () | |
Constructor. | |
~AvahiThread () | |
Destructor. | |
void | wait_initialized () |
Waits for the AvahiThread to be initialized. | |
virtual void | loop () |
Avahi thread loop. | |
void | publish_service (NetworkService *service) |
Publish service. | |
void | unpublish_service (NetworkService *service) |
Revoke service publication. | |
void | watch_service (const char *service_type, ServiceBrowseHandler *h) |
Add a result handler. | |
void | unwatch_service (const char *service_type, ServiceBrowseHandler *h) |
Remove a handler. | |
void | resolve_name (const char *name, AvahiResolverHandler *handler) |
Order name resolution. | |
void | resolve_address (struct sockaddr *addr, socklen_t addrlen, AvahiResolverHandler *handler) |
Order address resolution. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Avahi main thread.
This thread handles all tasks related to avahi. This is the single interaction point with the Avahi adapter.
fawkes::AvahiThread::AvahiThread | ( | ) |
Constructor.
Definition at line 59 of file avahi_thread.cpp.
References fawkes::Thread::set_prepfin_conc_loop().
fawkes::AvahiThread::~AvahiThread | ( | ) |
Destructor.
Definition at line 75 of file avahi_thread.cpp.
void fawkes::AvahiThread::loop | ( | ) | [virtual] |
Avahi thread loop.
The avahi thread calls the simple poll iterate to poll with an infinite timeout. This way the loop blocks until an event occurs.
Reimplemented from fawkes::Thread.
Definition at line 99 of file avahi_thread.cpp.
void fawkes::AvahiThread::publish_service | ( | NetworkService * | service | ) | [virtual] |
Publish service.
service | service to publish. |
Implements fawkes::ServicePublisher.
Definition at line 230 of file avahi_thread.cpp.
References fawkes::LockQueue::push_locked().
void fawkes::AvahiThread::resolve_address | ( | struct sockaddr * | addr, |
socklen_t | addrlen, | ||
AvahiResolverHandler * | handler | ||
) |
Order address resolution.
This initiates resolution of an address. The method immediately returns and will not wait for the result.
addr | address to resolve, currently only struct sockaddr_in is supported (IPv4) |
addrlen | length of addr in bytes |
handler | handler to call for the result |
Definition at line 892 of file avahi_thread.cpp.
void fawkes::AvahiThread::resolve_name | ( | const char * | name, |
AvahiResolverHandler * | handler | ||
) |
Order name resolution.
This initiates resolution of a name. The method immediately returns and will not wait for the result.
name | name to resolve. |
handler | handler to call for the result |
Definition at line 835 of file avahi_thread.cpp.
References fawkes::Thread::name().
virtual void fawkes::AvahiThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 82 of file avahi_thread.h.
void fawkes::AvahiThread::unpublish_service | ( | NetworkService * | service | ) | [virtual] |
Revoke service publication.
service | service to revoke |
Implements fawkes::ServicePublisher.
Definition at line 243 of file avahi_thread.cpp.
References fawkes::LockQueue::push_locked().
void fawkes::AvahiThread::unwatch_service | ( | const char * | service_type, |
ServiceBrowseHandler * | h | ||
) | [virtual] |
Remove a handler.
The handler is removed and no further events will be emitted to the handler.
service_type | service type to de-register the handler for |
h | the handler |
Implements fawkes::ServiceBrowser.
Definition at line 491 of file avahi_thread.cpp.
References fawkes::LockQueue::push_locked().
void fawkes::AvahiThread::wait_initialized | ( | ) |
Waits for the AvahiThread to be initialized.
You can use this if you want to wait until the thread has been fully initialized and may be used. Since the happens in this thread it is in general not immediately ready after start(). This will block the calling thread until the AvahiThread has been initialized. This is done by waiting for a release of an initialization mutex.
Definition at line 1048 of file avahi_thread.cpp.
References fawkes::WaitCondition::wait().
void fawkes::AvahiThread::watch_service | ( | const char * | service_type, |
ServiceBrowseHandler * | h | ||
) | [virtual] |
Add a result handler.
A handler is added for the given service type. A search is initiated for the given service and the given handler is called for added or removed services or if an error occurs.
service_type | string of the service type |
h | The ServiceBrowseHandler |
Implements fawkes::ServiceBrowser.
Definition at line 475 of file avahi_thread.cpp.
References fawkes::LockQueue::push_locked().
Referenced by NetLogGuiGtkWindow::NetLogGuiGtkWindow(), and FuseViewerGtkWindow::FuseViewerGtkWindow().