root / slirp / sbuf.h @ f97572e5
History | View | Annotate | Download (837 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 | f0cbd3ec | bellard | void sbfree _P((struct sbuf *)); |
25 | f0cbd3ec | bellard | void sbdrop _P((struct sbuf *, int)); |
26 | f0cbd3ec | bellard | void sbreserve _P((struct sbuf *, int)); |
27 | f0cbd3ec | bellard | void sbappend _P((struct socket *, struct mbuf *)); |
28 | f0cbd3ec | bellard | void sbcopy _P((struct sbuf *, int, int, char *)); |
29 | f0cbd3ec | bellard | |
30 | f0cbd3ec | bellard | #endif |