Fixed all gtk-doc moans in soup-core documentation
[platform/upstream/libsoup.git] / libsoup / soup-message.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * soup-message.h: Asyncronous Callback-based SOAP Request Queue.
4  *
5  * Authors:
6  *      Alex Graveley (alex@helixcode.com)
7  *
8  * Copyright (C) 2000, Helix Code, Inc.
9  */
10
11 #ifndef SOUP_MESSAGE_H
12 #define SOUP_MESSAGE_H 1
13
14 #include <glib.h>
15 #include "soup-context.h"
16
17 typedef enum {
18         SOUP_ERROR_NONE = 0,
19         SOUP_ERROR_CANCELLED,
20         SOUP_ERROR_CANT_CONNECT,
21         SOUP_ERROR_IO,
22         SOUP_ERROR_MALFORMED_HEADER,
23         SOUP_ERROR_CANT_AUTHENTICATE,
24         SOUP_ERROR_HANDLER
25 } SoupErrorCode;
26
27 typedef enum {
28         SOUP_STATUS_IDLE = 0,
29         SOUP_STATUS_QUEUED,
30         SOUP_STATUS_CONNECTING,
31         SOUP_STATUS_SENDING_REQUEST,
32         SOUP_STATUS_READING_RESPONSE,
33         SOUP_STATUS_FINISHED
34 } SoupTransferStatus;
35
36 typedef enum {
37         SOUP_BUFFER_SYSTEM_OWNED = 0,
38         SOUP_BUFFER_USER_OWNED,
39         SOUP_BUFFER_STATIC
40 } SoupOwnership;
41
42 typedef struct {
43         SoupOwnership  owner;
44         gchar         *body;
45         guint          length;
46 } SoupDataBuffer;
47
48 typedef gchar * SoupAction;
49
50 typedef struct _SoupMessage        SoupMessage;
51 typedef struct _SoupMessagePrivate SoupMessagePrivate;
52
53 struct _SoupMessage {
54         SoupMessagePrivate *priv;
55
56         SoupContext        *context;
57
58         SoupTransferStatus  status;
59
60         SoupAction          action;
61
62         SoupDataBuffer      request;
63         GHashTable         *request_headers;
64
65         SoupDataBuffer      response;
66         guint               response_code;
67         const gchar        *response_phrase;
68         GHashTable         *response_headers;
69 };
70
71 typedef void (*SoupCallbackFn) (SoupMessage   *req,
72                                 SoupErrorCode  err,
73                                 gpointer       user_data);
74
75 SoupMessage   *soup_message_new                (SoupContext       *context,
76                                                 SoupAction         action);
77
78 SoupMessage   *soup_message_new_full           (SoupContext       *context,
79                                                 SoupAction         action,
80                                                 SoupOwnership      req_owner,
81                                                 gchar             *req_body,
82                                                 gulong             req_length);
83
84 void           soup_message_free               (SoupMessage       *req);
85
86 void           soup_message_cancel             (SoupMessage       *req);
87
88 SoupErrorCode  soup_message_send               (SoupMessage       *msg);
89
90 void           soup_message_queue              (SoupMessage       *req, 
91                                                 SoupCallbackFn     callback, 
92                                                 gpointer           user_data);
93
94 void           soup_message_set_request_header (SoupMessage       *req,
95                                                 const gchar       *name,
96                                                 const gchar       *value);
97
98 const gchar   *soup_message_get_request_header (SoupMessage       *req,
99                                                 const gchar       *name);
100
101 void           soup_message_set_response_header (SoupMessage      *req,
102                                                  const gchar      *name,
103                                                  const gchar      *value);
104
105 const gchar   *soup_message_get_response_header (SoupMessage      *req,
106                                                  const gchar      *name);
107
108 /* FIXME: None of these are implemented yet, oh well... */
109 typedef enum {
110         SOUP_MESSAGE_FOLLOW_REDIRECT = (1 << 1),
111         SOUP_MESSAGE_NO_COOKIE       = (1 << 2),
112         SOUP_MESSAGE_PROCESS_CHUNKS  = (1 << 3)
113 } SoupMessageFlags;
114
115 void           soup_message_set_flags          (SoupMessage       *msg,
116                                                 guint              flags);
117
118 guint          soup_message_get_flags          (SoupMessage       *msg);
119
120 #endif /*SOUP_MESSAGE_H*/