protover.h 1.2 KB

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