| Easy Publish and Consume Reference Manual | ||||
|---|---|---|---|---|
#include <libepc/shell.h> #define EPC_AVAHI_ERROR AvahiClient* epc_shell_create_avahi_client (AvahiClientFlags flags, AvahiClientCallback callback, gpointer user_data, GError **error); void epc_shell_enter (void); const AvahiPoll* epc_shell_get_avahi_poll_api (void); void epc_shell_leave (void); void epc_shell_ref (void); void epc_shell_unref (void);
#define EPC_AVAHI_ERROR (epc_avahi_error_quark ())
Error domain for Avahi operations. Errors in this domain will be Avahi error codes. See GError for information on error domains.
AvahiClient* epc_shell_create_avahi_client (AvahiClientFlags flags,
AvahiClientCallback callback,
gpointer user_data,
GError **error);
Creates a new Avahi client with the behavior described by flags. Whenever
the state of the client changes callback is called. This callback may be
NULL. If the call was not successful, it returns FALSE. The error domain
is EPC_AVAHI_ERROR. Possible error codes are those of the
Avahi library.
You have to call epc_shell_ref before using this function.
Please note that this function is called for the first time from within the epc_shell_create_avahi_client context! Thus, in the callback you should not make use of global variables that are initialized only after your call to epc_shell_create_avahi_client. A common mistake is to store the AvahiClient pointer returned by epc_shell_create_avahi_client in a global variable and assume that this global variable already contains the valid pointer when the callback is called for the first time. A work-around for this is to always use the AvahiClient pointer passed to the callback function instead of the global pointer.
void epc_shell_enter (void);
Acquires the big GDK lock when running unter GDK/GTK+. It has to be called after leaving GLib main loops to avoid race conditions. See gdk_threads_enter for details.
const AvahiPoll* epc_shell_get_avahi_poll_api (void);
Returns the Avahi polling API object used for integrating the Avahi library with the GLib main loop.
You have to call epc_shell_ref before using this function.
| Returns : | The Avahi polling API used. |
void epc_shell_leave (void);
Releases the big GDK lock when running unter GDK/GTK+. It has to be called before entering GLib main loops to avoid race conditions. See gdk_threads_leave for details.
void epc_shell_ref (void);
Increases the reference count for this library. When called for the first time essential resources are allocated. Each call to this function has to be paired with a call to epc_shell_unref.