1178479Sjb/*
2178479Sjb * CDDL HEADER START
3178479Sjb *
4178479Sjb * The contents of this file are subject to the terms of the
5178479Sjb * Common Development and Distribution License, Version 1.0 only
6178479Sjb * (the "License").  You may not use this file except in compliance
7178479Sjb * with the License.
8178479Sjb *
9178479Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10178479Sjb * or http://www.opensolaris.org/os/licensing.
11178479Sjb * See the License for the specific language governing permissions
12178479Sjb * and limitations under the License.
13178479Sjb *
14178479Sjb * When distributing Covered Code, include this CDDL HEADER in each
15178479Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16178479Sjb * If applicable, add the following below this CDDL HEADER, with the
17178479Sjb * fields enclosed by brackets "[]" replaced with your own identifying
18178479Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
19178479Sjb *
20178479Sjb * CDDL HEADER END
21178479Sjb */
22178479Sjb/*
23178479Sjb * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24178479Sjb * Use is subject to license terms.
25178479Sjb */
26178479Sjb
27178479Sjb#ifndef	_DT_BUF_H
28178479Sjb#define	_DT_BUF_H
29178479Sjb
30178479Sjb#pragma ident	"%Z%%M%	%I%	%E% SMI"
31178479Sjb
32178479Sjb#ifdef	__cplusplus
33178479Sjbextern "C" {
34178479Sjb#endif
35178479Sjb
36178479Sjb#include <dtrace.h>
37178479Sjb
38178479Sjbtypedef struct dt_buf {
39178479Sjb	const char *dbu_name;	/* string name for debugging */
40178479Sjb	uchar_t *dbu_buf;	/* buffer base address */
41178479Sjb	uchar_t *dbu_ptr;	/* current buffer location */
42178479Sjb	size_t dbu_len;		/* buffer size in bytes */
43178479Sjb	int dbu_err;		/* errno value if error */
44178479Sjb	int dbu_resizes;	/* number of resizes */
45178479Sjb} dt_buf_t;
46178479Sjb
47178479Sjbextern void dt_buf_create(dtrace_hdl_t *, dt_buf_t *, const char *, size_t);
48178479Sjbextern void dt_buf_destroy(dtrace_hdl_t *, dt_buf_t *);
49178479Sjbextern void dt_buf_reset(dtrace_hdl_t *, dt_buf_t *);
50178479Sjb
51178479Sjbextern void dt_buf_write(dtrace_hdl_t *, dt_buf_t *,
52178479Sjb    const void *, size_t, size_t);
53178479Sjb
54178479Sjbextern void dt_buf_concat(dtrace_hdl_t *, dt_buf_t *,
55178479Sjb    const dt_buf_t *, size_t);
56178479Sjb
57178479Sjbextern size_t dt_buf_offset(const dt_buf_t *, size_t);
58178479Sjbextern size_t dt_buf_len(const dt_buf_t *);
59178479Sjb
60178479Sjbextern int dt_buf_error(const dt_buf_t *);
61178479Sjbextern void *dt_buf_ptr(const dt_buf_t *);
62178479Sjb
63178479Sjbextern void *dt_buf_claim(dtrace_hdl_t *, dt_buf_t *);
64178479Sjb
65178479Sjb#ifdef	__cplusplus
66178479Sjb}
67178479Sjb#endif
68178479Sjb
69178479Sjb#endif	/* _DT_BUF_H */
70