1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright (c) 1995 Danny Gasparovski.
4 */
5
6#ifndef SBUF_H
7#define SBUF_H
8
9#define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
10
11struct sbuf {
12 uint32_t sb_cc; /* actual chars in buffer */
13 uint32_t sb_datalen; /* Length of data */
14 char *sb_wptr; /* write pointer. points to where the next
15 * bytes should be written in the sbuf */
16 char *sb_rptr; /* read pointer. points to where the next
17 * byte should be read from the sbuf */
18 char *sb_data; /* Actual data */
19};
20
21void sbfree(struct sbuf *);
22bool sbdrop(struct sbuf *, int);
23void sbreserve(struct sbuf *, int);
24void sbappend(struct socket *, struct mbuf *);
25void sbcopy(struct sbuf *, int, int, char *);
26
27#endif
28