ebuf.h revision 204076
1114987Speter/*-
2114987Speter * Copyright (c) 2009-2010 The FreeBSD Foundation
3114987Speter * All rights reserved.
4114987Speter *
5114987Speter * This software was developed by Pawel Jakub Dawidek under sponsorship from
6114987Speter * the FreeBSD Foundation.
7114987Speter *
8114987Speter * Redistribution and use in source and binary forms, with or without
9114987Speter * modification, are permitted provided that the following conditions
10114987Speter * are met:
11114987Speter * 1. Redistributions of source code must retain the above copyright
12114987Speter *    notice, this list of conditions and the following disclaimer.
13114987Speter * 2. Redistributions in binary form must reproduce the above copyright
14114987Speter *    notice, this list of conditions and the following disclaimer in the
15114987Speter *    documentation and/or other materials provided with the distribution.
16114987Speter *
17114987Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18114987Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19114987Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20114987Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21114987Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22114987Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23114987Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24114987Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25114987Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26114987Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27114987Speter * SUCH DAMAGE.
28114987Speter *
29114987Speter * $FreeBSD: head/sbin/hastd/ebuf.h 204076 2010-02-18 23:16:19Z pjd $
30114987Speter */
31114987Speter
32114987Speter#ifndef	_EBUF_H_
33114987Speter#define	_EBUF_H_
34114987Speter
35114987Speter#include <stdlib.h>	/* size_t */
36114987Speter
37114987Speterstruct ebuf;
38118031Sobrien
39118031Sobrienstruct ebuf *ebuf_alloc(size_t size);
40118031Sobrienvoid ebuf_free(struct ebuf *eb);
41114987Speter
42114987Speterint ebuf_add_head(struct ebuf *eb, const void *data, size_t size);
43114987Speterint ebuf_add_tail(struct ebuf *eb, const void *data, size_t size);
44114987Speter
45114987Spetervoid ebuf_del_head(struct ebuf *eb, size_t size);
46114987Spetervoid ebuf_del_tail(struct ebuf *eb, size_t size);
47114987Speter
48114987Spetervoid *ebuf_data(struct ebuf *eb, size_t *sizep);
49114987Spetersize_t ebuf_size(struct ebuf *eb);
50114987Speter
51114987Speter#endif	/* !_EBUF_H_ */
52114987Speter