Revert "GIOScheduler: Avoid constant iteration over pending job list"
[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   GList * ( *lookup_records)           (GResolver            *resolver,
95                                         const gchar          *rrname,
96                                         GResolverRecordType   record_type,
97                                         GCancellable         *cancellable,
98                                         GError              **error);
99
100   void    ( *lookup_records_async)     (GResolver            *resolver,
101                                         const gchar          *rrname,
102                                         GResolverRecordType   record_type,
103                                         GCancellable         *cancellable,
104                                         GAsyncReadyCallback   callback,
105                                         gpointer              user_data);
106
107   GList * ( *lookup_records_finish)    (GResolver            *resolver,
108                                         GAsyncResult         *result,
109                                         GError              **error);
110
111   /* Padding for future expansion */
112   void (*_g_reserved4) (void);
113   void (*_g_reserved5) (void);
114   void (*_g_reserved6) (void);
115
116 };
117
118 GType      g_resolver_get_type                  (void) G_GNUC_CONST;
119 GResolver *g_resolver_get_default               (void);
120 void       g_resolver_set_default               (GResolver            *resolver);
121
122 GList     *g_resolver_lookup_by_name            (GResolver            *resolver,
123                                                  const gchar          *hostname,
124                                                  GCancellable         *cancellable,
125                                                  GError              **error);
126 void       g_resolver_lookup_by_name_async      (GResolver            *resolver,
127                                                  const gchar          *hostname,
128                                                  GCancellable         *cancellable,
129                                                  GAsyncReadyCallback   callback,
130                                                  gpointer              user_data);
131 GList     *g_resolver_lookup_by_name_finish     (GResolver            *resolver,
132                                                  GAsyncResult         *result,
133                                                  GError              **error);
134
135 void       g_resolver_free_addresses            (GList                *addresses);
136
137 gchar     *g_resolver_lookup_by_address         (GResolver            *resolver,
138                                                  GInetAddress         *address,
139                                                  GCancellable         *cancellable,
140                                                  GError              **error);
141 void       g_resolver_lookup_by_address_async   (GResolver            *resolver,
142                                                  GInetAddress         *address,
143                                                  GCancellable         *cancellable,
144                                                  GAsyncReadyCallback   callback,
145                                                  gpointer              user_data);
146 gchar     *g_resolver_lookup_by_address_finish  (GResolver            *resolver,
147                                                  GAsyncResult         *result,
148                                                  GError              **error);
149
150 GList     *g_resolver_lookup_service            (GResolver            *resolver,
151                                                  const gchar          *service,
152                                                  const gchar          *protocol,
153                                                  const gchar          *domain,
154                                                  GCancellable         *cancellable,
155                                                  GError              **error);
156 void       g_resolver_lookup_service_async      (GResolver            *resolver,
157                                                  const gchar          *service,
158                                                  const gchar          *protocol,
159                                                  const gchar          *domain,
160                                                  GCancellable         *cancellable,
161                                                  GAsyncReadyCallback   callback,
162                                                  gpointer              user_data);
163 GList     *g_resolver_lookup_service_finish     (GResolver            *resolver,
164                                                  GAsyncResult         *result,
165                                                  GError              **error);
166
167 GLIB_AVAILABLE_IN_2_34
168 GList     *g_resolver_lookup_records            (GResolver            *resolver,
169                                                  const gchar          *rrname,
170                                                  GResolverRecordType   record_type,
171                                                  GCancellable         *cancellable,
172                                                  GError              **error);
173 GLIB_AVAILABLE_IN_2_34
174 void       g_resolver_lookup_records_async      (GResolver            *resolver,
175                                                  const gchar          *rrname,
176                                                  GResolverRecordType   record_type,
177                                                  GCancellable         *cancellable,
178                                                  GAsyncReadyCallback   callback,
179                                                  gpointer              user_data);
180 GLIB_AVAILABLE_IN_2_34
181 GList     *g_resolver_lookup_records_finish     (GResolver            *resolver,
182                                                  GAsyncResult         *result,
183                                                  GError              **error);
184
185 void       g_resolver_free_targets              (GList                *targets);
186
187 /**
188  * G_RESOLVER_ERROR:
189  *
190  * Error domain for #GResolver. Errors in this domain will be from the
191  * #GResolverError enumeration. See #GError for more information on
192  * error domains.
193  */
194 #define G_RESOLVER_ERROR (g_resolver_error_quark ())
195 GQuark g_resolver_error_quark (void);
196
197 G_END_DECLS
198
199 #endif /* __G_RESOLVER_H__ */