DA: Skip initializing failed_bssids list when eapol failure case
[platform/upstream/connman.git] / gweb / gweb.h
1 /*
2  *
3  *  Web service 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_WEB_H
23 #define __G_WEB_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 _GWeb;
35 struct _GWebResult;
36 struct _GWebParser;
37
38 typedef struct _GWeb GWeb;
39 typedef struct _GWebResult GWebResult;
40 typedef struct _GWebParser GWebParser;
41
42 typedef bool (*GWebResultFunc)(GWebResult *result, gpointer user_data);
43
44 typedef bool (*GWebRouteFunc)(const char *addr, int ai_family,
45                 int if_index, gpointer user_data);
46
47 typedef bool (*GWebInputFunc)(const guint8 **data, gsize *length,
48                                                         gpointer user_data);
49
50 typedef void (*GWebDebugFunc)(const char *str, gpointer user_data);
51
52 GWeb *g_web_new(int index);
53
54 GWeb *g_web_ref(GWeb *web);
55 void g_web_unref(GWeb *web);
56
57 void g_web_set_debug(GWeb *web, GWebDebugFunc func, gpointer user_data);
58
59 bool g_web_supports_tls(void);
60
61 bool g_web_set_proxy(GWeb *web, const char *proxy);
62
63 bool g_web_set_address_family(GWeb *web, int family);
64
65 bool g_web_add_nameserver(GWeb *web, const char *address);
66
67 bool g_web_set_accept(GWeb *web, const char *format, ...)
68                                 __attribute__((format(printf, 2, 3)));
69 bool g_web_set_user_agent(GWeb *web, const char *format, ...)
70                                 __attribute__((format(printf, 2, 3)));
71 bool g_web_set_ua_profile(GWeb *web, const char *profile);
72
73 bool g_web_set_http_version(GWeb *web, const char *version);
74
75 void g_web_set_close_connection(GWeb *web, bool enabled);
76 bool g_web_get_close_connection(GWeb *web);
77
78 guint g_web_request_get(GWeb *web, const char *url,
79                                 GWebResultFunc func, GWebRouteFunc route,
80                                 gpointer user_data);
81 guint g_web_request_post(GWeb *web, const char *url,
82                                 const char *type, GWebInputFunc input,
83                                 GWebResultFunc func, gpointer user_data);
84 guint g_web_request_post_file(GWeb *web, const char *url,
85                                 const char *type, const char *file,
86                                 GWebResultFunc func, gpointer user_data);
87
88 bool g_web_cancel_request(GWeb *web, guint id);
89
90 guint16 g_web_result_get_status(GWebResult *result);
91
92 bool g_web_result_get_header(GWebResult *result,
93                                 const char *header, const char **value);
94 bool g_web_result_get_chunk(GWebResult *result,
95                                 const guint8 **chunk, gsize *length);
96
97 typedef void (*GWebParserFunc)(const char *str, gpointer user_data);
98
99 GWebParser *g_web_parser_new(const char *begin, const char *end,
100                                 GWebParserFunc func, gpointer user_data);
101
102 GWebParser *g_web_parser_ref(GWebParser *parser);
103 void g_web_parser_unref(GWebParser *parser);
104
105 void g_web_parser_feed_data(GWebParser *parser,
106                                 const guint8 *data, gsize length);
107 void g_web_parser_end_data(GWebParser *parser);
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif /* __G_WEB_H */