A clone of btpd with my configuration changes.
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.

21 lines
493 B

  1. #ifndef BTPD_IOBUF_H
  2. #define BTPD_IOBUF_H
  3. struct io_buffer {
  4. size_t off;
  5. size_t len;
  6. char *buf;
  7. int error;
  8. };
  9. struct io_buffer buf_init(size_t size);
  10. void buf_free(struct io_buffer *iob);
  11. int buf_grow(struct io_buffer *iob, size_t size);
  12. int buf_write(struct io_buffer *iob, const void *data, size_t size);
  13. __attribute__((format (printf, 2, 3)))
  14. int buf_print(struct io_buffer *iob, const char *fmt, ...);
  15. #define buf_swrite(iob, s) buf_write(iob, s, sizeof(s) - 1)
  16. #endif