avahi
0.7
|
Lookup Client API. 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>
#include <avahi-client/client.h>
Go to the source code of this file.
Domain Browser | |
typedef struct AvahiDomainBrowser | AvahiDomainBrowser |
A domain browser object. More... | |
typedef void(* | AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void *userdata) |
The function prototype for the callback of an AvahiDomainBrowser. More... | |
AvahiDomainBrowser * | avahi_domain_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *domain, AvahiDomainBrowserType btype, AvahiLookupFlags flags, AvahiDomainBrowserCallback callback, void *userdata) |
Browse for domains on the local network. More... | |
AvahiClient * | avahi_domain_browser_get_client (AvahiDomainBrowser *) |
Get the parent client of an AvahiDomainBrowser object. More... | |
int | avahi_domain_browser_free (AvahiDomainBrowser *) |
Cleans up and frees an AvahiDomainBrowser object. More... | |
Service Browser | |
typedef struct AvahiServiceBrowser | AvahiServiceBrowser |
A service browser object. More... | |
typedef void(* | AvahiServiceBrowserCallback) (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void *userdata) |
The function prototype for the callback of an AvahiServiceBrowser. More... | |
AvahiServiceBrowser * | avahi_service_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *type, const char *domain, AvahiLookupFlags flags, AvahiServiceBrowserCallback callback, void *userdata) |
Browse for services of a type on the network. More... | |
AvahiClient * | avahi_service_browser_get_client (AvahiServiceBrowser *) |
Get the parent client of an AvahiServiceBrowser object. More... | |
int | avahi_service_browser_free (AvahiServiceBrowser *) |
Cleans up and frees an AvahiServiceBrowser object. More... | |
Service Resolver | |
typedef struct AvahiServiceResolver | AvahiServiceResolver |
A service resolver object. More... | |
typedef void(* | AvahiServiceResolverCallback) (AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, void *userdata) |
The function prototype for the callback of an AvahiServiceResolver. More... | |
AvahiServiceResolver * | avahi_service_resolver_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiProtocol aprotocol, AvahiLookupFlags flags, AvahiServiceResolverCallback callback, void *userdata) |
Create a new service resolver object. More... | |
AvahiClient * | avahi_service_resolver_get_client (AvahiServiceResolver *) |
Get the parent client of an AvahiServiceResolver object. More... | |
int | avahi_service_resolver_free (AvahiServiceResolver *r) |
Free a service resolver object. More... | |
Record Browser | |
typedef struct AvahiRecordBrowser | AvahiRecordBrowser |
A record browser object. More... | |
typedef void(* | AvahiRecordBrowserCallback) (AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) |
The function prototype for the callback of an AvahiRecordBrowser. More... | |
AvahiRecordBrowser * | avahi_record_browser_new (AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, uint16_t clazz, uint16_t type, AvahiLookupFlags flags, AvahiRecordBrowserCallback callback, void *userdata) |
Browse for records of a type on the local network. More... | |
AvahiClient * | avahi_record_browser_get_client (AvahiRecordBrowser *) |
Get the parent client of an AvahiRecordBrowser object. More... | |
int | avahi_record_browser_free (AvahiRecordBrowser *) |
Cleans up and frees an AvahiRecordBrowser object. More... | |
Lookup Client API.
Definition in file lookup.h.
typedef struct AvahiDomainBrowser AvahiDomainBrowser |
typedef void(* AvahiDomainBrowserCallback) (AvahiDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void *userdata) |
typedef struct AvahiRecordBrowser AvahiRecordBrowser |
typedef void(* AvahiRecordBrowserCallback) (AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) |
typedef struct AvahiServiceBrowser AvahiServiceBrowser |
typedef void(* AvahiServiceBrowserCallback) (AvahiServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void *userdata) |
typedef struct AvahiServiceResolver AvahiServiceResolver |
typedef void(* AvahiServiceResolverCallback) (AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, void *userdata) |
int avahi_domain_browser_free | ( | AvahiDomainBrowser * | ) |
Cleans up and frees an AvahiDomainBrowser object.
AvahiClient* avahi_domain_browser_get_client | ( | AvahiDomainBrowser * | ) |
Get the parent client of an AvahiDomainBrowser object.
AvahiDomainBrowser* avahi_domain_browser_new | ( | AvahiClient * | client, |
AvahiIfIndex | interface, | ||
AvahiProtocol | protocol, | ||
const char * | domain, | ||
AvahiDomainBrowserType | btype, | ||
AvahiLookupFlags | flags, | ||
AvahiDomainBrowserCallback | callback, | ||
void * | userdata | ||
) |
Browse for domains on the local network.
int avahi_record_browser_free | ( | AvahiRecordBrowser * | ) |
Cleans up and frees an AvahiRecordBrowser object.
AvahiClient* avahi_record_browser_get_client | ( | AvahiRecordBrowser * | ) |
Get the parent client of an AvahiRecordBrowser object.
AvahiRecordBrowser* avahi_record_browser_new | ( | AvahiClient * | client, |
AvahiIfIndex | interface, | ||
AvahiProtocol | protocol, | ||
const char * | name, | ||
uint16_t | clazz, | ||
uint16_t | type, | ||
AvahiLookupFlags | flags, | ||
AvahiRecordBrowserCallback | callback, | ||
void * | userdata | ||
) |
Browse for records of a type on the local network.
int avahi_service_browser_free | ( | AvahiServiceBrowser * | ) |
Cleans up and frees an AvahiServiceBrowser object.
AvahiClient* avahi_service_browser_get_client | ( | AvahiServiceBrowser * | ) |
Get the parent client of an AvahiServiceBrowser object.
AvahiServiceBrowser* avahi_service_browser_new | ( | AvahiClient * | client, |
AvahiIfIndex | interface, | ||
AvahiProtocol | protocol, | ||
const char * | type, | ||
const char * | domain, | ||
AvahiLookupFlags | flags, | ||
AvahiServiceBrowserCallback | callback, | ||
void * | userdata | ||
) |
Browse for services of a type on the network.
In most cases you probably want to pass AVAHI_IF_UNSPEC and AVAHI_PROTO_UNSPED in interface, resp. protocol to browse on all local networks. The specified callback will be called whenever a new service appears or is removed from the network. Please note that events may be collapsed to minimize traffic (i.e. a REMOVED followed by a NEW for the same service data is dropped because redundant). If you want to subscribe to service data changes, you should use avahi_service_resolver_new() and keep it open, in which case you will be notified via AVAHI_RESOLVE_FOUND everytime the service data changes.
interface | In most cases pass AVAHI_IF_UNSPEC here |
protocol | In most cases pass AVAHI_PROTO_UNSPEC here |
type | A service type such as "_http._tcp" |
domain | A domain to browse in. In most cases you want to pass NULL here for the default domain (usually ".local") |
int avahi_service_resolver_free | ( | AvahiServiceResolver * | r | ) |
Free a service resolver object.
AvahiClient* avahi_service_resolver_get_client | ( | AvahiServiceResolver * | ) |
Get the parent client of an AvahiServiceResolver object.
AvahiServiceResolver* avahi_service_resolver_new | ( | AvahiClient * | client, |
AvahiIfIndex | interface, | ||
AvahiProtocol | protocol, | ||
const char * | name, | ||
const char * | type, | ||
const char * | domain, | ||
AvahiProtocol | aprotocol, | ||
AvahiLookupFlags | flags, | ||
AvahiServiceResolverCallback | callback, | ||
void * | userdata | ||
) |
Create a new service resolver object.
Please make sure to pass all the service data you received via avahi_service_browser_new()'s callback function, especially interface and protocol. The protocol argument specifies the protocol (IPv4 or IPv6) to use as transport for the queries which are sent out by this resolver. The aprotocol argument specifies the adress family (IPv4 or IPv6) of the address of the service we are looking for. Generally, on "protocol" you should only pass what was supplied to you as parameter to your AvahiServiceBrowserCallback. In "aprotocol" you should pass what your application code can deal with when connecting to the service. Or, more technically speaking: protocol specifies if the mDNS queries should be sent as UDP/IPv4 resp. UDP/IPv6 packets. aprotocol specifies whether the query is for a A resp. AAAA resource record.
interface | Pass the interface argument you received in AvahiServiceBrowserCallback here. |
protocol | Pass the protocol argument you received in AvahiServiceBrowserCallback here. |
name | Pass the name argument you received in AvahiServiceBrowserCallback here. |
type | Pass the type argument you received in AvahiServiceBrowserCallback here. |
domain | Pass the domain argument you received in AvahiServiceBrowserCallback here. |
aprotocol | The desired address family of the service address to resolve. AVAHI_PROTO_UNSPEC if your application can deal with both IPv4 and IPv6 |