| 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 | #include <gio/gio.h> |
| 26 | |
| 27 | #include <libsoup/soup-types.h> |
| 28 | |
| 29 | G_BEGIN_DECLS |
| 30 | |
| 31 | #define SOUP_TYPE_REQUEST (soup_request_get_type ()) |
| 32 | #define SOUP_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_REQUEST, SoupRequest)) |
| 33 | #define SOUP_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_REQUEST, SoupRequestClass)) |
| 34 | #define SOUP_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_REQUEST)) |
| 35 | #define SOUP_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_REQUEST)) |
| 36 | #define SOUP_REQUEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_REQUEST, SoupRequestClass)) |
| 37 | |
| 38 | typedef struct _SoupRequestPrivate SoupRequestPrivate; |
| 39 | typedef struct _SoupRequestClass SoupRequestClass; |
| 40 | |
| 41 | struct _SoupRequest { |
| 42 | GObject parent; |
| 43 | |
| 44 | SoupRequestPrivate *priv; |
| 45 | }; |
| 46 | |
| 47 | struct _SoupRequestClass { |
| 48 | GObjectClass parent; |
| 49 | |
| 50 | const char **schemes; |
| 51 | |
| 52 | gboolean (*check_uri) (SoupRequest *req_base, |
| 53 | SoupURI *uri, |
| 54 | GError **error); |
| 55 | |
| 56 | GInputStream * (*send) (SoupRequest *request, |
| 57 | GCancellable *cancellable, |
| 58 | GError **error); |
| 59 | void (*send_async) (SoupRequest *request, |
| 60 | GCancellable *cancellable, |
| 61 | GAsyncReadyCallback callback, |
| 62 | gpointer user_data); |
| 63 | GInputStream * (*send_finish) (SoupRequest *request, |
| 64 | GAsyncResult *result, |
| 65 | GError **error); |
| 66 | |
| 67 | goffset (*get_content_length) (SoupRequest *request); |
| 68 | const char * (*get_content_type) (SoupRequest *request); |
| 69 | }; |
| 70 | |
| 71 | SOUP_AVAILABLE_IN_2_34 |
| 72 | GType soup_request_get_type (void); |
| 73 | |
| 74 | #define SOUP_REQUEST_URI "uri" |
| 75 | #define SOUP_REQUEST_SESSION "session" |
| 76 | |
| 77 | SOUP_AVAILABLE_IN_2_34 |
| 78 | GInputStream *soup_request_send (SoupRequest *request, |
| 79 | GCancellable *cancellable, |
| 80 | GError **error); |
| 81 | SOUP_AVAILABLE_IN_2_34 |
| 82 | void soup_request_send_async (SoupRequest *request, |
| 83 | GCancellable *cancellable, |
| 84 | GAsyncReadyCallback callback, |
| 85 | gpointer user_data); |
| 86 | SOUP_AVAILABLE_IN_2_34 |
| 87 | GInputStream *soup_request_send_finish (SoupRequest *request, |
| 88 | GAsyncResult *result, |
| 89 | GError **error); |
| 90 | |
| 91 | SOUP_AVAILABLE_IN_2_34 |
| 92 | SoupURI *soup_request_get_uri (SoupRequest *request); |
| 93 | SOUP_AVAILABLE_IN_2_34 |
| 94 | SoupSession *soup_request_get_session (SoupRequest *request); |
| 95 | |
| 96 | SOUP_AVAILABLE_IN_2_34 |
| 97 | goffset soup_request_get_content_length (SoupRequest *request); |
| 98 | SOUP_AVAILABLE_IN_2_34 |
| 99 | const char *soup_request_get_content_type (SoupRequest *request); |
| 100 | |
| 101 | G_END_DECLS |
| 102 | |
| 103 | #endif /* __SOUP_REQUEST_H__ */ |
| 104 | |