conf.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef _CONF_H
  2. #define _CONF_H
  3. #include <sys/types.h>
  4. #include <stdio.h>
  5. #include "types.h"
  6. #include "eggdrop.h"
  7. #include "settings.h"
  8. typedef struct conf_net_b {
  9. char *host;
  10. char *host6;
  11. char *ip;
  12. char *ip6;
  13. bool v6;
  14. } conf_net;
  15. typedef struct conf_bot_b {
  16. struct conf_bot_b *next;
  17. struct userrec *u; /* our own user record */
  18. struct conf_net_b net;
  19. pid_t pid; /* contains the PID for the bot (read for the pidfile) */
  20. int localhub; /* bot is localhub */
  21. bool hub; /* should bot behave as a hub? */
  22. char *nick;
  23. char *pid_file; /* path and filename of the .pid file */
  24. } conf_bot;
  25. typedef struct conf_b {
  26. conf_bot *bots; /* the list of bots */
  27. conf_bot *bot; /* single bot (me) */
  28. int uid;
  29. int autouname; /* should we just auto update any changed in uname output? */
  30. int pscloak; /* should the bots bother trying to cloak `ps`? */
  31. int autocron; /* should the bot auto crontab itself? */
  32. int watcher; /* spawn a watcher pid to block ptrace? */
  33. char *localhub; /* my localhub */
  34. char *uname;
  35. char *username; /* shell username */
  36. char *homedir; /* homedir */
  37. char *binpath; /* path to binary, ie: ~/ */
  38. char *binname; /* binary name, ie: .sshrc */
  39. port_t portmin; /* for hubs, the reserved port range for incoming connections */
  40. port_t portmax; /* for hubs, the reserved port range for incoming connections */
  41. } conf_t;
  42. extern conf_t conf;
  43. enum {
  44. CONF_ENC = 1,
  45. CONF_COMMENT = 2
  46. };
  47. void spawnbot(const char *);
  48. void spawnbots();
  49. int killbot(char *, int);
  50. void confedit() __attribute__((noreturn));
  51. void conf_addbot(char *, char *, char *, char *);
  52. int conf_delbot(char *);
  53. pid_t checkpid(char *, conf_bot *);
  54. void init_conf();
  55. void free_conf();
  56. void free_conf_bots();
  57. int readconf(const char *, int);
  58. int parseconf(bool);
  59. int writeconf(char *, FILE *, int);
  60. void fill_conf_bot();
  61. void bin_to_conf(void);
  62. void conf_checkpids();
  63. #ifdef CYGWIN_HACKS
  64. extern char cfile[DIRMAX];
  65. #endif /* CYGWIN_HACKS */
  66. #endif /* !_CONF_H */