soup-request.h 3.8 KB

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