tree.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 top_depth, int depth,
  33. bool_t seq, bool_t splitter, unsigned char prev_pri_hi);
  34. konf_tree_t *konf_tree_new_conf(konf_tree_t * instance,
  35. const char *line, unsigned short priority,
  36. bool_t seq, unsigned short seq_num);
  37. konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
  38. const char *line, unsigned short priority, unsigned short sequence);
  39. int konf_tree_del_pattern(konf_tree_t * instance,
  40. const char *line, bool_t unique,
  41. const char *pattern, unsigned short priority,
  42. bool_t seq, unsigned short seq_num);
  43. /*-----------------
  44. * attributes
  45. *----------------- */
  46. unsigned short konf_tree__get_priority(const konf_tree_t * instance);
  47. unsigned char konf_tree__get_priority_hi(const konf_tree_t * instance);
  48. unsigned char konf_tree__get_priority_lo(const konf_tree_t * instance);
  49. bool_t konf_tree__get_splitter(const konf_tree_t * instance);
  50. void konf_tree__set_splitter(konf_tree_t *instance, bool_t splitter);
  51. unsigned short konf_tree__get_seq_num(const konf_tree_t * instance);
  52. void konf_tree__set_seq_num(konf_tree_t * instance, unsigned short seq_num);
  53. unsigned short konf_tree__get_sub_num(const konf_tree_t * instance);
  54. void konf_tree__set_sub_num(konf_tree_t * instance, unsigned short sub_num);
  55. const char * konf_tree__get_line(const konf_tree_t * instance);
  56. void konf_tree__set_depth(konf_tree_t * instance, int depth);
  57. int konf_tree__get_depth(const konf_tree_t * instance);
  58. #endif /* _konf_tree_h */
  59. /** @} clish_conf */