bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1995 Danny Gasparovski. |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 3 | * |
| 4 | * Please read the file COPYRIGHT for the |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 5 | * terms and conditions of the copyright. |
| 6 | */ |
| 7 | |
Markus Armbruster | 2a6a407 | 2016-06-29 13:47:03 +0200 | [diff] [blame] | 8 | #ifndef SBUF_H |
| 9 | #define SBUF_H |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 10 | |
| 11 | #define sbflush(sb) sbdrop((sb),(sb)->sb_cc) |
| 12 | #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc) |
| 13 | |
| 14 | struct sbuf { |
Dr. David Alan Gilbert | 2a7cab9 | 2017-02-20 18:50:17 +0000 | [diff] [blame] | 15 | uint32_t sb_cc; /* actual chars in buffer */ |
| 16 | uint32_t sb_datalen; /* Length of data */ |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 17 | 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 Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 24 | void sbfree(struct sbuf *); |
| 25 | void sbdrop(struct sbuf *, int); |
| 26 | void sbreserve(struct sbuf *, int); |
| 27 | void sbappend(struct socket *, struct mbuf *); |
| 28 | void sbcopy(struct sbuf *, int, int, char *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 29 | |
| 30 | #endif |