Git init
[profile/ivi/libsoup2.4.git] / libsoup / soup-request.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2009, 2010 Red Hat, Inc.
4  * Copyright (C) 2010 Igalia, S.L.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef SOUP_REQUEST_H
23 #define SOUP_REQUEST_H 1
24
25 #ifdef LIBSOUP_USE_UNSTABLE_REQUEST_API
26
27 #include <gio/gio.h>
28
29 #include <libsoup/soup-types.h>
30
31 G_BEGIN_DECLS
32
33 #define SOUP_TYPE_REQUEST            (soup_request_get_type ())
34 #define SOUP_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_REQUEST, SoupRequest))
35 #define SOUP_REQUEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_REQUEST, SoupRequestClass))
36 #define SOUP_IS_REQUEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_REQUEST))
37 #define SOUP_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_REQUEST))
38 #define SOUP_REQUEST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_REQUEST, SoupRequestClass))
39
40 typedef struct _SoupRequest SoupRequest;
41 typedef struct _SoupRequestPrivate SoupRequestPrivate;
42 typedef struct _SoupRequestClass SoupRequestClass;
43
44 struct _SoupRequest {
45         GObject parent;
46
47         SoupRequestPrivate *priv;
48 };
49
50 struct _SoupRequestClass {
51         GObjectClass parent;
52
53         const char **schemes;
54
55         gboolean       (*check_uri)          (SoupRequest          *req_base,
56                                               SoupURI              *uri,
57                                               GError              **error);
58
59         GInputStream * (*send)               (SoupRequest          *request,
60                                               GCancellable         *cancellable,
61                                               GError              **error);
62         void           (*send_async)         (SoupRequest          *request,
63                                               GCancellable         *cancellable,
64                                               GAsyncReadyCallback   callback,
65                                               gpointer              user_data);
66         GInputStream * (*send_finish)        (SoupRequest          *request,
67                                               GAsyncResult         *result,
68                                               GError              **error);
69
70         goffset        (*get_content_length) (SoupRequest          *request);
71         const char *   (*get_content_type)   (SoupRequest          *request);
72 };
73
74 GType soup_request_get_type (void);
75
76 #define SOUP_REQUEST_URI     "uri"
77 #define SOUP_REQUEST_SESSION "session"
78
79 GInputStream *soup_request_send               (SoupRequest          *request,
80                                                GCancellable         *cancellable,
81                                                GError              **error);
82 void          soup_request_send_async         (SoupRequest          *request,
83                                                GCancellable         *cancellable,
84                                                GAsyncReadyCallback   callback,
85                                                gpointer              user_data);
86 GInputStream *soup_request_send_finish        (SoupRequest          *request,
87                                                GAsyncResult         *result,
88                                                GError              **error);
89
90 SoupURI      *soup_request_get_uri            (SoupRequest          *request);
91 SoupSession  *soup_request_get_session        (SoupRequest          *request);
92
93 goffset       soup_request_get_content_length (SoupRequest          *request);
94 const char   *soup_request_get_content_type   (SoupRequest          *request);
95
96 G_END_DECLS
97
98 #endif /* LIBSOUP_USE_UNSTABLE_REQUEST_API */
99
100 #endif /* SOUP_REQUEST_H */