routerinfo_st.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef ROUTERINFO_ST_H
  7. #define ROUTERINFO_ST_H
  8. #include "or/signed_descriptor_st.h"
  9. /** Information about another onion router in the network. */
  10. struct routerinfo_t {
  11. signed_descriptor_t cache_info;
  12. char *nickname; /**< Human-readable OR name. */
  13. uint32_t addr; /**< IPv4 address of OR, in host order. */
  14. uint16_t or_port; /**< Port for TLS connections. */
  15. uint16_t dir_port; /**< Port for HTTP directory connections. */
  16. /** A router's IPv6 address, if it has one. */
  17. /* XXXXX187 Actually these should probably be part of a list of addresses,
  18. * not just a special case. Use abstractions to access these; don't do it
  19. * directly. */
  20. tor_addr_t ipv6_addr;
  21. uint16_t ipv6_orport;
  22. crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
  23. crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
  24. /** Public curve25519 key for onions */
  25. curve25519_public_key_t *onion_curve25519_pkey;
  26. /** What's the earliest expiration time on all the certs in this
  27. * routerinfo? */
  28. time_t cert_expiration_time;
  29. char *platform; /**< What software/operating system is this OR using? */
  30. char *protocol_list; /**< Encoded list of subprotocol versions supported
  31. * by this OR */
  32. /* link info */
  33. uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
  34. * bucket per second? */
  35. uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
  36. /** How many bytes/s is this router known to handle? */
  37. uint32_t bandwidthcapacity;
  38. smartlist_t *exit_policy; /**< What streams will this OR permit
  39. * to exit on IPv4? NULL for 'reject *:*'. */
  40. /** What streams will this OR permit to exit on IPv6?
  41. * NULL for 'reject *:*' */
  42. struct short_policy_t *ipv6_exit_policy;
  43. long uptime; /**< How many seconds the router claims to have been up */
  44. smartlist_t *declared_family; /**< Nicknames of router which this router
  45. * claims are its family. */
  46. char *contact_info; /**< Declared contact info for this router. */
  47. unsigned int is_hibernating:1; /**< Whether the router claims to be
  48. * hibernating */
  49. unsigned int caches_extra_info:1; /**< Whether the router says it caches and
  50. * serves extrainfo documents. */
  51. unsigned int allow_single_hop_exits:1; /**< Whether the router says
  52. * it allows single hop exits. */
  53. unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
  54. * a hidden service directory. */
  55. unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
  56. * router rejects everything. */
  57. /** True if, after we have added this router, we should re-launch
  58. * tests for it. */
  59. unsigned int needs_retest_if_added:1;
  60. /** True iff this router included "tunnelled-dir-server" in its descriptor,
  61. * implying it accepts tunnelled directory requests, or it advertised
  62. * dir_port > 0. */
  63. unsigned int supports_tunnelled_dir_requests:1;
  64. /** Used during voting to indicate that we should not include an entry for
  65. * this routerinfo. Used only during voting. */
  66. unsigned int omit_from_vote:1;
  67. /** Flags to summarize the protocol versions for this routerinfo_t. */
  68. protover_summary_flags_t pv;
  69. /** Tor can use this router for general positions in circuits; we got it
  70. * from a directory server as usual, or we're an authority and a server
  71. * uploaded it. */
  72. #define ROUTER_PURPOSE_GENERAL 0
  73. /** Tor should avoid using this router for circuit-building: we got it
  74. * from a controller. If the controller wants to use it, it'll have to
  75. * ask for it by identity. */
  76. #define ROUTER_PURPOSE_CONTROLLER 1
  77. /** Tor should use this router only for bridge positions in circuits: we got
  78. * it via a directory request from the bridge itself, or a bridge
  79. * authority. */
  80. #define ROUTER_PURPOSE_BRIDGE 2
  81. /** Tor should not use this router; it was marked in cached-descriptors with
  82. * a purpose we didn't recognize. */
  83. #define ROUTER_PURPOSE_UNKNOWN 255
  84. /** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
  85. * Routers of different purposes are kept segregated and used for different
  86. * things; see notes on ROUTER_PURPOSE_* macros above.
  87. */
  88. uint8_t purpose;
  89. };
  90. #endif