tree.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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/list.h"
  16. typedef struct konf_tree_s konf_tree_t;
  17. #define KONF_ENTRY_OK 0xffff
  18. #define KONF_ENTRY_DIRTY 0xfffe
  19. #define KONF_ENTRY_NEW 0xfffd
  20. /*=====================================
  21. * CONF INTERFACE
  22. *===================================== */
  23. /*-----------------
  24. * meta functions
  25. *----------------- */
  26. konf_tree_t *konf_tree_new(const char *line, unsigned short priority);
  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, bool_t seq, 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);
  36. konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
  37. const char *line, unsigned short priority, unsigned short sequence);
  38. int konf_tree_del_pattern(konf_tree_t * instance,
  39. const char *line, bool_t unique,
  40. const char *pattern, unsigned short priority,
  41. bool_t seq, unsigned short seq_num);
  42. /*-----------------
  43. * attributes
  44. *----------------- */
  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. void konf_tree__set_depth(konf_tree_t * instance, int depth);
  56. int konf_tree__get_depth(const konf_tree_t * instance);
  57. #endif /* _konf_tree_h */
  58. /** @} clish_conf */