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 features; /* Pack features (take, mdop, beta... etc..) */
  30. int uid;
  31. int autocron; /* should the bot auto crontab itself? */
  32. char *localhub; /* my localhub */
  33. char *localhub_socket; /* my localhub unix socket */
  34. char *datadir;
  35. char *username; /* shell username */
  36. char *homedir; /* homedir */
  37. port_t portmin; /* for hubs, the reserved port range for incoming connections */
  38. port_t portmax; /* for hubs, the reserved port range for incoming connections */
  39. } conf_t;
  40. extern conf_t conf;
  41. enum {
  42. CONF_ENC = 1,
  43. CONF_COMMENT = 2
  44. };
  45. void spawnbot(const char *);
  46. void spawnbots(conf_bot *bots, bool rehashed = 0);
  47. int conf_killbot(conf_bot *, const char *, conf_bot *, int, bool = 0);
  48. void confedit() __attribute__((noreturn));
  49. void conf_addbot(const char*, const char*, const char*, const char*);
  50. int conf_delbot(char *, bool kill = 1);
  51. pid_t checkpid(const char *, conf_bot *);
  52. void init_conf();
  53. void free_conf();
  54. void free_conf_bots(conf_bot *);
  55. void free_bot(conf_bot *bot);
  56. int readconf(const char *, int);
  57. int parseconf(bool);
  58. int writeconf(char *, int, int);
  59. void fill_conf_bot(bool fatal = 1);
  60. void bin_to_conf(bool error = 0);
  61. void conf_checkpids(conf_bot *bots, bool all = 1);
  62. void conf_add_userlist_bots();
  63. conf_bot *conf_bots_dup(conf_bot *);
  64. void deluser_removed_bots(conf_bot *, conf_bot *);
  65. conf_bot *conf_getlocalhub(conf_bot *);
  66. void conf_setmypid(pid_t);
  67. void conf_bot_dup(conf_bot *dest, conf_bot *src);
  68. #ifdef CYGWIN_HACKS
  69. extern char cfile[DIRMAX];
  70. #endif /* CYGWIN_HACKS */
  71. #endif /* !_CONF_H */