tree.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * conf.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_tree_h
  12. #define _konf_tree_h
  13. #include <stdio.h>
  14. #include "lub/types.h"
  15. #include "lub/bintree.h"
  16. typedef struct konf_tree_s konf_tree_t;
  17. /*=====================================
  18. * CONF INTERFACE
  19. *===================================== */
  20. /*-----------------
  21. * meta functions
  22. *----------------- */
  23. konf_tree_t *konf_tree_new(const char * line, unsigned short priority);
  24. int konf_tree_bt_compare(const void *clientnode, const void *clientkey);
  25. void konf_tree_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  26. size_t konf_tree_bt_offset(void);
  27. /*-----------------
  28. * methods
  29. *----------------- */
  30. void konf_tree_delete(konf_tree_t * instance);
  31. void konf_tree_fprintf(konf_tree_t * instance, FILE * stream,
  32. const char *pattern, int depth, unsigned char prev_pri_hi);
  33. konf_tree_t *konf_tree_new_conf(konf_tree_t * instance,
  34. const char *line, unsigned short priority,
  35. bool_t seq, unsigned short seq_num, unsigned short seq_step);
  36. konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
  37. const char *line, unsigned short priority, unsigned short sequence);
  38. void konf_tree_del_pattern(konf_tree_t *this, const char *pattern);
  39. /*-----------------
  40. * attributes
  41. *----------------- */
  42. unsigned konf_tree__get_depth(const konf_tree_t * instance);
  43. unsigned short konf_tree__get_priority(const konf_tree_t * instance);
  44. unsigned char konf_tree__get_priority_hi(const konf_tree_t * instance);
  45. unsigned char konf_tree__get_priority_lo(const konf_tree_t * instance);
  46. bool_t konf_tree__get_splitter(const konf_tree_t * instance);
  47. void konf_tree__set_splitter(konf_tree_t *instance, bool_t splitter);
  48. unsigned short konf_tree__get_seq_num(const konf_tree_t * instance);
  49. void konf_tree__set_seq_num(konf_tree_t * instance, unsigned short seq_num);
  50. #endif /* _konf_tree_h */
  51. /** @} clish_conf */