tree.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #define KONF_ENTRY_OK 0xffff
  18. #define KONF_ENTRY_DIRTY 0xfffe
  19. /*=====================================
  20. * CONF INTERFACE
  21. *===================================== */
  22. /*-----------------
  23. * meta functions
  24. *----------------- */
  25. konf_tree_t *konf_tree_new(const char * line, unsigned short priority);
  26. int konf_tree_bt_compare(const void *clientnode, const void *clientkey);
  27. void konf_tree_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  28. size_t konf_tree_bt_offset(void);
  29. /*-----------------
  30. * methods
  31. *----------------- */
  32. void konf_tree_delete(konf_tree_t * instance);
  33. void konf_tree_fprintf(konf_tree_t * instance, FILE * stream,
  34. const char *pattern, int depth, bool_t seq, unsigned char prev_pri_hi);
  35. konf_tree_t *konf_tree_new_conf(konf_tree_t * instance,
  36. const char *line, unsigned short priority,
  37. bool_t seq, unsigned short seq_num);
  38. konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
  39. const char *line, unsigned short priority, unsigned short sequence);
  40. void konf_tree_del_pattern(konf_tree_t *this, const char *pattern);
  41. /*-----------------
  42. * attributes
  43. *----------------- */
  44. unsigned konf_tree__get_depth(const konf_tree_t * instance);
  45. unsigned short konf_tree__get_priority(const konf_tree_t * instance);
  46. unsigned char konf_tree__get_priority_hi(const konf_tree_t * instance);
  47. unsigned char konf_tree__get_priority_lo(const konf_tree_t * instance);
  48. bool_t konf_tree__get_splitter(const konf_tree_t * instance);
  49. void konf_tree__set_splitter(konf_tree_t *instance, bool_t splitter);
  50. unsigned short konf_tree__get_seq_num(const konf_tree_t * instance);
  51. void konf_tree__set_seq_num(konf_tree_t * instance, unsigned short seq_num);
  52. unsigned short konf_tree__get_sub_num(const konf_tree_t * instance);
  53. void konf_tree__set_sub_num(konf_tree_t * instance, unsigned short sub_num);
  54. const char * konf_tree__get_line(const konf_tree_t * instance);
  55. #endif /* _konf_tree_h */
  56. /** @} clish_conf */