buffer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* $OpenBSD: buffer.h,v 1.11 2002/03/04 17:27:39 stevesk Exp $ */
  2. /*
  3. * Author: Tatu Ylonen <[email protected]>
  4. * Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
  5. * All rights reserved
  6. * Code for manipulating FIFO buffers.
  7. *
  8. * As far as I am concerned, the code I have written for this software
  9. * can be used freely for any purpose. Any derived versions of this
  10. * software must be clearly marked as such, and if the derived work is
  11. * incompatible with the protocol description in the RFC file, it must be
  12. * called by a name other than "ssh" or "Secure Shell".
  13. */
  14. #ifndef BUFFER_H
  15. #define BUFFER_H
  16. typedef unsigned int u_int;
  17. typedef unsigned char u_char;
  18. typedef struct {
  19. u_char *buf; /* Buffer for data. */
  20. u_int alloc; /* Number of bytes allocated for data. */
  21. u_int offset; /* Offset of first byte containing data. */
  22. u_int end; /* Offset of last byte containing data. */
  23. } Buffer;
  24. void buffer_init(Buffer *);
  25. void buffer_free(Buffer *);
  26. void buffer_append(Buffer *, const void *, u_int);
  27. void *buffer_append_space(Buffer *, u_int);
  28. u_int buffer_len(Buffer *);
  29. void *buffer_ptr(Buffer *);
  30. void buffer_put_int(Buffer *, u_int);
  31. void buffer_put_char(Buffer *, int);
  32. void buffer_put_string(Buffer *, const void *, u_int);
  33. void buffer_put_cstring(Buffer *, const char *);
  34. #endif /* BUFFER_H */