1204076Spjd/*-
2330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3330449Seadler *
4204076Spjd * Copyright (c) 2009-2010 The FreeBSD Foundation
5204076Spjd * All rights reserved.
6204076Spjd *
7204076Spjd * This software was developed by Pawel Jakub Dawidek under sponsorship from
8204076Spjd * the FreeBSD Foundation.
9204076Spjd *
10204076Spjd * Redistribution and use in source and binary forms, with or without
11204076Spjd * modification, are permitted provided that the following conditions
12204076Spjd * are met:
13204076Spjd * 1. Redistributions of source code must retain the above copyright
14204076Spjd *    notice, this list of conditions and the following disclaimer.
15204076Spjd * 2. Redistributions in binary form must reproduce the above copyright
16204076Spjd *    notice, this list of conditions and the following disclaimer in the
17204076Spjd *    documentation and/or other materials provided with the distribution.
18204076Spjd *
19204076Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20204076Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21204076Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22204076Spjd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23204076Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24204076Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25204076Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26204076Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27204076Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28204076Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29204076Spjd * SUCH DAMAGE.
30204076Spjd *
31204076Spjd * $FreeBSD: stable/11/sbin/hastd/ebuf.h 330449 2018-03-05 07:26:05Z eadler $
32204076Spjd */
33204076Spjd
34204076Spjd#ifndef	_EBUF_H_
35204076Spjd#define	_EBUF_H_
36204076Spjd
37204076Spjd#include <stdlib.h>	/* size_t */
38204076Spjd
39204076Spjdstruct ebuf;
40204076Spjd
41204076Spjdstruct ebuf *ebuf_alloc(size_t size);
42204076Spjdvoid ebuf_free(struct ebuf *eb);
43204076Spjd
44204076Spjdint ebuf_add_head(struct ebuf *eb, const void *data, size_t size);
45204076Spjdint ebuf_add_tail(struct ebuf *eb, const void *data, size_t size);
46204076Spjd
47204076Spjdvoid ebuf_del_head(struct ebuf *eb, size_t size);
48204076Spjdvoid ebuf_del_tail(struct ebuf *eb, size_t size);
49204076Spjd
50204076Spjdvoid *ebuf_data(struct ebuf *eb, size_t *sizep);
51204076Spjdsize_t ebuf_size(struct ebuf *eb);
52204076Spjd
53204076Spjd#endif	/* !_EBUF_H_ */
54