]> git.meshlink.io Git - catta/blob - avahi-client/publish.h
make anonymous structs appear properly in doxygen
[catta] / avahi-client / publish.h
1 #ifndef fooclientpublishhfoo
2 #define fooclientpublishhfoo
3
4 /* $Id$ */
5
6 /***
7   This file is part of avahi.
8  
9   avahi is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as
11   published by the Free Software Foundation; either version 2.1 of the
12   License, or (at your option) any later version.
13  
14   avahi is distributed in the hope that it will be useful, but WITHOUT
15   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
17   Public License for more details.
18  
19   You should have received a copy of the GNU Lesser General Public
20   License along with avahi; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22   USA.
23 ***/
24
25 #include <inttypes.h>
26
27 #include <avahi-common/cdecl.h>
28 #include <avahi-common/address.h>
29 #include <avahi-common/strlst.h>
30 #include <avahi-common/defs.h>
31 #include <avahi-common/watch.h>
32 #include <avahi-common/gccmacro.h>
33
34 #include <avahi-client/client.h>
35
36 /** \file avahi-client/publish.h Publishing Client API */
37
38 /** \example client-publish-service.c Example how to register a DNS-SD
39  * service using the client interface to avahi-daemon. It behaves like a network
40  * printer registering both an IPP and a BSD LPR service. */
41
42 AVAHI_C_DECL_BEGIN
43
44 /** \struct AvahiEntryGroup An entry group object */
45 typedef struct AvahiEntryGroup AvahiEntryGroup;
46
47 /** The function prototype for the callback of an AvahiEntryGroup */
48 typedef void (*AvahiEntryGroupCallback) (
49     AvahiEntryGroup *g,
50     AvahiEntryGroupState state /**< The new state of the entry group */,
51     void* userdata /* The arbitrary user data pointer originally passed to avahi_entry_group_new()*/);
52
53 /** Create a new AvahiEntryGroup object */
54 AvahiEntryGroup* avahi_entry_group_new(
55     AvahiClient* c,
56     AvahiEntryGroupCallback callback /**< This callback is called whenever the state of this entry group changes. May not be NULL. */,
57     void *userdata /**< This arbitrary user data pointer will be passed to the callback functon */);
58
59 /** Clean up and free an AvahiEntryGroup object */
60 int avahi_entry_group_free (AvahiEntryGroup *);
61
62 /** Commit an AvahiEntryGroup. The entries in the entry group are now registered on the network. Commiting empty entry groups is considered an error. */
63 int avahi_entry_group_commit (AvahiEntryGroup*);
64
65 /** Reset an AvahiEntryGroup. This takes effect immediately. */
66 int avahi_entry_group_reset (AvahiEntryGroup*);
67
68 /** Get an AvahiEntryGroup's state */
69 int avahi_entry_group_get_state (AvahiEntryGroup*);
70
71 /** Check if an AvahiEntryGroup is empty */
72 int avahi_entry_group_is_empty (AvahiEntryGroup*);
73
74 /** Get an AvahiEntryGroup's owning client instance */
75 AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
76
77 /** Add a service. Takes a variable NULL terminated list of TXT record strings as last arguments. Please note that this service is not announced on the network before avahi_entry_group_commit() is called. */
78 int avahi_entry_group_add_service(
79     AvahiEntryGroup *group,
80     AvahiIfIndex interface /**< The interface this service shall be announced on. We recommend to pass AVAHI_IF_UNSPEC here, to announce on all interfaces. */,
81     AvahiProtocol protocol /**< The protocol this service shall be announced with, i.e. MDNS over IPV4 or MDNS over IPV6. We recommend to pass AVAHI_PROTO_UNSPEC here, to announce this service on all protocols the daemon supports. */,
82     AvahiPublishFlags flags /**< Usually 0, unless you know what you do */,
83     const char *name        /**< The name for the new service. May not be NULL. */,
84     const char *type        /**< The service type for the new service, such as _http._tcp. May not be NULL. */,
85     const char *domain      /**< The domain to register this domain in. We recommend to pass NULL here, to let the daemon decide */,   
86     const char *host        /**< The host this services is residing on. We recommend to pass NULL here, the daemon will than automatically insert the local host name in that case */,
87     uint16_t port           /**< The IP port number of this service */,
88     ...) AVAHI_GCC_SENTINEL;
89
90 /** Add a service, takes an AvahiStringList for TXT records. Arguments have the same meaning as for avahi_entry_group_add_service(). */
91 int avahi_entry_group_add_service_strlst(
92     AvahiEntryGroup *group,
93     AvahiIfIndex interface,
94     AvahiProtocol protocol,
95     AvahiPublishFlags flags,
96     const char *name,
97     const char *type,
98     const char *domain,
99     const char *host,
100     uint16_t port,
101     AvahiStringList *txt /**< The TXT data for this service. You may free this object after calling this function, it is not referenced any further */);
102
103 /** Add a subtype for a service. The service should already be existent in the entry group. You may add as many subtypes for a service as you wish. */
104 int avahi_entry_group_add_service_subtype(
105     AvahiEntryGroup *group,
106     AvahiIfIndex interface /**< The interface this subtype shall be announced on. This should match the value passed for the original avahi_entry_group_add_service() call. */,
107     AvahiProtocol protocol /**< The protocol this subtype shall be announced with. This should match the value passed for the original avahi_entry_group_add_service() call. */,
108     AvahiPublishFlags flags  /**< Only != 0 if you really know what you do */,
109     const char *name         /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
110     const char *type         /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
111     const char *domain       /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,
112     const char *subtype /**< The new subtype to register for the specified service. May not be NULL. */);
113
114 /** Update a TXT record for an existing service. The service should already be existent in the entry group. */
115 int avahi_entry_group_update_service_txt(
116     AvahiEntryGroup *g,
117     AvahiIfIndex interface   /**< The interface this service is announced on. This should match the value passed to the original avahi_entry_group_add_service() call. */,
118     AvahiProtocol protocol   /**< The protocol this service is announced with. This should match the value passed to the original avahi_entry_group_add_service() call. */,
119     AvahiPublishFlags flags  /**< Only != 0 if you really know what you do */,
120     const char *name         /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,    
121     const char *type         /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,     
122     const char *domain       /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,   
123     ...) AVAHI_GCC_SENTINEL;
124
125 /** Update a TXT record for an existing service. Similar to avahi_entry_group_update_service_txt() but takes an AvahiStringList for the TXT strings, instead of a NULL terminated list of arguments. */
126 int avahi_entry_group_update_service_txt_strlst(
127     AvahiEntryGroup *g,
128     AvahiIfIndex interface,
129     AvahiProtocol protocol,
130     AvahiPublishFlags flags,
131     const char *name,     
132     const char *type,     
133     const char *domain,   
134     AvahiStringList *strlst);
135
136 /** Add a host/address pair */
137 int avahi_entry_group_add_address(
138     AvahiEntryGroup *group,
139     AvahiIfIndex interface,
140     AvahiProtocol protocol,
141     AvahiPublishFlags flags,
142     const char *name /**< The FDQN of the new hostname to register */,
143     const AvahiAddress *a /**< The address this host name shall map to */);
144
145 /** Add an arbitrary record. I hope you know what you do. */
146 int avahi_entry_group_add_record(
147     AvahiEntryGroup *group,
148     AvahiIfIndex interface,
149     AvahiProtocol protocol,
150     AvahiPublishFlags flags,
151     const char *name,
152     uint16_t clazz,
153     uint16_t type,
154     uint32_t ttl,
155     const void *rdata,
156     size_t size);
157
158 AVAHI_C_DECL_END
159
160 #endif