2010-10-13 Sergio Villar Senin <svillar@igalia.com>
[WebKit-https.git] / WebCore / platform / network / soup / cache / soup-requester.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2010 Igalia S.L.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library 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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef WEBKIT_SOUP_REQUESTER_H
22 #define WEBKIT_SOUP_REQUESTER_H 1
23
24 #include "soup-request.h"
25 #include <libsoup/soup.h>
26
27 G_BEGIN_DECLS
28
29 #define WEBKIT_TYPE_SOUP_REQUESTER            (webkit_soup_requester_get_type ())
30 #define WEBKIT_SOUP_REQUESTER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_SOUP_REQUESTER, WebKitSoupRequester))
31 #define WEBKIT_SOUP_REQUESTER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), WEBKIT_TYPE_SOUP_REQUESTER, WebKitSoupRequesterClass))
32 #define WEBKIT_IS_SOUP_REQUESTER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_SOUP_REQUESTER))
33 #define WEBKIT_IS_SOUP_REQUESTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), WEBKIT_TYPE_SOUP_REQUESTER))
34 #define WEBKIT_SOUP_REQUESTER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), WEBKIT_TYPE_SOUP_REQUESTER, WebKitSoupRequesterClass))
35
36 #define WEBKIT_SOUP_ERROR webkit_soup_error_quark ()
37
38 typedef enum {
39         WEBKIT_SOUP_ERROR_BAD_URI,
40         WEBKIT_SOUP_ERROR_UNSUPPORTED_URI_SCHEME
41 } WebKitSoupError;
42
43 typedef struct _WebKitSoupRequester WebKitSoupRequester;
44 typedef struct _WebKitSoupRequesterPrivate WebKitSoupRequesterPrivate;
45
46 struct _WebKitSoupRequester {
47         GObject parent;
48
49         WebKitSoupRequesterPrivate *priv;
50 };
51
52 typedef struct {
53         GObjectClass parent_class;
54 } WebKitSoupRequesterClass;
55
56 GType webkit_soup_requester_get_type (void);
57
58 WebKitSoupRequester *webkit_soup_requester_new (void);
59
60 GQuark webkit_soup_error_quark (void);
61
62 WebKitSoupRequest *webkit_soup_requester_request (WebKitSoupRequester *requester,
63                                                   const char *uriString,
64                                                   SoupSession *session,
65                                                   GError **error);
66
67 WebKitSoupRequest *webkit_soup_requester_request_uri (WebKitSoupRequester *requester,
68                                                       SoupURI *uri,
69                                                       SoupSession *session,
70                                                       GError **error);
71
72 void webkit_soup_requester_add_protocol (WebKitSoupRequester *requester,
73                                          const char  *scheme,
74                                          GType request_type);
75
76 void webkit_soup_requester_remove_protocol (WebKitSoupRequester *requester,
77                                             const char  *scheme);
78
79 G_END_DECLS
80
81 #endif /* WEBKIT_SOUP_REQUESTER_H */