conf.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. bool disabled; /* is bot disabled in the conf? */
  23. char *nick;
  24. char *pid_file; /* path and filename of the .pid file */
  25. } conf_bot;
  26. typedef struct conf_b {
  27. conf_bot *bots; /* the list of bots */
  28. conf_bot *bot; /* single bot (me) */
  29. int uid;
  30. int autouname; /* should we just auto update any changed in uname output? */
  31. int pscloak; /* should the bots bother trying to cloak `ps`? */
  32. int autocron; /* should the bot auto crontab itself? */
  33. int watcher; /* spawn a watcher pid to block ptrace? */
  34. char *localhub; /* my localhub */
  35. char *uname;
  36. char *tempdir;
  37. char *username; /* shell username */
  38. char *homedir; /* homedir */
  39. char *binpath; /* path to binary, ie: ~/ */
  40. char *binname; /* binary name, ie: .sshrc */
  41. port_t portmin; /* for hubs, the reserved port range for incoming connections */
  42. port_t portmax; /* for hubs, the reserved port range for incoming connections */
  43. } conf_t;
  44. extern conf_t conf;
  45. enum {
  46. CONF_ENC = 1,
  47. CONF_COMMENT = 2
  48. };
  49. void spawnbot(const char *);
  50. void spawnbots(bool rehashed = 0);
  51. int conf_killbot(const char *, conf_bot *, int);
  52. void confedit() __attribute__((noreturn));
  53. void conf_addbot(char *, char *, char *, char *);
  54. int conf_delbot(char *);
  55. pid_t checkpid(const char *, conf_bot *);
  56. void init_conf();
  57. void free_conf();
  58. void free_conf_bots(conf_bot *);
  59. int readconf(const char *, int);
  60. int parseconf(bool);
  61. int writeconf(char *, FILE *, int);
  62. void fill_conf_bot();
  63. void bin_to_conf(void);
  64. void conf_checkpids();
  65. void conf_add_userlist_bots();
  66. conf_bot *conf_bots_dup(conf_bot *);
  67. void kill_removed_bots(conf_bot *, conf_bot *);
  68. #ifdef CYGWIN_HACKS
  69. extern char cfile[DIRMAX];
  70. #endif /* CYGWIN_HACKS */
  71. #endif /* !_CONF_H */