conf.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. char *nick;
  22. char *pid_file; /* path and filename of the .pid file */
  23. bool hub; /* should bot behave as a hub? */
  24. } conf_bot;
  25. typedef struct conf_b {
  26. conf_bot *bots; /* the list of bots */
  27. conf_bot *bot; /* single bot (me) */
  28. uid_t 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 *comments; /* we dont want to lose our comments now do we?! */
  34. char *localhub; /* my localhub */
  35. char *uname;
  36. char *username; /* shell username */
  37. char *homedir; /* homedir */
  38. char *binpath; /* path to binary, ie: ~/ */
  39. char *binname; /* binary name, ie: .sshrc */
  40. port_t portmin; /* for hubs, the reserved port range for incoming connections */
  41. port_t portmax; /* for hubs, the reserved port range for incoming connections */
  42. } conf_t;
  43. extern conf_t conf;
  44. enum {
  45. CONF_ENC = 1,
  46. CONF_COMMENT = 2
  47. };
  48. void spawnbot(const char *);
  49. void spawnbots();
  50. int killbot(char *, int);
  51. void confedit() __attribute__((noreturn));
  52. void conf_addbot(char *, char *, char *, char *);
  53. int conf_delbot(char *);
  54. pid_t checkpid(char *, conf_bot *);
  55. void init_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. #ifdef CYGWIN_HACKS
  63. extern char cfile[DIRMAX];
  64. #endif /* CYGWIN_HACKS */
  65. #endif /* !_CONF_H */