An open and free bittorrent tracker https://erdgeist.org/gitweb/opentracker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 lines
1.2 KiB

  1. /* This software was written by Dirk Engling <erdgeist@erdgeist.org>
  2. It is considered beerware. Prost. Skol. Cheers or whatever.
  3. $id$ */
  4. #ifndef OT_VECTOR_H__
  5. #define OT_VECTOR_H__
  6. /* These defines control vectors behaviour */
  7. #define OT_VECTOR_MIN_MEMBERS 2
  8. #define OT_VECTOR_GROW_RATIO 2
  9. #define OT_VECTOR_SHRINK_THRESH 4
  10. #define OT_VECTOR_SHRINK_RATIO 2
  11. #define OT_PEER_BUCKET_MINCOUNT 512
  12. #define OT_PEER_BUCKET_MAXCOUNT 256
  13. typedef struct {
  14. void *data;
  15. size_t size;
  16. size_t space;
  17. } ot_vector;
  18. void *binary_search( const void * const key, const void * base, const size_t member_count, const size_t member_size,
  19. size_t compare_size, int *exactmatch );
  20. void *vector_find_or_insert( ot_vector *vector, void *key, size_t member_size, size_t compare_size, int *exactmatch );
  21. ot_peer *vector_find_or_insert_peer( ot_vector *vector, ot_peer *peer, int *exactmatch );
  22. int vector_remove_peer( ot_vector *vector, ot_peer *peer );
  23. void vector_remove_torrent( ot_vector *vector, ot_torrent *match );
  24. void vector_redistribute_buckets( ot_peerlist * peer_list );
  25. void vector_fixup_peers( ot_vector * vector );
  26. #endif