blob: a722ecb6296e5a6a967920a4deb2bb36d0be2e44 [file] [log] [blame]
bellardf0cbd3e2004-04-22 00:10:48 +00001/*
2 * Copyright (c) 1995 Danny Gasparovski.
ths5fafdf22007-09-16 21:08:06 +00003 *
4 * Please read the file COPYRIGHT for the
bellardf0cbd3e2004-04-22 00:10:48 +00005 * terms and conditions of the copyright.
6 */
7
Markus Armbruster2a6a4072016-06-29 13:47:03 +02008#ifndef SBUF_H
9#define SBUF_H
bellardf0cbd3e2004-04-22 00:10:48 +000010
11#define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
12#define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
13
14struct sbuf {
Dr. David Alan Gilbert2a7cab92017-02-20 18:50:17 +000015 uint32_t sb_cc; /* actual chars in buffer */
16 uint32_t sb_datalen; /* Length of data */
bellardf0cbd3e2004-04-22 00:10:48 +000017 char *sb_wptr; /* write pointer. points to where the next
18 * bytes should be written in the sbuf */
19 char *sb_rptr; /* read pointer. points to where the next
20 * byte should be read from the sbuf */
21 char *sb_data; /* Actual data */
22};
23
Blue Swirl6cb9c6d2009-07-01 19:11:17 +000024void sbfree(struct sbuf *);
25void sbdrop(struct sbuf *, int);
26void sbreserve(struct sbuf *, int);
27void sbappend(struct socket *, struct mbuf *);
28void sbcopy(struct sbuf *, int, int, char *);
bellardf0cbd3e2004-04-22 00:10:48 +000029
30#endif