![]() |
![]() |
![]() |
Easy Publish and Consume Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <libepc/shell.h> #define EPC_DEBUG_LEVEL (level) guint epc_shell_get_debug_level (void); EpcShellProgressHooks; void epc_shell_progress_begin (const gchar *title, const gchar *message); void epc_shell_progress_end (void); void epc_shell_progress_update (gdouble percentage, const gchar *message); void epc_shell_set_progress_hooks (const EpcShellProgressHooks *hooks, gpointer user_data, GDestroyNotify destroy_data); #define EPC_AVAHI_ERROR guint epc_shell_watch_avahi_client_state (AvahiClientCallback callback, gpointer user_data, GDestroyNotify destroy_data, GError **error); AvahiEntryGroup* epc_shell_create_avahi_entry_group (AvahiEntryGroupCallback callback, gpointer user_data); AvahiServiceBrowser* epc_shell_create_service_browser (AvahiIfIndex interface, AvahiProtocol protocol, const gchar *type, const gchar *domain, AvahiLookupFlags flags, AvahiServiceBrowserCallback callback, gpointer user_data, GError **error); void epc_shell_restart_avahi_client (const gchar *strloc); const gchar* epc_shell_get_host_name (GError **error); void epc_shell_watch_remove (guint id);
#define EPC_DEBUG_LEVEL(level) G_UNLIKELY(epc_shell_get_debug_level () >= (level))
Checks if the library's debug level, which can be modified by setting the
EPC_DEBUG
environment variable, is above the value
sepecified by level
.
|
the minimum level to check for |
guint epc_shell_get_debug_level (void);
Query the library's debug level. The debug level can be modified by setting
the external EPC_DEBUG
environment variable. In most
cases the EPC_DEBUG_LEVEL macro should be used, instead of calling this
checking the return value of this function.
Returns : |
The library's current debugging level. |
typedef struct { void (*begin) (const gchar *title, gpointer user_data); void (*update) (gdouble percentage, const gchar *message, gpointer user_data); void (*end) (gpointer user_data); } EpcShellProgressHooks;
This table is used by epc_shell_set_progress_hooks to install functions allowing the library to provide feedback during processing.
See also: epc_progress_window_install
|
the function called by epc_shell_progress_begin |
|
the function called by epc_shell_progress_update |
|
the function called by epc_shell_progress_end |
void epc_shell_progress_begin (const gchar *title, const gchar *message);
Call this function before starting a lengthy operation to allow the application tp provide some visual feedback during the operation, and to generally keep its UI responsive.
This function calls your "begin" hook with title
as argument and "update" with message
.
See also: epc_shell_set_progress_hooks()
, epc_progress_window_install,
epc_shell_progress_update()
, epc_shell_progress_end
|
the title of the lengthy operation |
|
description of the lengthy operation |
void epc_shell_progress_end (void);
Call this function when your lengthy operation has finished.
See also: epc_shell_set_progress_hooks()
, epc_progress_window_install,
epc_shell_progress_begin()
, epc_shell_progress_update
void epc_shell_progress_update (gdouble percentage, const gchar *message);
Called this function to inform about progress of a lengthy operation.
The progress is expressed as percentage
in the range [0..1], or -1 if the
progress cannot be estimated.
See also: epc_shell_set_progress_hooks()
, epc_progress_window_install,
epc_shell_progress_begin, epc_shell_progress_end()
|
current progress of the operation, or -1 |
|
a description of the current progress |
void epc_shell_set_progress_hooks (const EpcShellProgressHooks *hooks, gpointer user_data, GDestroyNotify destroy_data);
Installs functions which are called during processing, such as generating
server keys. This allows the application to indicate progress and generally
keep its UI responsive. If no progress callbacks are provided,
or when NULL
is passed for hooks
, progress messages are written to the
console.
See also: EpcEntropyProgress
|
the function table to install, or NULL
|
|
custom data which shall be passed to the start hook |
|
function to call on user_data when the hooks are replaced
|
#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.
guint epc_shell_watch_avahi_client_state (AvahiClientCallback callback, gpointer user_data, GDestroyNotify destroy_data, GError **error);
Registers a function to watch state changes of the library's AvahiClient.
On success the identifier of the newly created watch is returned. Pass it
to epc_shell_watch_remove()
to remove the watch. On failure it returns 0 and
sets error
. The error domain is EPC_AVAHI_ERROR. Possible error codes are
those of the Avahi library.
Usually there is no need in handling the AVAHI_CLIENT_FAILURE state
for callback
, as the callback dispatcher takes care already. This
state is dispatched mostly for notification purposes.
|
a callback function |
|
data to pass to callback
|
|
a function for freeing user_data when removing the watch
|
|
return location for a GError, or NULL
|
Returns : |
The identifier of the newly created watch, or 0 on error. |
AvahiEntryGroup* epc_shell_create_avahi_entry_group (AvahiEntryGroupCallback callback, gpointer user_data);
Creates a new AvahiEntryGroup for the library's shared AvahiClient.
On success the newly created AvahiEntryGroup is returned,
and NULL
on failure.
|
a callback function |
|
data to pass to callback
|
Returns : |
The newly created AvahiEntryGroup, or NULL on error.
|
AvahiServiceBrowser* epc_shell_create_service_browser (AvahiIfIndex interface, AvahiProtocol protocol, const gchar *type, const gchar *domain, AvahiLookupFlags flags, AvahiServiceBrowserCallback callback, gpointer user_data, GError **error);
Creates a new AvahiServiceBrowser for the library's shared AvahiClient.
On success the newly created AvahiEntryGroup is returned. On failure
NULL
is returned and error
is set. The error domain is EPC_AVAHI_ERROR.
Possible error codes are those of the Avahi library.
|
the index of the network interface to watch |
|
the protocol of the services to watch |
|
the DNS-SD service type to watch |
|
the DNS domain to watch, or NULL
|
|
flags for creating the service browser |
|
a callback function |
|
data to pass to callback
|
|
return location for a GError, or NULL
|
Returns : |
The newly created AvahiServiceBrowser, or NULL on error.
|
void epc_shell_restart_avahi_client (const gchar *strloc);
Requests restart of the builtin Avahi client. Use this function to react on
critical failures (like AVAHI_ENTRY_GROUP_FAILURE) reported to your Avahi
callbacks. The strloc
argument is used to prevent endless restart cycles.
Do not call this function to react on AVAHI_CLIENT_FAILURE in a AvahiClientCallback. The builtin callback dispatcher deals with that situation.
|
code location of the callee (G_STRLOC) |
const gchar* epc_shell_get_host_name (GError **error);
Retrieves the official host name of this machine. On failure the function
returns NULL
and sets error
. The error domain is EPC_AVAHI_ERROR.
Possible error codes are those of the Avahi library.