plugin.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. *
  3. */
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <stdint.h>
  7. #include <assert.h>
  8. #include <faux/faux.h>
  9. #include <klish/kplugin.h>
  10. #include <klish/kcontext.h>
  11. #include <sysrepo.h>
  12. #include <sysrepo/xpath.h>
  13. #include "syms.h"
  14. const uint8_t kplugin_sysrepo_major = KPLUGIN_MAJOR;
  15. const uint8_t kplugin_sysrepo_minor = KPLUGIN_MINOR;
  16. int kplugin_sysrepo_init(kcontext_t *context)
  17. {
  18. kplugin_t *plugin = NULL;
  19. ksym_t *sym = NULL;
  20. int err = SR_ERR_OK;
  21. sr_conn_ctx_t *conn = NULL;
  22. sr_session_ctx_t *sess = NULL;
  23. assert(context);
  24. plugin = kcontext_plugin(context);
  25. assert(plugin);
  26. // Symbols
  27. // Types
  28. kplugin_add_syms(plugin, ksym_new_ext("PLINE_SET", srp_PLINE_SET,
  29. KSYM_USERDEFINED_PERMANENT, KSYM_UNSYNC));
  30. kplugin_add_syms(plugin, ksym_new_ext("PLINE_DEL", srp_PLINE_DEL,
  31. KSYM_USERDEFINED_PERMANENT, KSYM_UNSYNC));
  32. kplugin_add_syms(plugin, ksym_new_ext("PLINE_EDIT", srp_PLINE_EDIT,
  33. KSYM_USERDEFINED_PERMANENT, KSYM_UNSYNC));
  34. // Completion/Help
  35. kplugin_add_syms(plugin, ksym_new_ext("srp_compl", srp_compl,
  36. KSYM_USERDEFINED_PERMANENT, KSYM_UNSYNC));
  37. kplugin_add_syms(plugin, ksym_new_ext("srp_help", srp_help,
  38. KSYM_USERDEFINED_PERMANENT, KSYM_UNSYNC));
  39. // Operations
  40. kplugin_add_syms(plugin, ksym_new("srp_set", srp_set));
  41. return 0;
  42. }
  43. int kplugin_sysrepo_fini(kcontext_t *context)
  44. {
  45. context = context; // Happy compiler
  46. return 0;
  47. }