]> andersk Git - openssh.git/blame - buffer.h
Fix off by one error in PAM env patch
[openssh.git] / buffer.h
CommitLineData
8efc0c15 1/*
2
3buffer.h
4
5Author: Tatu Ylonen <ylo@cs.hut.fi>
6
7Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 All rights reserved
9
10Created: Sat Mar 18 04:12:25 1995 ylo
11
12Code for manipulating FIFO buffers.
13
14*/
15
16/* RCSID("$Id$"); */
17
18#ifndef BUFFER_H
19#define BUFFER_H
20
21typedef struct
22{
23 char *buf; /* Buffer for data. */
24 unsigned int alloc; /* Number of bytes allocated for data. */
25 unsigned int offset; /* Offset of first byte containing data. */
26 unsigned int end; /* Offset of last byte containing data. */
27} Buffer;
28
29/* Initializes the buffer structure. */
30void buffer_init(Buffer *buffer);
31
32/* Frees any memory used for the buffer. */
33void buffer_free(Buffer *buffer);
34
35/* Clears any data from the buffer, making it empty. This does not actually
36 zero the memory. */
37void buffer_clear(Buffer *buffer);
38
39/* Appends data to the buffer, expanding it if necessary. */
40void buffer_append(Buffer *buffer, const char *data, unsigned int len);
41
42/* Appends space to the buffer, expanding the buffer if necessary.
43 This does not actually copy the data into the buffer, but instead
44 returns a pointer to the allocated region. */
45void buffer_append_space(Buffer *buffer, char **datap, unsigned int len);
46
47/* Returns the number of bytes of data in the buffer. */
48unsigned int buffer_len(Buffer *buffer);
49
50/* Gets data from the beginning of the buffer. */
51void buffer_get(Buffer *buffer, char *buf, unsigned int len);
52
53/* Consumes the given number of bytes from the beginning of the buffer. */
54void buffer_consume(Buffer *buffer, unsigned int bytes);
55
56/* Consumes the given number of bytes from the end of the buffer. */
57void buffer_consume_end(Buffer *buffer, unsigned int bytes);
58
59/* Returns a pointer to the first used byte in the buffer. */
60char *buffer_ptr(Buffer *buffer);
61
62/* Dumps the contents of the buffer to stderr in hex. This intended for
63 debugging purposes only. */
64void buffer_dump(Buffer *buffer);
65
66#endif /* BUFFER_H */
This page took 0.05334 seconds and 5 git commands to generate.