root / slirp / sbuf.h @ e890261f
History | View | Annotate | Download (812 Bytes)
1 | f0cbd3ec | bellard | /*
|
---|---|---|---|
2 | f0cbd3ec | bellard | * Copyright (c) 1995 Danny Gasparovski.
|
3 | 5fafdf24 | ths | *
|
4 | 5fafdf24 | ths | * Please read the file COPYRIGHT for the
|
5 | f0cbd3ec | bellard | * terms and conditions of the copyright.
|
6 | f0cbd3ec | bellard | */
|
7 | f0cbd3ec | bellard | |
8 | f0cbd3ec | bellard | #ifndef _SBUF_H_
|
9 | f0cbd3ec | bellard | #define _SBUF_H_
|
10 | f0cbd3ec | bellard | |
11 | f0cbd3ec | bellard | #define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
|
12 | f0cbd3ec | bellard | #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
|
13 | f0cbd3ec | bellard | |
14 | f0cbd3ec | bellard | struct sbuf {
|
15 | f0cbd3ec | bellard | u_int sb_cc; /* actual chars in buffer */
|
16 | f0cbd3ec | bellard | u_int sb_datalen; /* Length of data */
|
17 | f0cbd3ec | bellard | char *sb_wptr; /* write pointer. points to where the next |
18 | f0cbd3ec | bellard | * bytes should be written in the sbuf */
|
19 | f0cbd3ec | bellard | char *sb_rptr; /* read pointer. points to where the next |
20 | f0cbd3ec | bellard | * byte should be read from the sbuf */
|
21 | f0cbd3ec | bellard | char *sb_data; /* Actual data */ |
22 | f0cbd3ec | bellard | }; |
23 | f0cbd3ec | bellard | |
24 | 6cb9c6d3 | Blue Swirl | void sbfree(struct sbuf *); |
25 | 6cb9c6d3 | Blue Swirl | void sbdrop(struct sbuf *, int); |
26 | 6cb9c6d3 | Blue Swirl | void sbreserve(struct sbuf *, int); |
27 | 6cb9c6d3 | Blue Swirl | void sbappend(struct socket *, struct mbuf *); |
28 | 6cb9c6d3 | Blue Swirl | void sbcopy(struct sbuf *, int, int, char *); |
29 | f0cbd3ec | bellard | |
30 | f0cbd3ec | bellard | #endif |