protover.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. void protover_free_all(void);
  30. #ifdef PROTOVER_PRIVATE
  31. typedef struct proto_range_t {
  32. uint32_t low;
  33. uint32_t high;
  34. } proto_range_t;
  35. typedef struct proto_entry_t {
  36. char *name;
  37. smartlist_t *ranges;
  38. } proto_entry_t;
  39. STATIC smartlist_t *parse_protocol_list(const char *s);
  40. STATIC void proto_entry_free(proto_entry_t *entry);
  41. STATIC char *encode_protocol_list(const smartlist_t *sl);
  42. STATIC const char *protocol_type_to_str(protocol_type_t pr);
  43. STATIC int str_to_protocol_type(const char *s, protocol_type_t *pr_out);
  44. #endif
  45. #endif