1*0Sstevel@tonic-gate /* $OpenBSD: buffer.h,v 1.11 2002/03/04 17:27:39 stevesk Exp $ */ 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate #ifndef _BUFFER_H 4*0Sstevel@tonic-gate #define _BUFFER_H 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate #ifdef __cplusplus 9*0Sstevel@tonic-gate extern "C" { 10*0Sstevel@tonic-gate #endif 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate /* 14*0Sstevel@tonic-gate * Author: Tatu Ylonen <ylo@cs.hut.fi> 15*0Sstevel@tonic-gate * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 16*0Sstevel@tonic-gate * All rights reserved 17*0Sstevel@tonic-gate * Code for manipulating FIFO buffers. 18*0Sstevel@tonic-gate * 19*0Sstevel@tonic-gate * As far as I am concerned, the code I have written for this software 20*0Sstevel@tonic-gate * can be used freely for any purpose. Any derived versions of this 21*0Sstevel@tonic-gate * software must be clearly marked as such, and if the derived work is 22*0Sstevel@tonic-gate * incompatible with the protocol description in the RFC file, it must be 23*0Sstevel@tonic-gate * called by a name other than "ssh" or "Secure Shell". 24*0Sstevel@tonic-gate */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate typedef struct { 27*0Sstevel@tonic-gate u_char *buf; /* Buffer for data. */ 28*0Sstevel@tonic-gate u_int alloc; /* Number of bytes allocated for data. */ 29*0Sstevel@tonic-gate u_int offset; /* Offset of first byte containing data. */ 30*0Sstevel@tonic-gate u_int end; /* Offset of last byte containing data. */ 31*0Sstevel@tonic-gate } Buffer; 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate void buffer_init(Buffer *); 34*0Sstevel@tonic-gate void buffer_clear(Buffer *); 35*0Sstevel@tonic-gate void buffer_free(Buffer *); 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate u_int buffer_len(Buffer *); 38*0Sstevel@tonic-gate void *buffer_ptr(Buffer *); 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate void buffer_append(Buffer *, const void *, u_int); 41*0Sstevel@tonic-gate void *buffer_append_space(Buffer *, u_int); 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate void buffer_get(Buffer *, void *, u_int); 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate void buffer_consume(Buffer *, u_int); 46*0Sstevel@tonic-gate void buffer_consume_end(Buffer *, u_int); 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate void buffer_dump(Buffer *); 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #ifdef __cplusplus 51*0Sstevel@tonic-gate } 52*0Sstevel@tonic-gate #endif 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate #endif /* _BUFFER_H */ 55