]> andersk Git - gssapi-openssh.git/blob - openssh/buffer.h
62e43d1a716fe803e65ddcc9144b5a796aada75b
[gssapi-openssh.git] / openssh / buffer.h
1 /*      $OpenBSD: buffer.h,v 1.13 2005/03/14 11:46:56 markus Exp $      */
2
3 /*
4  * Author: Tatu Ylonen <ylo@cs.hut.fi>
5  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6  *                    All rights reserved
7  * Code for manipulating FIFO buffers.
8  *
9  * As far as I am concerned, the code I have written for this software
10  * can be used freely for any purpose.  Any derived versions of this
11  * software must be clearly marked as such, and if the derived work is
12  * incompatible with the protocol description in the RFC file, it must be
13  * called by a name other than "ssh" or "Secure Shell".
14  */
15
16 #ifndef BUFFER_H
17 #define BUFFER_H
18
19 typedef struct {
20         u_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. */
24 }       Buffer;
25
26 #define BUFFER_MAX_CHUNK        0x100000  /*1MB*/
27 #define BUFFER_MAX_LEN          0xa00000  /*10MB*/
28
29 /* this value for BUFFER_MAX_HPN_LEN is */
30 /* still undersized for the faster networks */
31 /* it might make sense to have yet another */
32 /* MAX_LEN for 10+GB networks. Something closer to */
33 /* 128MB or 192MB -cjr*/
34 #define BUFFER_MAX_HPN_LEN      0x2000000 /*32MB*/
35
36 void     buffer_init(Buffer *);
37 void     buffer_clear(Buffer *);
38 void     buffer_free(Buffer *);
39
40 u_int    buffer_len(Buffer *);
41 void    *buffer_ptr(Buffer *);
42
43 void     buffer_append(Buffer *, const void *, u_int);
44 void    *buffer_append_space(Buffer *, u_int);
45
46 void     buffer_get(Buffer *, void *, u_int);
47
48 void     buffer_consume(Buffer *, u_int);
49 void     buffer_consume_end(Buffer *, u_int);
50
51 void     buffer_dump(Buffer *);
52
53 int      buffer_get_ret(Buffer *, void *, u_int);
54 int      buffer_consume_ret(Buffer *, u_int);
55 int      buffer_consume_end_ret(Buffer *, u_int);
56
57 #endif                          /* BUFFER_H */
This page took 0.031279 seconds and 3 git commands to generate.