A clone of btpd with my configuration changes.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

94 wiersze
1.6 KiB

  1. #ifndef BTPD_H
  2. #define BTPD_H
  3. #include <sys/types.h>
  4. #include <sys/time.h>
  5. #include <assert.h>
  6. #include <errno.h>
  7. #include <event.h>
  8. #include <inttypes.h>
  9. #include <stddef.h>
  10. #include <stdlib.h>
  11. #include "queue.h"
  12. #include "benc.h"
  13. #include "metainfo.h"
  14. #include "iobuf.h"
  15. #include "net.h"
  16. #include "peer.h"
  17. #include "torrent.h"
  18. #include "policy.h"
  19. #include "subr.h"
  20. #define BTPD_VERSION (PACKAGE_NAME "/" PACKAGE_VERSION)
  21. struct child {
  22. pid_t pid;
  23. void *data;
  24. void (*child_done)(struct child *child);
  25. BTPDQ_ENTRY(child) entry;
  26. };
  27. BTPDQ_HEAD(child_tq, child);
  28. struct btpd {
  29. uint8_t peer_id[20];
  30. const char *version;
  31. uint32_t logmask;
  32. struct child_tq kids;
  33. unsigned ntorrents;
  34. struct torrent_tq cm_list;
  35. struct bwlim_tq bwq;
  36. struct peer_tq readq;
  37. struct peer_tq writeq;
  38. int port;
  39. int peer4_sd;
  40. int ipc_sd;
  41. unsigned long obwlim, ibwlim;
  42. unsigned long ibw_left, obw_left;
  43. unsigned npeers;
  44. unsigned maxpeers;
  45. unsigned long seconds;
  46. struct event cli;
  47. struct event accept4;
  48. struct event heartbeat;
  49. struct event sigint;
  50. struct event sigterm;
  51. struct event sigchld;
  52. };
  53. extern struct btpd btpd;
  54. #define BTPD_L_ALL 0xffffffff
  55. #define BTPD_L_ERROR 0x00000001
  56. #define BTPD_L_TRACKER 0x00000002
  57. #define BTPD_L_CONN 0x00000004
  58. #define BTPD_L_MSG 0x00000008
  59. #define BTPD_L_BTPD 0x00000010
  60. #define BTPD_L_POL 0x00000020
  61. void btpd_log(uint32_t type, const char *fmt, ...);
  62. void btpd_err(const char *fmt, ...);
  63. void *btpd_malloc(size_t size);
  64. void *btpd_calloc(size_t nmemb, size_t size);
  65. void btpd_shutdown(void);
  66. #endif