1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2008 Red Hat, Inc.
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 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
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22 
23 #ifndef __G_VFS_DNS_SD_RESOLVER_H__
24 #define __G_VFS_DNS_SD_RESOLVER_H__
25 
26 #include <gio/gio.h>
27 
28 G_BEGIN_DECLS
29 
30 #define G_VFS_TYPE_DNS_SD_RESOLVER         (g_vfs_dns_sd_resolver_get_type ())
31 #define G_VFS_DNS_SD_RESOLVER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_DNS_SD_RESOLVER, GVfsDnsSdResolver))
32 #define G_VFS_DNS_SD_RESOLVER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_DNS_SD_RESOLVER, GVfsDnsSdResolverClass))
33 #define G_VFS_IS_DNS_SD_RESOLVER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_DNS_SD_RESOLVER))
34 #define G_VFS_IS_DNS_SD_RESOLVER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_DNS_SD_RESOLVER))
35 #define G_VFS_DNS_SD_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_DNS_SD_RESOLVER, GVfsDnsSdResolverClass))
36 
37 /**
38  * GVfsDnsSdResolver:
39  *
40  * Resolves DNS-SD triples.
41  */
42 typedef struct _GVfsDnsSdResolver        GVfsDnsSdResolver;
43 typedef struct _GVfsDnsSdResolverClass   GVfsDnsSdResolverClass;
44 
45 GType                g_vfs_dns_sd_resolver_get_type               (void) G_GNUC_CONST;
46 GVfsDnsSdResolver   *g_vfs_dns_sd_resolver_new_for_encoded_triple (const gchar        *encoded_triple,
47                                                                    const gchar        *required_txt_keys);
48 GVfsDnsSdResolver   *g_vfs_dns_sd_resolver_new_for_service        (const gchar        *service_name,
49                                                                    const gchar        *service_type,
50                                                                    const gchar        *domain,
51                                                                    const gchar        *required_txt_keys);
52 const gchar         *g_vfs_dns_sd_resolver_get_encoded_triple     (GVfsDnsSdResolver  *resolver);
53 const gchar         *g_vfs_dns_sd_resolver_get_service_name       (GVfsDnsSdResolver  *resolver);
54 const gchar         *g_vfs_dns_sd_resolver_get_service_type       (GVfsDnsSdResolver  *resolver);
55 const gchar         *g_vfs_dns_sd_resolver_get_domain             (GVfsDnsSdResolver  *resolver);
56 const gchar         *g_vfs_dns_sd_resolver_get_required_txt_keys  (GVfsDnsSdResolver  *resolver);
57 
58 void                 g_vfs_dns_sd_resolver_resolve                (GVfsDnsSdResolver  *resolver,
59                                                                    GCancellable       *cancellable,
60                                                                    GAsyncReadyCallback callback,
61                                                                    gpointer            user_data);
62 
63 gboolean             g_vfs_dns_sd_resolver_resolve_finish         (GVfsDnsSdResolver  *resolver,
64                                                                    GAsyncResult       *res,
65                                                                    GError            **error);
66 
67 gboolean             g_vfs_dns_sd_resolver_resolve_sync           (GVfsDnsSdResolver  *resolver,
68                                                                    GCancellable       *cancellable,
69                                                                    GError            **error);
70 
71 gboolean             g_vfs_dns_sd_resolver_is_resolved            (GVfsDnsSdResolver  *resolver);
72 gchar               *g_vfs_dns_sd_resolver_get_address            (GVfsDnsSdResolver  *resolver);
73 gchar               *g_vfs_dns_sd_resolver_get_interface          (GVfsDnsSdResolver  *resolver);
74 guint                g_vfs_dns_sd_resolver_get_port               (GVfsDnsSdResolver  *resolver);
75 gchar              **g_vfs_dns_sd_resolver_get_txt_records        (GVfsDnsSdResolver  *resolver);
76 gchar               *g_vfs_dns_sd_resolver_lookup_txt_record      (GVfsDnsSdResolver  *resolver,
77                                                                    const gchar        *key);
78 
79 G_END_DECLS
80 
81 #endif /* __G_VFS_DNS_SD_RESOLVER_H__ */
82