1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * Copyright (C) 2000-2003, Ximian, Inc. |
4 | */ |
5 | |
6 | #ifndef __SOUP_MESSAGE_BODY_H__ |
7 | #define __SOUP_MESSAGE_BODY_H__ 1 |
8 | |
9 | #include <libsoup/soup-types.h> |
10 | |
11 | G_BEGIN_DECLS |
12 | |
13 | typedef enum { |
14 | SOUP_MEMORY_STATIC, |
15 | SOUP_MEMORY_TAKE, |
16 | SOUP_MEMORY_COPY, |
17 | SOUP_MEMORY_TEMPORARY |
18 | } SoupMemoryUse; |
19 | |
20 | typedef struct { |
21 | const char *data; |
22 | gsize length; |
23 | } SoupBuffer; |
24 | |
25 | SOUP_AVAILABLE_IN_2_4 |
26 | GType soup_buffer_get_type (void); |
27 | #define SOUP_TYPE_BUFFER (soup_buffer_get_type ()) |
28 | |
29 | SOUP_AVAILABLE_IN_2_4 |
30 | SoupBuffer *soup_buffer_new (SoupMemoryUse use, |
31 | gconstpointer data, |
32 | gsize length); |
33 | SOUP_AVAILABLE_IN_2_32 |
34 | SoupBuffer *soup_buffer_new_take (guchar *data, |
35 | gsize length); |
36 | SOUP_AVAILABLE_IN_2_4 |
37 | SoupBuffer *soup_buffer_new_subbuffer (SoupBuffer *parent, |
38 | gsize offset, |
39 | gsize length); |
40 | |
41 | SOUP_AVAILABLE_IN_2_4 |
42 | SoupBuffer *soup_buffer_new_with_owner (gconstpointer data, |
43 | gsize length, |
44 | gpointer owner, |
45 | GDestroyNotify owner_dnotify); |
46 | SOUP_AVAILABLE_IN_2_4 |
47 | gpointer soup_buffer_get_owner (SoupBuffer *buffer); |
48 | SOUP_AVAILABLE_IN_2_32 |
49 | void soup_buffer_get_data (SoupBuffer *buffer, |
50 | const guint8 **data, |
51 | gsize *length); |
52 | SOUP_AVAILABLE_IN_2_40 |
53 | GBytes *soup_buffer_get_as_bytes (SoupBuffer *buffer); |
54 | |
55 | SOUP_AVAILABLE_IN_2_4 |
56 | SoupBuffer *soup_buffer_copy (SoupBuffer *buffer); |
57 | SOUP_AVAILABLE_IN_2_4 |
58 | void soup_buffer_free (SoupBuffer *buffer); |
59 | |
60 | typedef struct { |
61 | const char *data; |
62 | goffset length; |
63 | } SoupMessageBody; |
64 | |
65 | SOUP_AVAILABLE_IN_2_4 |
66 | GType soup_message_body_get_type (void); |
67 | #define SOUP_TYPE_MESSAGE_BODY (soup_message_body_get_type ()) |
68 | |
69 | SOUP_AVAILABLE_IN_2_4 |
70 | SoupMessageBody *soup_message_body_new (void); |
71 | |
72 | SOUP_AVAILABLE_IN_2_24 |
73 | void soup_message_body_set_accumulate(SoupMessageBody *body, |
74 | gboolean accumulate); |
75 | SOUP_AVAILABLE_IN_2_24 |
76 | gboolean soup_message_body_get_accumulate(SoupMessageBody *body); |
77 | |
78 | SOUP_AVAILABLE_IN_2_4 |
79 | void soup_message_body_append (SoupMessageBody *body, |
80 | SoupMemoryUse use, |
81 | gconstpointer data, |
82 | gsize length); |
83 | SOUP_AVAILABLE_IN_2_32 |
84 | void soup_message_body_append_take (SoupMessageBody *body, |
85 | guchar *data, |
86 | gsize length); |
87 | SOUP_AVAILABLE_IN_2_4 |
88 | void soup_message_body_append_buffer (SoupMessageBody *body, |
89 | SoupBuffer *buffer); |
90 | SOUP_AVAILABLE_IN_2_4 |
91 | void soup_message_body_truncate (SoupMessageBody *body); |
92 | SOUP_AVAILABLE_IN_2_4 |
93 | void soup_message_body_complete (SoupMessageBody *body); |
94 | |
95 | SOUP_AVAILABLE_IN_2_4 |
96 | SoupBuffer *soup_message_body_flatten (SoupMessageBody *body); |
97 | |
98 | SOUP_AVAILABLE_IN_2_4 |
99 | SoupBuffer *soup_message_body_get_chunk (SoupMessageBody *body, |
100 | goffset offset); |
101 | |
102 | SOUP_AVAILABLE_IN_2_24 |
103 | void soup_message_body_got_chunk (SoupMessageBody *body, |
104 | SoupBuffer *chunk); |
105 | SOUP_AVAILABLE_IN_2_24 |
106 | void soup_message_body_wrote_chunk (SoupMessageBody *body, |
107 | SoupBuffer *chunk); |
108 | |
109 | SOUP_AVAILABLE_IN_2_4 |
110 | void soup_message_body_free (SoupMessageBody *body); |
111 | |
112 | G_END_DECLS |
113 | |
114 | #endif /* __SOUP_MESSAGE_BODY_H__ */ |
115 | |