A clone of btpd with my configuration changes.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

  1. #ifndef BTPD_IF_H
  2. #define BTPD_IF_H
  3. struct ipc;
  4. enum torrent_state { //XXX: Same as in btpd/torrent.h
  5. T_STARTING,
  6. T_ACTIVE,
  7. T_STOPPING
  8. };
  9. enum ipc_code {
  10. IPC_OK,
  11. IPC_FAIL,
  12. IPC_ERROR,
  13. IPC_COMMERR
  14. };
  15. struct btstat {
  16. unsigned ntorrents;
  17. struct tpstat {
  18. uint8_t *hash;
  19. char *name;
  20. enum torrent_state state;
  21. unsigned tr_errors;
  22. unsigned peers;
  23. uint32_t pieces_got, pieces_seen, torrent_pieces;
  24. off_t content_got, content_size;
  25. unsigned long long downloaded, uploaded;
  26. unsigned long rate_up, rate_down;
  27. } torrents[];
  28. };
  29. int ipc_open(const char *dir, struct ipc **out);
  30. int ipc_close(struct ipc *ipc);
  31. enum ipc_code btpd_add(struct ipc *ipc, const uint8_t *hash,
  32. const char *torrent, const char *content);
  33. enum ipc_code btpd_del(struct ipc *ipc, const uint8_t *hash);
  34. enum ipc_code btpd_die(struct ipc *ipc, int seconds);
  35. enum ipc_code btpd_stat(struct ipc *ipc, struct btstat **out);
  36. void free_btstat(struct btstat *stat);
  37. #endif