1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2000-2003, Ximian, Inc.
7 #define SOUP_MESSAGE_H 1
9 #include <libsoup/soup-types.h>
10 #include <libsoup/soup-message-body.h>
11 #include <libsoup/soup-message-headers.h>
12 #include <libsoup/soup-method.h>
16 #define SOUP_TYPE_MESSAGE (soup_message_get_type ())
17 #define SOUP_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_MESSAGE, SoupMessage))
18 #define SOUP_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_MESSAGE, SoupMessageClass))
19 #define SOUP_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_MESSAGE))
20 #define SOUP_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_MESSAGE))
21 #define SOUP_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_MESSAGE, SoupMessageClass))
32 SoupMessageBody *request_body;
33 SoupMessageHeaders *request_headers;
35 SoupMessageBody *response_body;
36 SoupMessageHeaders *response_headers;
40 GObjectClass parent_class;
43 void (*wrote_informational) (SoupMessage *msg);
44 void (*wrote_headers) (SoupMessage *msg);
45 void (*wrote_chunk) (SoupMessage *msg);
46 void (*wrote_body) (SoupMessage *msg);
47 void (*got_informational) (SoupMessage *msg);
48 void (*got_headers) (SoupMessage *msg);
49 void (*got_chunk) (SoupMessage *msg, SoupBuffer *chunk);
50 void (*got_body) (SoupMessage *msg);
51 void (*restarted) (SoupMessage *msg);
52 void (*finished) (SoupMessage *msg);
54 /* Padding for future expansion */
55 void (*_libsoup_reserved1) (void);
56 void (*_libsoup_reserved2) (void);
57 void (*_libsoup_reserved3) (void);
58 void (*_libsoup_reserved4) (void);
61 GType soup_message_get_type (void);
63 #define SOUP_MESSAGE_METHOD "method"
64 #define SOUP_MESSAGE_URI "uri"
65 #define SOUP_MESSAGE_HTTP_VERSION "http-version"
66 #define SOUP_MESSAGE_FLAGS "flags"
67 #define SOUP_MESSAGE_SERVER_SIDE "server-side"
68 #define SOUP_MESSAGE_STATUS_CODE "status-code"
69 #define SOUP_MESSAGE_REASON_PHRASE "reason-phrase"
71 SoupMessage *soup_message_new (const char *method,
72 const char *uri_string);
73 SoupMessage *soup_message_new_from_uri (const char *method,
76 void soup_message_set_request (SoupMessage *msg,
77 const char *content_type,
78 SoupMemoryUse req_use,
81 void soup_message_set_response (SoupMessage *msg,
82 const char *content_type,
83 SoupMemoryUse resp_use,
84 const char *resp_body,
92 void soup_message_set_http_version (SoupMessage *msg,
93 SoupHTTPVersion version);
94 SoupHTTPVersion soup_message_get_http_version (SoupMessage *msg);
96 gboolean soup_message_is_keepalive (SoupMessage *msg);
98 SoupURI *soup_message_get_uri (SoupMessage *msg);
99 void soup_message_set_uri (SoupMessage *msg,
101 SoupAddress *soup_message_get_address (SoupMessage *msg);
104 SOUP_MESSAGE_NO_REDIRECT = (1 << 1),
105 #ifndef LIBSOUP_DISABLE_DEPRECATED
106 SOUP_MESSAGE_OVERWRITE_CHUNKS = (1 << 3),
108 SOUP_MESSAGE_CONTENT_DECODED = (1 << 4)
111 void soup_message_set_flags (SoupMessage *msg,
112 SoupMessageFlags flags);
114 SoupMessageFlags soup_message_get_flags (SoupMessage *msg);
116 /* Specialized signal handlers */
117 guint soup_message_add_header_handler (SoupMessage *msg,
123 guint soup_message_add_status_code_handler (
133 void soup_message_set_status (SoupMessage *msg,
136 void soup_message_set_status_full (SoupMessage *msg,
138 const char *reason_phrase);
141 typedef SoupBuffer * (*SoupChunkAllocator) (SoupMessage *msg,
145 void soup_message_set_chunk_allocator (SoupMessage *msg,
146 SoupChunkAllocator allocator,
148 GDestroyNotify destroy_notify);
150 void soup_message_disable_feature (SoupMessage *msg,
153 void soup_message_wrote_informational (SoupMessage *msg);
154 void soup_message_wrote_headers (SoupMessage *msg);
155 void soup_message_wrote_chunk (SoupMessage *msg);
156 void soup_message_wrote_body_data (SoupMessage *msg, SoupBuffer *chunk);
157 void soup_message_wrote_body (SoupMessage *msg);
158 void soup_message_got_informational (SoupMessage *msg);
159 void soup_message_got_headers (SoupMessage *msg);
160 void soup_message_got_chunk (SoupMessage *msg, SoupBuffer *chunk);
161 void soup_message_got_body (SoupMessage *msg);
162 void soup_message_content_sniffed (SoupMessage *msg, const char *content_type, GHashTable *params);
163 void soup_message_restarted (SoupMessage *msg);
164 void soup_message_finished (SoupMessage *msg);
168 #endif /*SOUP_MESSAGE_H*/