avahi
0.7
|
Definitions and functions for the client API over D-Bus. More...
#include <inttypes.h>
#include <avahi-common/cdecl.h>
#include <avahi-common/address.h>
#include <avahi-common/strlst.h>
#include <avahi-common/defs.h>
#include <avahi-common/watch.h>
#include <avahi-common/gccmacro.h>
Go to the source code of this file.
Typedefs | |
typedef struct AvahiClient | AvahiClient |
A connection context. More... | |
typedef void(* | AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void *userdata) |
The function prototype for the callback of an AvahiClient. More... | |
Enumerations | |
enum | AvahiClientState { AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, AVAHI_CLIENT_FAILURE = 100, AVAHI_CLIENT_CONNECTING = 101 } |
States of a client object, a superset of AvahiServerState. More... | |
enum | AvahiClientFlags { AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, AVAHI_CLIENT_NO_FAIL = 2 } |
Functions | |
Construction and destruction | |
AvahiClient * | avahi_client_new (const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback, void *userdata, int *error) |
Creates a new client instance. More... | |
void | avahi_client_free (AvahiClient *client) |
Free a client instance. More... | |
Properties | |
const char * | avahi_client_get_version_string (AvahiClient *) |
Get the version of the server. More... | |
const char * | avahi_client_get_host_name (AvahiClient *) |
Get host name. More... | |
int | avahi_client_set_host_name (AvahiClient *, const char *name) |
Set host name. More... | |
const char * | avahi_client_get_domain_name (AvahiClient *) |
Get domain name. More... | |
const char * | avahi_client_get_host_name_fqdn (AvahiClient *) |
Get FQDN domain name. More... | |
AvahiClientState | avahi_client_get_state (AvahiClient *client) |
Get state. More... | |
Error Handling | |
int | avahi_client_errno (AvahiClient *) |
Get the last error number. More... | |
Libc NSS Support | |
int | avahi_nss_support (void) |
Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise. More... | |
Definitions and functions for the client API over D-Bus.
Definition in file client.h.
typedef struct AvahiClient AvahiClient |
typedef void(* AvahiClientCallback) (AvahiClient *s, AvahiClientState state, void *userdata) |
enum AvahiClientFlags |
Enumerator | |
---|---|
AVAHI_CLIENT_IGNORE_USER_CONFIG | Don't read user configuration. |
AVAHI_CLIENT_NO_FAIL | Don't fail if the daemon is not available when avahi_client_new() is called, instead enter AVAHI_CLIENT_CONNECTING state and wait for the daemon to appear. |
enum AvahiClientState |
States of a client object, a superset of AvahiServerState.
Enumerator | |
---|---|
AVAHI_CLIENT_S_REGISTERING | Server state: REGISTERING. |
AVAHI_CLIENT_S_RUNNING | Server state: RUNNING. |
AVAHI_CLIENT_S_COLLISION | Server state: COLLISION. |
AVAHI_CLIENT_FAILURE | Some kind of error happened on the client side. |
AVAHI_CLIENT_CONNECTING | We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. |
int avahi_client_errno | ( | AvahiClient * | ) |
Get the last error number.
See avahi_strerror() for converting this error code into a human readable string.
void avahi_client_free | ( | AvahiClient * | client | ) |
Free a client instance.
This will automatically free all associated browser, resolve and entry group objects. All pointers to such objects become invalid!
const char* avahi_client_get_domain_name | ( | AvahiClient * | ) |
Get domain name.
const char* avahi_client_get_host_name | ( | AvahiClient * | ) |
Get host name.
const char* avahi_client_get_host_name_fqdn | ( | AvahiClient * | ) |
Get FQDN domain name.
AvahiClientState avahi_client_get_state | ( | AvahiClient * | client | ) |
Get state.
const char* avahi_client_get_version_string | ( | AvahiClient * | ) |
Get the version of the server.
AvahiClient* avahi_client_new | ( | const AvahiPoll * | poll_api, |
AvahiClientFlags | flags, | ||
AvahiClientCallback | callback, | ||
void * | userdata, | ||
int * | error | ||
) |
Creates a new client instance.
poll_api | The abstract event loop API to use |
flags | Some flags to modify the behaviour of the client library |
callback | A callback that is called whenever the state of the client changes. This may be NULL. Please note that this function is called for the first time from within the avahi_client_new() context! Thus, in the callback you should not make use of global variables that are initialized only after your call to avahi_client_new(). A common mistake is to store the AvahiClient pointer returned by avahi_client_new() 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. |
userdata | Some arbitrary user data pointer that will be passed to the callback function |
error | If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. |
int avahi_client_set_host_name | ( | AvahiClient * | , |
const char * | name | ||
) |
Set host name.
int avahi_nss_support | ( | void | ) |
Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise.