Fawkes API  Fawkes Development Version
fawkes::AvahiThread Class Reference

Avahi main thread. More...

#include <netcomm/dns-sd/avahi_thread.h>

Inheritance diagram for fawkes::AvahiThread:

List of all members.

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.

Detailed Description

Avahi main thread.

This thread handles all tasks related to avahi. This is the single interaction point with the Avahi adapter.

Author:
Tim Niemueller

Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
serviceservice 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.

Parameters:
addraddress to resolve, currently only struct sockaddr_in is supported (IPv4)
addrlenlength of addr in bytes
handlerhandler 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.

Parameters:
namename to resolve.
handlerhandler 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.

See also:
Thread::run()

Reimplemented from fawkes::Thread.

Definition at line 82 of file avahi_thread.h.

void fawkes::AvahiThread::unpublish_service ( NetworkService service) [virtual]

Revoke service publication.

Parameters:
serviceservice 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.

Parameters:
service_typeservice type to de-register the handler for
hthe 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.

Parameters:
service_typestring of the service type
hThe 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().


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