buf.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * buf.h
  3. */
  4. /**
  5. \ingroup clish
  6. \defgroup clish_conf config
  7. @{
  8. \brief This class is a config in memory container.
  9. Use it to implement config in memory.
  10. */
  11. #ifndef _konf_buf_h
  12. #define _konf_buf_h
  13. #include <stdio.h>
  14. #include <lub/bintree.h>
  15. typedef struct konf_buf_s konf_buf_t;
  16. /*=====================================
  17. * CONF INTERFACE
  18. *===================================== */
  19. /*-----------------
  20. * meta functions
  21. *----------------- */
  22. konf_buf_t *konf_buf_new(int fd);
  23. int konf_buf_bt_compare(const void *clientnode, const void *clientkey);
  24. void konf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  25. size_t konf_buf_bt_offset(void);
  26. /*-----------------
  27. * methods
  28. *----------------- */
  29. void konf_buf_delete(konf_buf_t *instance);
  30. int konf_buf_read(konf_buf_t *instance);
  31. int konf_buf_add(konf_buf_t *instance, void *str, size_t len);
  32. char * konf_buf_string(char *instance, int len);
  33. char * konf_buf_parse(konf_buf_t *instance);
  34. char * konf_buf_preparse(konf_buf_t *instance);
  35. int konf_buf_lseek(konf_buf_t *instance, int newpos);
  36. int konf_buf__get_fd(const konf_buf_t *instance);
  37. int konf_buf__get_len(const konf_buf_t *instance);
  38. char * konf_buf__dup_line(const konf_buf_t *instance);
  39. char * konf_buf__get_buf(const konf_buf_t *instance);
  40. void * konf_buf__get_data(const konf_buf_t *instance);
  41. void konf_buf__set_data(konf_buf_t *instance, void *data);
  42. int konf_buftree_read(lub_bintree_t *instance, int fd);
  43. char * konf_buftree_parse(lub_bintree_t *instance, int fd);
  44. void konf_buftree_remove(lub_bintree_t *instance, int fd);
  45. konf_buf_t *konf_buftree_find(lub_bintree_t *instance, int fd);
  46. #endif /* _konf_buf_h */
  47. /** @} clish_conf */