1#ifndef foodnssrvhfoo
2#define foodnssrvhfoo
3
4/***
5  This file is part of avahi.
6
7  avahi is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Lesser General Public License as
9  published by the Free Software Foundation; either version 2.1 of the
10  License, or (at your option) any later version.
11
12  avahi is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
15  Public License for more details.
16
17  You should have received a copy of the GNU Lesser General Public
18  License along with avahi; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  USA.
21***/
22
23/** \file avahi-core/dns-srv-rr.h Functions for announcing and browsing for unicast DNS servers via mDNS */
24
25/** A domain service browser object. Use this to browse for
26 * conventional unicast DNS servers which may be used to resolve
27 * conventional domain names */
28typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser;
29
30#include <avahi-common/cdecl.h>
31#include <avahi-common/defs.h>
32#include <avahi-core/core.h>
33#include <avahi-core/publish.h>
34
35AVAHI_C_DECL_BEGIN
36
37/** The type of DNS server */
38typedef enum {
39    AVAHI_DNS_SERVER_RESOLVE,         /**< Unicast DNS servers for normal resolves (_domain._udp)*/
40    AVAHI_DNS_SERVER_UPDATE,           /**< Unicast DNS servers for updates (_dns-update._udp)*/
41    AVAHI_DNS_SERVER_MAX
42} AvahiDNSServerType;
43
44/** Publish the specified unicast DNS server address via mDNS. You may
45 * browse for records create this way wit
46 * avahi_s_dns_server_browser_new(). */
47int avahi_server_add_dns_server_address(
48    AvahiServer *s,
49    AvahiSEntryGroup *g,
50    AvahiIfIndex interface,
51    AvahiProtocol protocol,
52    AvahiPublishFlags flags,
53    const char *domain,
54    AvahiDNSServerType type,
55    const AvahiAddress *address,
56    uint16_t port /** should be 53 */);
57
58/** Callback prototype for AvahiSDNSServerBrowser events */
59typedef void (*AvahiSDNSServerBrowserCallback)(
60    AvahiSDNSServerBrowser *b,
61    AvahiIfIndex interface,
62    AvahiProtocol protocol,
63    AvahiBrowserEvent event,
64    const char *host_name,       /**< Host name of the DNS server, probably useless */
65    const AvahiAddress *a,        /**< Address of the DNS server */
66    uint16_t port,                 /**< Port number of the DNS servers, probably 53 */
67    AvahiLookupResultFlags flags,  /**< Lookup flags */
68    void* userdata);
69
70/** Create a new AvahiSDNSServerBrowser object */
71AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
72    AvahiServer *server,
73    AvahiIfIndex interface,
74    AvahiProtocol protocol,
75    const char *domain,
76    AvahiDNSServerType type,
77    AvahiProtocol aprotocol,  /**< Address protocol for the DNS server */
78    AvahiLookupFlags flags,                 /**< Lookup flags. */
79    AvahiSDNSServerBrowserCallback callback,
80    void* userdata);
81
82/** Free an AvahiSDNSServerBrowser object */
83void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
84
85AVAHI_C_DECL_END
86
87#endif
88