private.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef VERSION
  2. #define VERSION "1.0.0"
  3. #endif
  4. #include <faux/ini.h>
  5. #define LOG_NAME "klishd-listen"
  6. #define LOG_SERVICE_NAME "klishd"
  7. #define DEFAULT_PIDFILE "/var/run/klishd.pid"
  8. #define DEFAULT_CFGFILE "/etc/klish/klishd.conf"
  9. #define DEFAULT_DBS "libxml2"
  10. /** @brief Unix socket parameters specified in the config file.
  11. *
  12. * It is used to configure the permissions and ownership of the socket file.
  13. */
  14. struct unix_socket_config {
  15. char *path;
  16. char *user;
  17. char *group;
  18. char *mode;
  19. };
  20. /** @brief Command line and config file options
  21. */
  22. struct options {
  23. char *pidfile;
  24. char *cfgfile;
  25. bool_t cfgfile_userdefined;
  26. struct unix_socket_config socket_cfg;
  27. char *dbs;
  28. bool_t foreground; // Don't daemonize
  29. bool_t verbose;
  30. int log_facility;
  31. };
  32. // Options and config file
  33. void help(int status, const char *argv0);
  34. struct options *opts_init(void);
  35. void opts_free(struct options *opts);
  36. int opts_parse(int argc, char *argv[], struct options *opts);
  37. int opts_show(struct options *opts);
  38. faux_ini_t *config_parse(const char *cfgfile, struct options *opts);