avahi-client/client.h File Reference

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.
typedef void(* AvahiClientCallback )(AvahiClient *s, AvahiClientState state, void *userdata)
 The function prototype for the callback of an AvahiClient.

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


AvahiClientavahi_client_new (const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback, void *userdata, int *error)
 Creates a new client instance.
void avahi_client_free (AvahiClient *client)
 Free a client instance.
Properties


const char * avahi_client_get_version_string (AvahiClient *)
 Get the version of the server.
const char * avahi_client_get_host_name (AvahiClient *)
 Get host name.
int avahi_client_set_host_name (AvahiClient *, const char *name)
 Set host name.
const char * avahi_client_get_domain_name (AvahiClient *)
 Get domain name.
const char * avahi_client_get_host_name_fqdn (AvahiClient *)
 Get FQDN domain name.
AvahiClientState avahi_client_get_state (AvahiClient *client)
 Get state.
Error Handling


int avahi_client_errno (AvahiClient *)
 Get the last error number.
Libc NSS Support


int avahi_nss_support (void)
 Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise.


Detailed Description

Definitions and functions for the client API over D-Bus.

Definition in file client.h.


Typedef Documentation

typedef struct AvahiClient AvahiClient

A connection context.

Examples:
client-browse-services.c, client-publish-service.c, and glib-integration.c.

Definition at line 39 of file client.h.

typedef void(* AvahiClientCallback)(AvahiClient *s, AvahiClientState state, void *userdata)

The function prototype for the callback of an AvahiClient.

Definition at line 56 of file client.h.


Enumeration Type Documentation

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.

Definition at line 50 of file client.h.

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.

Definition at line 42 of file client.h.


Function Documentation

int avahi_client_errno ( AvahiClient  ) 

Get the last error number.

See avahi_strerror() for converting this error code into a human readable string.

Examples:
client-browse-services.c, client-publish-service.c, and glib-integration.c.

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!

Examples:
client-browse-services.c, client-publish-service.c, and glib-integration.c.

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.

Examples:
client-publish-service.c.

const char* avahi_client_get_version_string ( AvahiClient  ) 

Get the version of the server.

Examples:
glib-integration.c.

AvahiClient* avahi_client_new ( const AvahiPoll poll_api,
AvahiClientFlags  flags,
AvahiClientCallback  callback,
void *  userdata,
int *  error 
)

Creates a new client instance.

Parameters:
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.
Examples:
client-browse-services.c, client-publish-service.c, and glib-integration.c.

int avahi_client_set_host_name ( AvahiClient ,
const char *  name 
)

Set host name.

Since:
0.6.13

int avahi_nss_support ( void   ) 

Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise.

Since:
0.6.5


Generated on Fri Dec 12 22:23:40 2008 for avahi by  doxygen 1.5.7.1