SimpleStreamBuffer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @file SimpleStreamBuffer.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef BADVPN_SIMPLESTREAMBUFFER_H
  23. #define BADVPN_SIMPLESTREAMBUFFER_H
  24. #include <misc/debug.h>
  25. #include <base/DebugObject.h>
  26. #include <flow/StreamRecvInterface.h>
  27. typedef struct {
  28. int buf_size;
  29. StreamRecvInterface output;
  30. uint8_t *buf;
  31. int buf_used;
  32. uint8_t *output_data;
  33. int output_data_len;
  34. DebugObject d_obj;
  35. } SimpleStreamBuffer;
  36. int SimpleStreamBuffer_Init (SimpleStreamBuffer *o, int buf_size, BPendingGroup *pg) WARN_UNUSED;
  37. void SimpleStreamBuffer_Free (SimpleStreamBuffer *o);
  38. StreamRecvInterface * SimpleStreamBuffer_GetOutput (SimpleStreamBuffer *o);
  39. int SimpleStreamBuffer_Write (SimpleStreamBuffer *o, uint8_t *data, int data_len) WARN_UNUSED;
  40. #endif