A clone of btpd with my configuration changes.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

54 lines
1.3 KiB

  1. #ifndef BTPD_TLIB_H
  2. #define BTPD_TLIB_H
  3. struct tlib {
  4. unsigned num;
  5. uint8_t hash[20];
  6. struct torrent *tp;
  7. char *name;
  8. char *dir;
  9. unsigned long long tot_up, tot_down;
  10. off_t content_size, content_have;
  11. HTBL_ENTRY(nchain);
  12. HTBL_ENTRY(hchain);
  13. };
  14. struct file_time_size {
  15. off_t size;
  16. time_t mtime;
  17. };
  18. void tlib_init(void);
  19. void tlib_put_all(struct tlib **v);
  20. struct tlib *tlib_add(const uint8_t *hash, const char *mi, size_t mi_size,
  21. const char *content, char *name);
  22. int tlib_del(struct tlib *tl);
  23. void tlib_update_info(struct tlib *tl, int only_file);
  24. struct tlib *tlib_by_hash(const uint8_t *hash);
  25. struct tlib *tlib_by_num(unsigned num);
  26. unsigned tlib_count(void);
  27. int tlib_load_mi(struct tlib *tl, char **res);
  28. void tlib_read_hash(struct tlib *tl, size_t off, uint32_t piece,
  29. uint8_t *hash);
  30. struct resume_data *tlib_open_resume(struct tlib *tl, unsigned nfiles,
  31. size_t pfsize, size_t bfsize);
  32. void tlib_close_resume(struct resume_data *resume);
  33. uint8_t *resume_piece_field(struct resume_data *resd);
  34. uint8_t *resume_block_field(struct resume_data *resd);
  35. void resume_set_fts(struct resume_data *resd, int i,
  36. struct file_time_size *fts);
  37. void resume_get_fts(struct resume_data *resd, int i,
  38. struct file_time_size *fts);
  39. #endif