3 * Resolver library with GLib integration
5 * Copyright (C) 2009-2012 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35 typedef struct _GResolv GResolv;
38 G_RESOLV_RESULT_STATUS_SUCCESS,
39 G_RESOLV_RESULT_STATUS_ERROR,
40 G_RESOLV_RESULT_STATUS_NO_RESPONSE,
41 G_RESOLV_RESULT_STATUS_FORMAT_ERROR,
42 G_RESOLV_RESULT_STATUS_SERVER_FAILURE,
43 G_RESOLV_RESULT_STATUS_NAME_ERROR,
44 G_RESOLV_RESULT_STATUS_NOT_IMPLEMENTED,
45 G_RESOLV_RESULT_STATUS_REFUSED,
46 } GResolvResultStatus;
48 typedef void (*GResolvResultFunc)(GResolvResultStatus status,
49 char **results, gpointer user_data);
51 typedef void (*GResolvDebugFunc)(const char *str, gpointer user_data);
53 GResolv *g_resolv_new(int index);
55 GResolv *g_resolv_ref(GResolv *resolv);
56 void g_resolv_unref(GResolv *resolv);
58 void g_resolv_set_debug(GResolv *resolv,
59 GResolvDebugFunc func, gpointer user_data);
61 gboolean g_resolv_add_nameserver(GResolv *resolv, const char *address,
62 uint16_t port, unsigned long flags);
63 void g_resolv_flush_nameservers(GResolv *resolv);
65 guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
66 GResolvResultFunc func, gpointer user_data);
68 gboolean g_resolv_cancel_lookup(GResolv *resolv, guint id);
70 gboolean g_resolv_set_address_family(GResolv *resolv, int family);
76 #endif /* __G_RESOLV_H */