CGI Bash Shell Interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

buffer.h 907B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @PROJECT CGI Bash Shell Interface
  3. * @COPYRIGHT See COPYING in the top level directory
  4. * @FILE buffer.h
  5. * @PURPOSE CBSI Buffers
  6. * @DEVELOPERS Nathan Angelacos <nangel@users.sourceforge.net>
  7. * Rafal Kupiec <belliash@asiotec.eu.org>
  8. */
  9. #ifndef __BUFFER_H
  10. #define __BUFFER_H
  11. typedef struct {
  12. unsigned char* data;
  13. unsigned char* ptr;
  14. unsigned char* limit;
  15. } buffer_t;
  16. typedef struct {
  17. int fh;
  18. unsigned char* buf;
  19. unsigned char* ptr;
  20. unsigned char* segment;
  21. size_t len;
  22. size_t maxsize;
  23. size_t bufsize;
  24. size_t maxread;
  25. size_t nrread;
  26. int eof;
  27. } sbuffer_t;
  28. void buffer_add(buffer_t* buf, const void* data, unsigned long size);
  29. void buffer_destroy(buffer_t* buf);
  30. void buffer_init(buffer_t* buf);
  31. void buffer_reset(buffer_t* buf);
  32. void sbuffer_destroy(sbuffer_t* sbuf);
  33. int sbuffer_init(sbuffer_t* sbuf, int size);
  34. int sbuffer_read(sbuffer_t* sbuf, char* matchstr);
  35. #endif