buffer.h revision 92555
192555Sdes/* $OpenBSD: buffer.h,v 1.11 2002/03/04 17:27:39 stevesk Exp $ */ 292555Sdes 357429Smarkm/* 457429Smarkm * Author: Tatu Ylonen <ylo@cs.hut.fi> 557429Smarkm * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 657429Smarkm * All rights reserved 757429Smarkm * Code for manipulating FIFO buffers. 860573Skris * 965668Skris * As far as I am concerned, the code I have written for this software 1065668Skris * can be used freely for any purpose. Any derived versions of this 1165668Skris * software must be clearly marked as such, and if the derived work is 1265668Skris * incompatible with the protocol description in the RFC file, it must be 1365668Skris * called by a name other than "ssh" or "Secure Shell". 1457429Smarkm */ 1557429Smarkm 1657429Smarkm#ifndef BUFFER_H 1757429Smarkm#define BUFFER_H 1857429Smarkm 1957429Smarkmtypedef struct { 2092555Sdes u_char *buf; /* Buffer for data. */ 2192555Sdes u_int alloc; /* Number of bytes allocated for data. */ 2292555Sdes u_int offset; /* Offset of first byte containing data. */ 2392555Sdes u_int end; /* Offset of last byte containing data. */ 2457429Smarkm} Buffer; 2557429Smarkm 2692555Sdesvoid buffer_init(Buffer *); 2792555Sdesvoid buffer_clear(Buffer *); 2892555Sdesvoid buffer_free(Buffer *); 2957429Smarkm 3092555Sdesu_int buffer_len(Buffer *); 3192555Sdesvoid *buffer_ptr(Buffer *); 3257429Smarkm 3392555Sdesvoid buffer_append(Buffer *, const void *, u_int); 3492555Sdesvoid *buffer_append_space(Buffer *, u_int); 3557429Smarkm 3692555Sdesvoid buffer_get(Buffer *, void *, u_int); 3757429Smarkm 3892555Sdesvoid buffer_consume(Buffer *, u_int); 3992555Sdesvoid buffer_consume_end(Buffer *, u_int); 4057429Smarkm 4192555Sdesvoid buffer_dump(Buffer *); 4257429Smarkm 4357429Smarkm#endif /* BUFFER_H */ 44