1 #ifndef _sw_corby_buffer_h
2 #define _sw_corby_buffer_h
5 * Copyright 2003, 2004 Porchdog Software. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
24 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
27 * The views and conclusions contained in the software and documentation are those
28 * of the authors and should not be interpreted as representing official policies,
29 * either expressed or implied, of Porchdog Software.
32 #include <salt/salt.h>
33 #include <corby/corby.h>
42 struct _sw_corby_buffer;
43 typedef struct _sw_corby_buffer * sw_corby_buffer;
44 struct _sw_corby_object;
45 typedef sw_opaque sw_corby_buffer_delegate;
46 typedef sw_opaque sw_corby_buffer_observer;
49 typedef enum _sw_corby_buffer_pad
51 SW_CORBY_BUFFER_PAD_NONE,
52 SW_CORBY_BUFFER_PAD_ALIGN_2,
53 SW_CORBY_BUFFER_PAD_ALIGN_4,
54 SW_CORBY_BUFFER_PAD_ALIGN_8,
55 SW_CORBY_BUFFER_PAD_ALIGN_16,
56 SW_CORBY_BUFFER_PAD_ALIGN_32
57 } sw_corby_buffer_pad;
61 (HOWL_API* sw_corby_buffer_written_func)(
62 sw_corby_buffer_observer observer,
63 sw_corby_buffer buffer,
65 sw_size_t bytesWritten,
70 (HOWL_API* sw_corby_buffer_overflow_func)(
71 sw_corby_buffer_delegate delegate,
72 sw_corby_buffer buffer,
82 (HOWL_API* sw_corby_buffer_underflow_func)(
83 sw_corby_buffer_delegate delegate,
84 sw_corby_buffer buffer,
95 sw_corby_buffer * self);
99 sw_corby_buffer_init_with_size(
100 sw_corby_buffer * self,
105 sw_corby_buffer_init_with_delegate(
106 sw_corby_buffer * self,
107 sw_corby_buffer_delegate delegate,
108 sw_corby_buffer_overflow_func overflow,
109 sw_corby_buffer_underflow_func underflow,
114 sw_corby_buffer_init_with_size_and_delegate(
115 sw_corby_buffer * self,
117 sw_corby_buffer_delegate delegate,
118 sw_corby_buffer_overflow_func overflow,
119 sw_corby_buffer_underflow_func underflow,
124 sw_corby_buffer_fina(
125 sw_corby_buffer self);
129 sw_corby_buffer_reset(
130 sw_corby_buffer self);
134 sw_corby_buffer_set_octets(
135 sw_corby_buffer self,
141 sw_corby_buffer_octets(
142 sw_corby_buffer self);
146 sw_corby_buffer_bytes_used(
147 sw_corby_buffer self);
151 sw_corby_buffer_size(
152 sw_corby_buffer self);
156 sw_corby_buffer_put_int8(
157 sw_corby_buffer self,
162 sw_corby_buffer_put_uint8(
163 sw_corby_buffer self,
168 sw_corby_buffer_put_int16(
169 sw_corby_buffer self,
174 sw_corby_buffer_put_uint16(
175 sw_corby_buffer self,
180 sw_corby_buffer_put_int32(
181 sw_corby_buffer self,
186 sw_corby_buffer_put_uint32(
187 sw_corby_buffer self,
192 sw_corby_buffer_put_octets(
193 sw_corby_buffer self,
199 sw_corby_buffer_put_sized_octets(
200 sw_corby_buffer self,
206 sw_corby_buffer_put_cstring(
207 sw_corby_buffer self,
208 sw_const_string val);
212 sw_corby_buffer_put_object(
213 sw_corby_buffer self,
214 const struct _sw_corby_object * object);
218 sw_corby_buffer_put_pad(
219 sw_corby_buffer self,
220 sw_corby_buffer_pad pad);
224 sw_corby_buffer_get_int8(
225 sw_corby_buffer self,
230 sw_corby_buffer_get_uint8(
231 sw_corby_buffer self,
236 sw_corby_buffer_get_int16(
237 sw_corby_buffer self,
243 sw_corby_buffer_get_uint16(
244 sw_corby_buffer self,
250 sw_corby_buffer_get_int32(
251 sw_corby_buffer self,
257 sw_corby_buffer_get_uint32(
258 sw_corby_buffer self,
264 sw_corby_buffer_get_octets(
265 sw_corby_buffer self,
271 sw_corby_buffer_allocate_and_get_sized_octets(
272 sw_corby_buffer self,
279 sw_corby_buffer_get_zerocopy_sized_octets(
280 sw_corby_buffer self,
287 sw_corby_buffer_get_sized_octets(
288 sw_corby_buffer self,
295 sw_corby_buffer_allocate_and_get_cstring(
296 sw_corby_buffer self,
303 sw_corby_buffer_get_zerocopy_cstring(
304 sw_corby_buffer self,
311 sw_corby_buffer_get_cstring(
312 sw_corby_buffer self,
319 sw_corby_buffer_get_object(
320 sw_corby_buffer self,
321 struct _sw_corby_object ** object,