]> git.meshlink.io Git - catta/blob - src/dns-srv-rr.h
rename everything avahi to catta
[catta] / src / dns-srv-rr.h
1 #ifndef foodnssrvhfoo
2 #define foodnssrvhfoo
3
4 /***
5   This file is part of catta.
6
7   catta 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   catta 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 catta; 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 catta/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 */
28 typedef struct CattaSDNSServerBrowser CattaSDNSServerBrowser;
29
30 #include <catta/cdecl.h>
31 #include <catta/defs.h>
32 #include <catta/core.h>
33 #include <catta/publish.h>
34
35 CATTA_C_DECL_BEGIN
36
37 /** The type of DNS server */
38 typedef enum {
39     CATTA_DNS_SERVER_RESOLVE,         /**< Unicast DNS servers for normal resolves (_domain._udp)*/
40     CATTA_DNS_SERVER_UPDATE,           /**< Unicast DNS servers for updates (_dns-update._udp)*/
41     CATTA_DNS_SERVER_MAX
42 } CattaDNSServerType;
43
44 /** Publish the specified unicast DNS server address via mDNS. You may
45  * browse for records create this way wit
46  * catta_s_dns_server_browser_new(). */
47 int catta_server_add_dns_server_address(
48     CattaServer *s,
49     CattaSEntryGroup *g,
50     CattaIfIndex interface,
51     CattaProtocol protocol,
52     CattaPublishFlags flags,
53     const char *domain,
54     CattaDNSServerType type,
55     const CattaAddress *address,
56     uint16_t port /** should be 53 */);
57
58 /** Callback prototype for CattaSDNSServerBrowser events */
59 typedef void (*CattaSDNSServerBrowserCallback)(
60     CattaSDNSServerBrowser *b,
61     CattaIfIndex interface,
62     CattaProtocol protocol,
63     CattaBrowserEvent event,
64     const char *host_name,       /**< Host name of the DNS server, probably useless */
65     const CattaAddress *a,        /**< Address of the DNS server */
66     uint16_t port,                 /**< Port number of the DNS servers, probably 53 */
67     CattaLookupResultFlags flags,  /**< Lookup flags */
68     void* userdata);
69
70 /** Create a new CattaSDNSServerBrowser object */
71 CattaSDNSServerBrowser *catta_s_dns_server_browser_new(
72     CattaServer *server,
73     CattaIfIndex interface,
74     CattaProtocol protocol,
75     const char *domain,
76     CattaDNSServerType type,
77     CattaProtocol aprotocol,  /**< Address protocol for the DNS server */
78     CattaLookupFlags flags,                 /**< Lookup flags. */
79     CattaSDNSServerBrowserCallback callback,
80     void* userdata);
81
82 /** Free an CattaSDNSServerBrowser object */
83 void catta_s_dns_server_browser_free(CattaSDNSServerBrowser *b);
84
85 CATTA_C_DECL_END
86
87 #endif