buf.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 _cliconf_buf_h
  12. #define _cliconf_buf_h
  13. #include <stdio.h>
  14. #include "cliconf/buf/private.h"
  15. #include "lub/bintree.h"
  16. typedef struct conf_buf_s conf_buf_t;
  17. /*=====================================
  18. * CONF INTERFACE
  19. *===================================== */
  20. /*-----------------
  21. * meta functions
  22. *----------------- */
  23. conf_buf_t *conf_buf_new(int sock);
  24. int conf_buf_bt_compare(const void *clientnode, const void *clientkey);
  25. void conf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  26. size_t conf_buf_bt_offset(void);
  27. /*-----------------
  28. * methods
  29. *----------------- */
  30. void conf_buf_delete(conf_buf_t *instance);
  31. int conf_buf_read(conf_buf_t *instance);
  32. int conf_buf_add(conf_buf_t *instance, void *str, size_t len);
  33. char * conf_buf_string(char *instance, int len);
  34. char * conf_buf_parse(conf_buf_t *instance);
  35. char * conf_buf_preparse(conf_buf_t *instance);
  36. int conf_buf_lseek(conf_buf_t *instance, int newpos);
  37. int conf_buf__get_sock(const conf_buf_t *instance);
  38. int conf_buf__get_len(const conf_buf_t *instance);
  39. int conf_buftree_read(lub_bintree_t *instance, int sock);
  40. char * conf_buftree_parse(lub_bintree_t *instance, int sock);
  41. void conf_buftree_remove(lub_bintree_t *instance, int sock);
  42. #endif /* _cliconf_h */
  43. /** @} clish_conf */