DA: Skip initializing failed_bssids list when eapol failure case
[platform/upstream/connman.git] / gweb / gresolv.h
1 /*
2  *
3  *  Resolver library with GLib integration
4  *
5  *  Copyright (C) 2009-2012  Intel Corporation. All rights reserved.
6  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef __G_RESOLV_H
23 #define __G_RESOLV_H
24
25 #include <stdbool.h>
26 #include <stdint.h>
27
28 #include <glib.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 struct _GResolv;
35
36 typedef struct _GResolv GResolv;
37
38 typedef enum {
39         G_RESOLV_RESULT_STATUS_SUCCESS,
40         G_RESOLV_RESULT_STATUS_ERROR,
41         G_RESOLV_RESULT_STATUS_NO_RESPONSE,
42         G_RESOLV_RESULT_STATUS_FORMAT_ERROR,
43         G_RESOLV_RESULT_STATUS_SERVER_FAILURE,
44         G_RESOLV_RESULT_STATUS_NAME_ERROR,
45         G_RESOLV_RESULT_STATUS_NOT_IMPLEMENTED,
46         G_RESOLV_RESULT_STATUS_REFUSED,
47         G_RESOLV_RESULT_STATUS_NO_ANSWER,
48 } GResolvResultStatus;
49
50 typedef void (*GResolvResultFunc)(GResolvResultStatus status,
51                                         char **results, gpointer user_data);
52
53 typedef void (*GResolvDebugFunc)(const char *str, gpointer user_data);
54
55 GResolv *g_resolv_new(int index);
56
57 GResolv *g_resolv_ref(GResolv *resolv);
58 void g_resolv_unref(GResolv *resolv);
59
60 void g_resolv_set_debug(GResolv *resolv,
61                                 GResolvDebugFunc func, gpointer user_data);
62
63 bool g_resolv_add_nameserver(GResolv *resolv, const char *address,
64                                         uint16_t port, unsigned long flags);
65 void g_resolv_flush_nameservers(GResolv *resolv);
66
67 guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
68                                 GResolvResultFunc func, gpointer user_data);
69
70 bool g_resolv_cancel_lookup(GResolv *resolv, guint id);
71
72 bool g_resolv_set_address_family(GResolv *resolv, int family);
73
74 #ifdef __cplusplus
75 }
76 #endif
77
78 #endif /* __G_RESOLV_H */