routerinfo_st.h 4.8 KB

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