protover.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef TOR_PROTOVER_H
  2. #define TOR_PROTOVER_H
  3. #include "container.h"
  4. /* This is a guess. */
  5. #define FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS "0.2.9.3-alpha"
  6. typedef enum protocol_type_t {
  7. PRT_LINK,
  8. PRT_LINKAUTH,
  9. PRT_RELAY,
  10. PRT_HSMID,
  11. PRT_DIRCACHE,
  12. PRT_HSDIR,
  13. PRT_DESC,
  14. PRT_MICRODESC,
  15. PRT_CONS,
  16. } protocol_type_t;
  17. /*
  18. const protover_set_t *protover_get_supported(void);
  19. protover_set_t *protover_set_parse(const char *s);
  20. int protover_is_supported_here_str(const char *name, uint32_t ver);
  21. int protover_is_supported_by(protocol_type_t pr, uint32_t ver);
  22. */
  23. int protover_all_supported(const char *s, char **missing);
  24. int protover_is_supported_here(protocol_type_t pr, uint32_t ver);
  25. const char *get_supported_protocols(void);
  26. char * compute_protover_vote(const smartlist_t *list_of_proto_strings,
  27. int threshold);
  28. const char *protover_compute_for_old_tor(const char *version);
  29. int protocol_list_supports_protocol(const char *list, protocol_type_t tp,
  30. uint32_t version);
  31. void protover_free_all(void);
  32. #ifdef PROTOVER_PRIVATE
  33. typedef struct proto_range_t {
  34. uint32_t low;
  35. uint32_t high;
  36. } proto_range_t;
  37. typedef struct proto_entry_t {
  38. char *name;
  39. smartlist_t *ranges;
  40. } proto_entry_t;
  41. STATIC smartlist_t *parse_protocol_list(const char *s);
  42. STATIC void proto_entry_free(proto_entry_t *entry);
  43. STATIC char *encode_protocol_list(const smartlist_t *sl);
  44. STATIC const char *protocol_type_to_str(protocol_type_t pr);
  45. STATIC int str_to_protocol_type(const char *s, protocol_type_t *pr_out);
  46. #endif
  47. #endif