• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/avahi-0.6.25/avahi-compat-howl/include/corby/
1#ifndef _sw_corby_buffer_h
2#define _sw_corby_buffer_h
3
4/*
5 * Copyright 2003, 2004 Porchdog Software. All rights reserved.
6 *
7 *	Redistribution and use in source and binary forms, with or without modification,
8 *	are permitted provided that the following conditions are met:
9 *
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.
15 *
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.
26 *
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.
30 */
31
32#include <salt/salt.h>
33#include <corby/corby.h>
34
35
36#ifdef __cplusplus
37extern "C"
38{
39#endif
40
41
42struct										_sw_corby_buffer;
43typedef struct _sw_corby_buffer	*	sw_corby_buffer;
44struct										_sw_corby_object;
45typedef sw_opaque							sw_corby_buffer_delegate;
46typedef sw_opaque							sw_corby_buffer_observer;
47
48
49typedef enum _sw_corby_buffer_pad
50{
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;
58
59
60typedef sw_result
61(HOWL_API* sw_corby_buffer_written_func)(
62								sw_corby_buffer_observer	observer,
63								sw_corby_buffer				buffer,
64								sw_result						result,
65								sw_size_t						bytesWritten,
66								sw_opaque_t						extra);
67
68
69typedef sw_result
70(HOWL_API* sw_corby_buffer_overflow_func)(
71								sw_corby_buffer_delegate	delegate,
72								sw_corby_buffer				buffer,
73								sw_uint8						octet,
74								sw_uint8					**	base,
75								sw_uint8					**	bptr,
76								sw_uint8					**	eptr,
77								sw_uint8					**	end,
78								sw_opaque_t						extra);
79
80
81typedef sw_result
82(HOWL_API* sw_corby_buffer_underflow_func)(
83								sw_corby_buffer_delegate	delegate,
84								sw_corby_buffer				buffer,
85								sw_uint8					*	octet,
86								sw_uint8					**	base,
87								sw_uint8					**	bptr,
88								sw_uint8					**	eptr,
89								sw_uint8					**	end,
90								sw_opaque_t						extra);
91
92
93sw_result HOWL_API
94sw_corby_buffer_init(
95				sw_corby_buffer	*	self);
96
97
98sw_result HOWL_API
99sw_corby_buffer_init_with_size(
100				sw_corby_buffer	*	self,
101				sw_size_t				size);
102
103
104sw_result HOWL_API
105sw_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,
110				sw_opaque_t								extra);
111
112
113sw_result HOWL_API
114sw_corby_buffer_init_with_size_and_delegate(
115				sw_corby_buffer					*	self,
116				sw_size_t								size,
117				sw_corby_buffer_delegate			delegate,
118				sw_corby_buffer_overflow_func		overflow,
119				sw_corby_buffer_underflow_func	underflow,
120				sw_opaque_t								extra);
121
122
123sw_result HOWL_API
124sw_corby_buffer_fina(
125				sw_corby_buffer	self);
126
127
128void HOWL_API
129sw_corby_buffer_reset(
130				sw_corby_buffer	self);
131
132
133sw_result HOWL_API
134sw_corby_buffer_set_octets(
135				sw_corby_buffer	self,
136				sw_octets			octets,
137				sw_size_t			size);
138
139
140sw_octets HOWL_API
141sw_corby_buffer_octets(
142				sw_corby_buffer	self);
143
144
145sw_size_t HOWL_API
146sw_corby_buffer_bytes_used(
147				sw_corby_buffer	self);
148
149
150sw_size_t HOWL_API
151sw_corby_buffer_size(
152				sw_corby_buffer	self);
153
154
155sw_result HOWL_API
156sw_corby_buffer_put_int8(
157				sw_corby_buffer	self,
158				sw_int8			val);
159
160
161sw_result HOWL_API
162sw_corby_buffer_put_uint8(
163				sw_corby_buffer	self,
164				sw_uint8			val);
165
166
167sw_result HOWL_API
168sw_corby_buffer_put_int16(
169				sw_corby_buffer	self,
170				sw_int16			val);
171
172
173sw_result HOWL_API
174sw_corby_buffer_put_uint16(
175				sw_corby_buffer	self,
176				sw_uint16			val);
177
178
179sw_result HOWL_API
180sw_corby_buffer_put_int32(
181				sw_corby_buffer	self,
182				sw_int32			val);
183
184
185sw_result HOWL_API
186sw_corby_buffer_put_uint32(
187				sw_corby_buffer	self,
188				sw_uint32			val);
189
190
191sw_result HOWL_API
192sw_corby_buffer_put_octets(
193				sw_corby_buffer	self,
194				sw_const_octets	val,
195				sw_size_t			size);
196
197
198sw_result HOWL_API
199sw_corby_buffer_put_sized_octets(
200				sw_corby_buffer	self,
201				sw_const_octets	val,
202				sw_uint32			len);
203
204
205sw_result HOWL_API
206sw_corby_buffer_put_cstring(
207				sw_corby_buffer	self,
208				sw_const_string	val);
209
210
211sw_result HOWL_API
212sw_corby_buffer_put_object(
213				sw_corby_buffer						self,
214				const struct _sw_corby_object	*	object);
215
216
217sw_result HOWL_API
218sw_corby_buffer_put_pad(
219				sw_corby_buffer						self,
220				sw_corby_buffer_pad					pad);
221
222
223sw_result HOWL_API
224sw_corby_buffer_get_int8(
225				sw_corby_buffer	self,
226				sw_int8		*	val);
227
228
229sw_result HOWL_API
230sw_corby_buffer_get_uint8(
231				sw_corby_buffer	self,
232				sw_uint8		*	val);
233
234
235sw_result HOWL_API
236sw_corby_buffer_get_int16(
237				sw_corby_buffer	self,
238				sw_int16		*	val,
239            sw_uint8			endian);
240
241
242sw_result HOWL_API
243sw_corby_buffer_get_uint16(
244				sw_corby_buffer	self,
245				sw_uint16		*	val,
246            sw_uint8			endian);
247
248
249sw_result HOWL_API
250sw_corby_buffer_get_int32(
251				sw_corby_buffer	self,
252				sw_int32		*	val,
253            sw_uint8			endian);
254
255
256sw_result HOWL_API
257sw_corby_buffer_get_uint32(
258				sw_corby_buffer	self,
259				sw_uint32		*	val,
260            sw_uint8			endian);
261
262
263sw_result HOWL_API
264sw_corby_buffer_get_octets(
265				sw_corby_buffer	self,
266				sw_octets			octets,
267				sw_size_t			size);
268
269
270sw_result HOWL_API
271sw_corby_buffer_allocate_and_get_sized_octets(
272				sw_corby_buffer	self,
273				sw_octets		*	val,
274				sw_uint32		*	size,
275            sw_uint8			endian);
276
277
278sw_result HOWL_API
279sw_corby_buffer_get_zerocopy_sized_octets(
280				sw_corby_buffer	self,
281				sw_octets		*	val,
282				sw_uint32		*	size,
283				sw_uint8			endian);
284
285
286sw_result HOWL_API
287sw_corby_buffer_get_sized_octets(
288				sw_corby_buffer	self,
289				sw_octets			val,
290				sw_uint32		*	len,
291            sw_uint8			endian);
292
293
294sw_result HOWL_API
295sw_corby_buffer_allocate_and_get_cstring(
296				sw_corby_buffer	self,
297				sw_string		*	val,
298				sw_uint32		*	len,
299				sw_uint8			endian);
300
301
302sw_result HOWL_API
303sw_corby_buffer_get_zerocopy_cstring(
304				sw_corby_buffer	self,
305				sw_string		*	val,
306				sw_uint32		*	len,
307				sw_uint8			endian);
308
309
310sw_result HOWL_API
311sw_corby_buffer_get_cstring(
312				sw_corby_buffer	self,
313				sw_string			val,
314				sw_uint32		*	len,
315				sw_uint8			endian);
316
317
318sw_result HOWL_API
319sw_corby_buffer_get_object(
320				sw_corby_buffer				self,
321				struct _sw_corby_object	**	object,
322				sw_uint8						endian);
323
324
325#ifdef __cplusplus
326}
327#endif
328
329
330#endif
331