gio-2.0: "address" parameter of Socket.receive_message() is optional
[vala-gnome.git] / vapi / avahi-gobject.vapi
blobcba79f07d5720538c086e32bf6c3a3c8b41ec809
1 /* avahi.vala
2  *
3  * Copyright (C) 2009  Sebastian Noack
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * As a special exception, if you use inline functions from this file, this
20  * file does not by itself cause the resulting executable to be covered by
21  * the GNU Lesser General Public License.
22  *
23  * Author:
24  *  Sebastian Noack <sebastian.noack@gmail.com>
25  */
27 [CCode(cprefix="Ga", lower_case_cprefix="ga_")]
28 namespace Avahi {
29         /* Error handling */
31         [CCode(cheader_filename="avahi-gobject/ga-error.h", cprefix="AVAHI_ERR_")]
32         public errordomain Error {
33                 FAILURE,
34                 BAD_STATE,
35                 INVALID_HOST_NAME,
36                 INVALID_DOMAIN_NAME,
37                 NO_NETWORK,
38                 INVALID_TTL,
39                 IS_PATTERN,
40                 COLLISION,
41                 INVALID_RECORD,
43                 INVALID_SERVICE_NAME,
44                 INVALID_SERVICE_TYPE,
45                 INVALID_PORT,
46                 INVALID_KEY,
47                 INVALID_ADDRESS,
48                 TIMEOUT,
49                 TOO_MANY_CLIENTS,
50                 TOO_MANY_OBJECTS,
51                 TOO_MANY_ENTRIES,
52                 OS,
54                 ACCESS_DENIED,
55                 INVALID_OPERATION,
56                 DBUS_ERROR,
57                 DISCONNECTED,
58                 NO_MEMORY,
59                 INVALID_OBJECT,
60                 NO_DAEMON,
61                 INVALID_INTERFACE,
62                 INVALID_PROTOCOL,
63                 INVALID_FLAGS,
65                 NOT_FOUND,
66                 INVALID_CONFIG,
67                 VERSION_MISMATCH,
68                 INVALID_SERVICE_SUBTYPE,
69                 INVALID_PACKET,
70                 INVALID_DNS_ERROR,
71                 DNS_FORMERR,
72                 DNS_SERVFAIL,
73                 DNS_NXDOMAIN,
74                 DNS_NOTIMP,
76                 DNS_REFUSED,
77                 DNS_YXDOMAIN,
78                 DNS_YXRRSET,
79                 DNS_NXRRSET,
80                 DNS_NOTAUTH,
81                 DNS_NOTZONE,
82                 INVALID_RDATA,
83                 INVALID_DNS_CLASS,
84                 INVALID_DNS_TYPE,
85                 NOT_SUPPORTED,
87                 NOT_PERMITTED,
88                 INVALID_ARGUMENT,
89                 IS_EMPTY,
90                 NO_CHANGE
91         }
93         [CCode(cheader_filename="avahi-gobject/ga-error.h", cname="avahi_strerror")]
94         public unowned string strerror(int errno);
97         /* Lookup flags */
99         [CCode(cheader_filename="avahi-gobject/ga-enums.h", cprefix="GA_LOOKUP_RESULT_")]
100         public enum LookupResultFlags {
101                 CACHED,
102                 WIDE_AREA,
103                 MULTICAST,
104                 LOCAL,
105                 OUR_OWN,
106                 STATIC
107         }
109         [Flags]
110         [CCode(cheader_filename="avahi-gobject/ga-enums.h", cprefix="GA_LOOKUP_")]
111         public enum LookupFlags {
112                 NO_FLAGS,
113                 USE_WIDE_AREA,
114                 USE_MULTICAST,
115                 NO_TXT,
116                 NO_ADDRESS
117         }
120         /* Client */
122         [CCode(cheader_filename="avahi-gobject/ga-client.h")]
123         public enum ClientState {
124                 NOT_STARTED,
125                 S_REGISTERING,
126                 S_RUNNING,
127                 S_COLLISION,
128                 FAILURE,
129                 CONNECTING
130         }
132         [Flags]
133         [CCode(cheader_filename="avahi-gobject/ga-client.h", cprefix="GA_CLIENT_FLAG_")]
134         public enum ClientFlags {
135                 NO_FLAGS,
136                 IGNORE_USER_CONFIG,
137                 NO_FAIL
138         }
140         [CCode(cheader_filename="avahi-gobject/ga-client.h")]
141         public class Client : GLib.Object {
142                 public Client(ClientFlags flags=ClientFlags.NO_FLAGS);
144                 public void start() throws Error;
146                 [NoAccessorMethod]
147                 public ClientState state { get; }
148                 [NoAccessorMethod]
149                 public ClientFlags flags { get; construct; }
151                 public signal void state_changed(ClientState state);
152         }
155         /* Record browser */
157         [CCode(cheader_filename="avahi-gobject/ga-record-browser.h")]
158         public class RecordBrowser : GLib.Object {
159                 public RecordBrowser(string name, uint16 type);
160                 public RecordBrowser.full(Interface interface, Protocol protocol, string name, uint16 class, uint16 type, LookupFlags flags=LookupFlags.NO_FLAGS);
162                 public void attach(Client client) throws Error;
164                 [NoAccessorMethod]
165                 public Protocol protocol { get; set; }
166                 [NoAccessorMethod]
167                 public Interface interface { get; set; }
168                 [NoAccessorMethod]
169                 public string name { owned get; set; }
170                 [NoAccessorMethod]
171                 public uint16 type { get; set; }
172                 [NoAccessorMethod]
173                 public uint16 class { get; set; }
174                 [NoAccessorMethod]
175                 public LookupFlags flags { get; set; }
177                 public signal void new_record(Interface interface, Protocol protocol, string name, uint16 class, uint16 type, char[] data, LookupResultFlags flags);
178                 public signal void removed_record(Interface interface, Protocol protocol, string name, uint16 class, uint16 type, char[] data, LookupResultFlags flags);
179                 public signal void all_for_now();
180                 public signal void cache_exhausted();
181                 public signal void failure(GLib.Error error);
182         }
185         /* Service browser */
187         [CCode(cheader_filename="avahi-gobject/ga-service-browser.h")]
188         public class ServiceBrowser : GLib.Object {
189                 public ServiceBrowser(string type);
190                 public ServiceBrowser.full(Interface interface, Protocol protocol, string type, string? domain=null, LookupFlags flags=LookupFlags.NO_FLAGS);
192                 public void attach(Client client) throws Error;
194                 [NoAccessorMethod]
195                 public Protocol protocol { get; set; }
196                 [NoAccessorMethod]
197                 public Protocol aprotocol { get; set; }
198                 [NoAccessorMethod]
199                 public Interface interface { get; set; }
200                 [NoAccessorMethod]
201                 public string type { owned get; set; }
202                 [NoAccessorMethod]
203                 public string? domain { owned get; set; }
204                 [NoAccessorMethod]
205                 public LookupFlags flags { get; set; }
207                 public signal void new_service(Interface interface, Protocol protocol, string name, string type, string domain, LookupResultFlags flags);
208                 public signal void removed_service(Interface interface, Protocol protocol, string name, string type, string domain, LookupResultFlags flags);
209                 public signal void all_for_now();
210                 public signal void cache_exhausted();
211                 public signal void failure(GLib.Error error);
212         }
215         /* Service resolver */
217         [CCode(cheader_filename="avahi-gobject/ga-service-resolver.h")]
218         public class ServiceResolver : GLib.Object {
219                 public ServiceResolver(Interface interface, Protocol protocol, string name, string type, string domain, Protocol address_protocol, LookupFlags flags=LookupFlags.NO_FLAGS);
221                 public void attach(Client client) throws Error;
222                 public bool get_address(out Address address, out uint16 port);
224                 [NoAccessorMethod]
225                 public Protocol protocol { get; set; }
226                 [NoAccessorMethod]
227                 public Protocol aprotocol { get; set; }
228                 [NoAccessorMethod]
229                 public Interface interface { get; set; }
230                 [NoAccessorMethod]
231                 public string name { owned get; set; }
232                 [NoAccessorMethod]
233                 public string type { owned get; set; }
234                 [NoAccessorMethod]
235                 public string domain { owned get; set; }
236                 [NoAccessorMethod]
237                 public LookupFlags flags { get; set; }
239                 public signal void found(Interface interface, Protocol protocol, string name, string type, string domain, string hostname, Address? address, uint16 port, StringList? txt, LookupResultFlags flags);
240                 public signal void failure(GLib.Error error);
241         }
243         [CCode(cheader_filename="avahi-gobject/ga-entry-group.h")]
244         public enum EntryGroupState {
245                 UNCOMMITED,
246                 REGISTERING,
247                 ESTABLISHED,
248                 COLLISION,
249                 FAILURE
250         }
252         [Compact]
253         [CCode(cheader_filename="avahi-gobject/ga-entry-group.h", ref_function="", unref_function="")]
254         public class EntryGroupService {
255                 public Interface interface;
256                 public Protocol protocol;
257                 public PublishFlags flags;
258                 public string name;
259                 public string type;
260                 public string domain;
261                 public string host;
262                 public uint16 port;
264                 public void freeze();
265                 public void set(string key, string value) throws Error;
266                 public void set_arbitrary(string key, char[] value) throws Error;
267                 public void remove_key(string key) throws Error;
268                 public void thaw() throws Error;
269         }
271         [CCode(cheader_filename="avahi-gobject/ga-entry-group.h")]
272         public class EntryGroup : GLib.Object {
273                 public EntryGroup();
275                 public void attach(Client client) throws Error;
276                 [CCode(sentinel="")]
277                 public EntryGroupService add_service_strlist(string name, string type, uint16 port, ...) throws Error;
278                 [CCode(sentinel="")]
279                 public EntryGroupService add_service_full_strlist(Interface interface, Protocol protocol, PublishFlags flags, string name, string type, string domain, string host, uint16 port, ...) throws Error;
280                 public EntryGroupService add_service(string name, string type, uint16 port, ...) throws Error;
281                 public EntryGroupService add_service_full(Interface interface, Protocol protocol, PublishFlags flags, string name, string type, string domain, string host, uint16 port, ...) throws Error;
282                 public void add_record(PublishFlags flags, string name, uint16 type, uint32 ttl, char[] data) throws Error;
283                 public void add_record_full(Interface interface, Protocol protocol, PublishFlags flags, string name, uint16 class, uint16 type, uint32 ttl, char[] data) throws Error;
284                 public void commit() throws Error;
285                 public void reset() throws Error;
287                 [NoAccessorMethod]
288                 public EntryGroupState state { get; }
290                 public signal void state_changed(EntryGroupState state);
291         }