| 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.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 |
| 16 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __G_RESOLVER_H__ |
| 20 | #define __G_RESOLVER_H__ |
| 21 | |
| 22 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
| 23 | #error "Only <gio/gio.h> can be included directly." |
| 24 | #endif |
| 25 | |
| 26 | #include <gio/giotypes.h> |
| 27 | |
| 28 | G_BEGIN_DECLS |
| 29 | |
| 30 | #define G_TYPE_RESOLVER (g_resolver_get_type ()) |
| 31 | #define G_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_RESOLVER, GResolver)) |
| 32 | #define G_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_RESOLVER, GResolverClass)) |
| 33 | #define G_IS_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_RESOLVER)) |
| 34 | #define G_IS_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_RESOLVER)) |
| 35 | #define G_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_RESOLVER, GResolverClass)) |
| 36 | |
| 37 | typedef struct _GResolverPrivate GResolverPrivate; |
| 38 | typedef struct _GResolverClass GResolverClass; |
| 39 | |
| 40 | struct _GResolver { |
| 41 | GObject parent_instance; |
| 42 | |
| 43 | GResolverPrivate *priv; |
| 44 | }; |
| 45 | |
| 46 | struct _GResolverClass { |
| 47 | GObjectClass parent_class; |
| 48 | |
| 49 | /* Signals */ |
| 50 | void ( *reload) (GResolver *resolver); |
| 51 | |
| 52 | /* Virtual methods */ |
| 53 | GList * ( *lookup_by_name) (GResolver *resolver, |
| 54 | const gchar *hostname, |
| 55 | GCancellable *cancellable, |
| 56 | GError **error); |
| 57 | void ( *lookup_by_name_async) (GResolver *resolver, |
| 58 | const gchar *hostname, |
| 59 | GCancellable *cancellable, |
| 60 | GAsyncReadyCallback callback, |
| 61 | gpointer user_data); |
| 62 | GList * ( *lookup_by_name_finish) (GResolver *resolver, |
| 63 | GAsyncResult *result, |
| 64 | GError **error); |
| 65 | |
| 66 | gchar * ( *lookup_by_address) (GResolver *resolver, |
| 67 | GInetAddress *address, |
| 68 | GCancellable *cancellable, |
| 69 | GError **error); |
| 70 | void ( *lookup_by_address_async) (GResolver *resolver, |
| 71 | GInetAddress *address, |
| 72 | GCancellable *cancellable, |
| 73 | GAsyncReadyCallback callback, |
| 74 | gpointer user_data); |
| 75 | gchar * ( *lookup_by_address_finish) (GResolver *resolver, |
| 76 | GAsyncResult *result, |
| 77 | GError **error); |
| 78 | |
| 79 | GList * ( *lookup_service) (GResolver *resolver, |
| 80 | const gchar *rrname, |
| 81 | GCancellable *cancellable, |
| 82 | GError **error); |
| 83 | void ( *lookup_service_async) (GResolver *resolver, |
| 84 | const gchar *rrname, |
| 85 | GCancellable *cancellable, |
| 86 | GAsyncReadyCallback callback, |
| 87 | gpointer user_data); |
| 88 | GList * ( *lookup_service_finish) (GResolver *resolver, |
| 89 | GAsyncResult *result, |
| 90 | GError **error); |
| 91 | |
| 92 | GList * ( *lookup_records) (GResolver *resolver, |
| 93 | const gchar *rrname, |
| 94 | GResolverRecordType record_type, |
| 95 | GCancellable *cancellable, |
| 96 | GError **error); |
| 97 | |
| 98 | void ( *lookup_records_async) (GResolver *resolver, |
| 99 | const gchar *rrname, |
| 100 | GResolverRecordType record_type, |
| 101 | GCancellable *cancellable, |
| 102 | GAsyncReadyCallback callback, |
| 103 | gpointer user_data); |
| 104 | |
| 105 | GList * ( *lookup_records_finish) (GResolver *resolver, |
| 106 | GAsyncResult *result, |
| 107 | GError **error); |
| 108 | |
| 109 | /* Padding for future expansion */ |
| 110 | void (*_g_reserved4) (void); |
| 111 | void (*_g_reserved5) (void); |
| 112 | void (*_g_reserved6) (void); |
| 113 | |
| 114 | }; |
| 115 | |
| 116 | GLIB_AVAILABLE_IN_ALL |
| 117 | GType g_resolver_get_type (void) G_GNUC_CONST; |
| 118 | GLIB_AVAILABLE_IN_ALL |
| 119 | GResolver *g_resolver_get_default (void); |
| 120 | GLIB_AVAILABLE_IN_ALL |
| 121 | void g_resolver_set_default (GResolver *resolver); |
| 122 | |
| 123 | GLIB_AVAILABLE_IN_ALL |
| 124 | GList *g_resolver_lookup_by_name (GResolver *resolver, |
| 125 | const gchar *hostname, |
| 126 | GCancellable *cancellable, |
| 127 | GError **error); |
| 128 | GLIB_AVAILABLE_IN_ALL |
| 129 | void g_resolver_lookup_by_name_async (GResolver *resolver, |
| 130 | const gchar *hostname, |
| 131 | GCancellable *cancellable, |
| 132 | GAsyncReadyCallback callback, |
| 133 | gpointer user_data); |
| 134 | GLIB_AVAILABLE_IN_ALL |
| 135 | GList *g_resolver_lookup_by_name_finish (GResolver *resolver, |
| 136 | GAsyncResult *result, |
| 137 | GError **error); |
| 138 | |
| 139 | GLIB_AVAILABLE_IN_ALL |
| 140 | void g_resolver_free_addresses (GList *addresses); |
| 141 | |
| 142 | GLIB_AVAILABLE_IN_ALL |
| 143 | gchar *g_resolver_lookup_by_address (GResolver *resolver, |
| 144 | GInetAddress *address, |
| 145 | GCancellable *cancellable, |
| 146 | GError **error); |
| 147 | GLIB_AVAILABLE_IN_ALL |
| 148 | void g_resolver_lookup_by_address_async (GResolver *resolver, |
| 149 | GInetAddress *address, |
| 150 | GCancellable *cancellable, |
| 151 | GAsyncReadyCallback callback, |
| 152 | gpointer user_data); |
| 153 | GLIB_AVAILABLE_IN_ALL |
| 154 | gchar *g_resolver_lookup_by_address_finish (GResolver *resolver, |
| 155 | GAsyncResult *result, |
| 156 | GError **error); |
| 157 | |
| 158 | GLIB_AVAILABLE_IN_ALL |
| 159 | GList *g_resolver_lookup_service (GResolver *resolver, |
| 160 | const gchar *service, |
| 161 | const gchar *protocol, |
| 162 | const gchar *domain, |
| 163 | GCancellable *cancellable, |
| 164 | GError **error); |
| 165 | GLIB_AVAILABLE_IN_ALL |
| 166 | void g_resolver_lookup_service_async (GResolver *resolver, |
| 167 | const gchar *service, |
| 168 | const gchar *protocol, |
| 169 | const gchar *domain, |
| 170 | GCancellable *cancellable, |
| 171 | GAsyncReadyCallback callback, |
| 172 | gpointer user_data); |
| 173 | GLIB_AVAILABLE_IN_ALL |
| 174 | GList *g_resolver_lookup_service_finish (GResolver *resolver, |
| 175 | GAsyncResult *result, |
| 176 | GError **error); |
| 177 | |
| 178 | GLIB_AVAILABLE_IN_2_34 |
| 179 | GList *g_resolver_lookup_records (GResolver *resolver, |
| 180 | const gchar *rrname, |
| 181 | GResolverRecordType record_type, |
| 182 | GCancellable *cancellable, |
| 183 | GError **error); |
| 184 | GLIB_AVAILABLE_IN_2_34 |
| 185 | void g_resolver_lookup_records_async (GResolver *resolver, |
| 186 | const gchar *rrname, |
| 187 | GResolverRecordType record_type, |
| 188 | GCancellable *cancellable, |
| 189 | GAsyncReadyCallback callback, |
| 190 | gpointer user_data); |
| 191 | GLIB_AVAILABLE_IN_2_34 |
| 192 | GList *g_resolver_lookup_records_finish (GResolver *resolver, |
| 193 | GAsyncResult *result, |
| 194 | GError **error); |
| 195 | |
| 196 | GLIB_AVAILABLE_IN_ALL |
| 197 | void g_resolver_free_targets (GList *targets); |
| 198 | |
| 199 | /** |
| 200 | * G_RESOLVER_ERROR: |
| 201 | * |
| 202 | * Error domain for #GResolver. Errors in this domain will be from the |
| 203 | * #GResolverError enumeration. See #GError for more information on |
| 204 | * error domains. |
| 205 | */ |
| 206 | #define G_RESOLVER_ERROR (g_resolver_error_quark ()) |
| 207 | GLIB_AVAILABLE_IN_ALL |
| 208 | GQuark g_resolver_error_quark (void); |
| 209 | |
| 210 | G_END_DECLS |
| 211 | |
| 212 | #endif /* __G_RESOLVER_H__ */ |
| 213 | |