kcontext_base.h 844 B

123456789101112131415161718192021222324252627282930313233343536
  1. /** @file kcontext_base.h
  2. *
  3. * @brief Klish base context to pass to plugin's functions
  4. */
  5. #ifndef _klish_kcontext_base_h
  6. #define _klish_kcontext_base_h
  7. #include <faux/faux.h>
  8. typedef struct kcontext_s kcontext_t;
  9. typedef enum {
  10. KCONTEXT_TYPE_NONE,
  11. // Context for plugin initialization
  12. KCONTEXT_TYPE_PLUGIN_INIT,
  13. // Context for plugin finalization
  14. KCONTEXT_TYPE_PLUGIN_FINI,
  15. // Context for command's action
  16. KCONTEXT_TYPE_ACTION,
  17. // Context for service actions like PTYPE, COND, etc.
  18. KCONTEXT_TYPE_SERVICE_ACTION,
  19. KCONTEXT_TYPE_MAX,
  20. } kcontext_type_e;
  21. C_DECL_BEGIN
  22. kcontext_t *kcontext_new(kcontext_type_e type);
  23. void kcontext_free(kcontext_t *context);
  24. kcontext_type_e kcontext_type(const kcontext_t *context);
  25. bool_t kcontext_set_type(kcontext_t *context, kcontext_type_e type);
  26. C_DECL_END
  27. #endif // _klish_kcontext_base_h