Test runtime dir getter
[platform/upstream/glib.git] / gio / gresolver.h
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., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
22 #error "Only <gio/gio.h> can be included directly."
23 #endif
24
25 #ifndef __G_RESOLVER_H__
26 #define __G_RESOLVER_H__
27
28 #include <gio/giotypes.h>
29
30 G_BEGIN_DECLS
31
32 #define G_TYPE_RESOLVER         (g_resolver_get_type ())
33 #define G_RESOLVER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_RESOLVER, GResolver))
34 #define G_RESOLVER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_RESOLVER, GResolverClass))
35 #define G_IS_RESOLVER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_RESOLVER))
36 #define G_IS_RESOLVER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_RESOLVER))
37 #define G_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_RESOLVER, GResolverClass))
38
39 typedef struct _GResolverPrivate GResolverPrivate;
40 typedef struct _GResolverClass   GResolverClass;
41
42 struct _GResolver {
43   GObject parent_instance;
44
45   GResolverPrivate *priv;
46 };
47
48 struct _GResolverClass {
49   GObjectClass parent_class;
50
51   /* Signals */
52   void    ( *reload)                   (GResolver            *resolver);
53
54   /* Virtual methods */
55   GList * ( *lookup_by_name)           (GResolver            *resolver,
56                                         const gchar          *hostname,
57                                         GCancellable         *cancellable,
58                                         GError              **error);
59   void    ( *lookup_by_name_async)     (GResolver            *resolver,
60                                         const gchar          *hostname,
61                                         GCancellable         *cancellable,
62                                         GAsyncReadyCallback   callback,
63                                         gpointer              user_data);
64   GList * ( *lookup_by_name_finish)    (GResolver            *resolver,
65                                         GAsyncResult         *result,
66                                         GError              **error);
67
68   gchar * ( *lookup_by_address)        (GResolver            *resolver,
69                                         GInetAddress         *address,
70                                         GCancellable         *cancellable,
71                                         GError              **error);
72   void    ( *lookup_by_address_async)  (GResolver            *resolver,
73                                         GInetAddress         *address,
74                                         GCancellable         *cancellable,
75                                         GAsyncReadyCallback   callback,
76                                         gpointer              user_data);
77   gchar * ( *lookup_by_address_finish) (GResolver            *resolver,
78                                         GAsyncResult         *result,
79                                         GError              **error);
80
81   GList * ( *lookup_service)           (GResolver            *resolver,
82                                         const gchar          *rrname,
83                                         GCancellable         *cancellable,
84                                         GError              **error);
85   void    ( *lookup_service_async)     (GResolver            *resolver,
86                                         const gchar          *rrname,
87                                         GCancellable         *cancellable,
88                                         GAsyncReadyCallback   callback,
89                                         gpointer              user_data);
90   GList * ( *lookup_service_finish)    (GResolver            *resolver,
91                                         GAsyncResult         *result,
92                                         GError              **error);
93
94   /* Padding for future expansion */
95   void (*_g_reserved1) (void);
96   void (*_g_reserved2) (void);
97   void (*_g_reserved3) (void);
98   void (*_g_reserved4) (void);
99   void (*_g_reserved5) (void);
100   void (*_g_reserved6) (void);
101
102 };
103
104 GType      g_resolver_get_type                  (void) G_GNUC_CONST;
105 GResolver *g_resolver_get_default               (void);
106 void       g_resolver_set_default               (GResolver            *resolver);
107
108 GList     *g_resolver_lookup_by_name            (GResolver            *resolver,
109                                                  const gchar          *hostname,
110                                                  GCancellable         *cancellable,
111                                                  GError              **error);
112 void       g_resolver_lookup_by_name_async      (GResolver            *resolver,
113                                                  const gchar          *hostname,
114                                                  GCancellable         *cancellable,
115                                                  GAsyncReadyCallback   callback,
116                                                  gpointer              user_data);
117 GList     *g_resolver_lookup_by_name_finish     (GResolver            *resolver,
118                                                  GAsyncResult         *result,
119                                                  GError              **error);
120
121 void       g_resolver_free_addresses            (GList                *addresses);
122
123 gchar     *g_resolver_lookup_by_address         (GResolver            *resolver,
124                                                  GInetAddress         *address,
125                                                  GCancellable         *cancellable,
126                                                  GError              **error);
127 void       g_resolver_lookup_by_address_async   (GResolver            *resolver,
128                                                  GInetAddress         *address,
129                                                  GCancellable         *cancellable,
130                                                  GAsyncReadyCallback   callback,
131                                                  gpointer              user_data);
132 gchar     *g_resolver_lookup_by_address_finish  (GResolver            *resolver,
133                                                  GAsyncResult         *result,
134                                                  GError              **error);
135
136 GList     *g_resolver_lookup_service            (GResolver            *resolver,
137                                                  const gchar          *service,
138                                                  const gchar          *protocol,
139                                                  const gchar          *domain,
140                                                  GCancellable         *cancellable,
141                                                  GError              **error);
142 void       g_resolver_lookup_service_async      (GResolver            *resolver,
143                                                  const gchar          *service,
144                                                  const gchar          *protocol,
145                                                  const gchar          *domain,
146                                                  GCancellable         *cancellable,
147                                                  GAsyncReadyCallback   callback,
148                                                  gpointer              user_data);
149 GList     *g_resolver_lookup_service_finish     (GResolver            *resolver,
150                                                  GAsyncResult         *result,
151                                                  GError              **error);
152
153 void       g_resolver_free_targets              (GList                *targets);
154
155 /**
156  * G_RESOLVER_ERROR:
157  *
158  * Error domain for #GResolver. Errors in this domain will be from the
159  * #GResolverError enumeration. See #GError for more information on
160  * error domains.
161  */
162 #define G_RESOLVER_ERROR (g_resolver_error_quark ())
163 GQuark g_resolver_error_quark (void);
164
165 G_END_DECLS
166
167 #endif /* __G_RESOLVER_H__ */