]>
Commit | Line | Data |
---|---|---|
8efc0c15 | 1 | /* |
5260325f | 2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
5260325f | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | |
5260325f | 5 | * Code for manipulating FIFO buffers. |
35484284 | 6 | * |
bcbf86ec | 7 | * As far as I am concerned, the code I have written for this software |
8 | * can be used freely for any purpose. Any derived versions of this | |
9 | * software must be clearly marked as such, and if the derived work is | |
10 | * incompatible with the protocol description in the RFC file, it must be | |
11 | * called by a name other than "ssh" or "Secure Shell". | |
5260325f | 12 | */ |
8efc0c15 | 13 | |
255cabd9 | 14 | /* RCSID("$OpenBSD: buffer.h,v 1.9 2001/06/26 17:27:23 markus Exp $"); */ |
8efc0c15 | 15 | |
16 | #ifndef BUFFER_H | |
17 | #define BUFFER_H | |
18 | ||
5260325f | 19 | typedef struct { |
255cabd9 | 20 | char *buf; /* Buffer for data. */ |
21 | u_int alloc; /* Number of bytes allocated for data. */ | |
22 | u_int offset; /* Offset of first byte containing data. */ | |
23 | u_int end; /* Offset of last byte containing data. */ | |
5260325f | 24 | } Buffer; |
8efc0c15 | 25 | |
255cabd9 | 26 | void buffer_init(Buffer *); |
27 | void buffer_clear(Buffer *); | |
28 | void buffer_free(Buffer *); | |
8efc0c15 | 29 | |
255cabd9 | 30 | u_int buffer_len(Buffer *); |
31 | char *buffer_ptr(Buffer *); | |
8efc0c15 | 32 | |
255cabd9 | 33 | void buffer_append(Buffer *, const char *, u_int); |
34 | void buffer_append_space(Buffer *, char **, u_int); | |
8efc0c15 | 35 | |
255cabd9 | 36 | void buffer_get(Buffer *, char *, u_int); |
8efc0c15 | 37 | |
255cabd9 | 38 | void buffer_consume(Buffer *, u_int); |
39 | void buffer_consume_end(Buffer *, u_int); | |
8efc0c15 | 40 | |
255cabd9 | 41 | void buffer_dump(Buffer *); |
8efc0c15 | 42 | |
5260325f | 43 | #endif /* BUFFER_H */ |