dccutil.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _DCCUTIL_H
  2. #define _DCCUTIL_H
  3. #include "common.h"
  4. #include "dcc.h"
  5. /* Public structure for the listening port map */
  6. struct portmap {
  7. in_port_t realport;
  8. in_port_t mappedto;
  9. struct portmap *next;
  10. };
  11. namespace bd {
  12. class Stream;
  13. class String;
  14. }
  15. #define dprintf dprintf_eggdrop
  16. /* Fake idx's for dprintf - these should be ridiculously large +ve nums
  17. */
  18. #define DP_STDOUT 0x7FF1
  19. //#define DP_LOG 0x7FF2
  20. #define DP_DEBUG 0x7FF2
  21. #define DP_SERVER 0x7FF3
  22. #define DP_HELP 0x7FF4
  23. #define DP_STDERR 0x7FF5
  24. #define DP_MODE 0x7FF6
  25. #define DP_MODE_NEXT 0x7FF7
  26. #define DP_SERVER_NEXT 0x7FF8
  27. #define DP_HELP_NEXT 0x7FF9
  28. #define DP_DUMP 0x8000
  29. #define DP_CACHE 0x8001
  30. #define DP_PLAY 0x8002
  31. void init_dcc(void);
  32. void dumplots(int, const bd::String&, const bd::String&);
  33. void rdprintf(const char*, int, const char *, ...) __attribute__((format(printf, 3, 4)));
  34. void dprintf(int, const char *, ...) __attribute__((format(printf, 2, 3)));
  35. void dprintf_real(int, char*, size_t, size_t, const char* = NULL);
  36. void chatout(const char *, ...) __attribute__((format(printf, 1, 2)));
  37. void chanout_but(int, int, const char *, ...) __attribute__((format(printf, 3, 4)));
  38. void dcc_chatter(int);
  39. void lostdcc(int);
  40. void makepass(char *);
  41. void tell_dcc(int);
  42. void not_away(int);
  43. void set_away(int, char *);
  44. void dcc_remove_lost(void);
  45. void flush_lines(int, struct chat_info *);
  46. int new_dcc(struct dcc_table *, int);
  47. void del_dcc(int);
  48. char *add_cr(char *);
  49. void changeover_dcc(int, struct dcc_table *, int);
  50. void do_boot(int, const char *, const char *);
  51. int detect_dcc_flood(time_t *, struct chat_info *, int);
  52. void identd_open(const char * = NULL, const char * = NULL, int identd = 1);
  53. void identd_close();
  54. int listen_all(in_port_t, bool, bool);
  55. static inline bool __attribute__((pure))
  56. valid_idx(int idx)
  57. {
  58. if ((idx == -1) || (idx >= dcc_total) || (!dcc[idx].type))
  59. return false;
  60. return true;
  61. }
  62. int dcc_read(bd::Stream&);
  63. void dcc_write(bd::Stream&, int);
  64. int check_cmd_pass(const char *, char *);
  65. int has_cmd_pass(const char *) __attribute__((pure));
  66. void set_cmd_pass(char *, int);
  67. void cmdpass_free(struct cmd_pass *);
  68. extern int max_dcc;
  69. extern interval_t connect_timeout;
  70. #endif /* !_DCCUTIL_H */