kcontext_base.h 909 B

12345678910111213141516171819202122232425262728293031323334353637
  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 struct kexec_s kexec_t; // To use with context structure
  10. typedef enum {
  11. KCONTEXT_TYPE_NONE,
  12. // Context for plugin initialization
  13. KCONTEXT_TYPE_PLUGIN_INIT,
  14. // Context for plugin finalization
  15. KCONTEXT_TYPE_PLUGIN_FINI,
  16. // Context for command's action
  17. KCONTEXT_TYPE_ACTION,
  18. // Context for service actions like PTYPE, COND, etc.
  19. KCONTEXT_TYPE_SERVICE_ACTION,
  20. KCONTEXT_TYPE_MAX,
  21. } kcontext_type_e;
  22. C_DECL_BEGIN
  23. kcontext_t *kcontext_new(kcontext_type_e type);
  24. void kcontext_free(kcontext_t *context);
  25. kcontext_type_e kcontext_type(const kcontext_t *context);
  26. bool_t kcontext_set_type(kcontext_t *context, kcontext_type_e type);
  27. C_DECL_END
  28. #endif // _klish_kcontext_base_h