kcontext_base.h 799 B

1234567891011121314151617181920212223242526272829303132333435
  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_NONE,
  11. // Context for plugin initialization
  12. KCONTEXT_PLUGIN_INIT,
  13. // Context for plugin finalization
  14. KCONTEXT_PLUGIN_FINI,
  15. // Context for command's action
  16. KCONTEXT_ACTION,
  17. // Context for service actions like PTYPE, COND, etc.
  18. KCONTEXT_SERVICE_ACTION,
  19. } kcontext_type_e;
  20. C_DECL_BEGIN
  21. kcontext_t *kcontext_new(kcontext_type_e type);
  22. void kcontext_free(kcontext_t *context);
  23. kcontext_type_e kcontext_type(const kcontext_t *context);
  24. bool_t kcontext_set_type(kcontext_t *context, kcontext_type_e type);
  25. C_DECL_END
  26. #endif // _klish_kcontext_base_h