nodelist.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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-2011, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file microdesc.h
  8. * \brief Header file for microdesc.c.
  9. **/
  10. #ifndef _TOR_NODELIST_H
  11. #define _TOR_NODELIST_H
  12. node_t *node_get_mutable_by_id(const char *identity_digest);
  13. const node_t *node_get_by_id(const char *identity_digest);
  14. const node_t *node_get_by_hex_id(const char *identity_digest);
  15. node_t *nodelist_add_routerinfo(routerinfo_t *ri);
  16. node_t *nodelist_add_microdesc(microdesc_t *md);
  17. void nodelist_set_consensus(networkstatus_t *ns);
  18. void nodelist_remove_microdesc(const char *identity_digest, microdesc_t *md);
  19. void nodelist_remove_routerinfo(routerinfo_t *ri);
  20. void nodelist_purge(void);
  21. void nodelist_free_all(void);
  22. void nodelist_assert_ok(void);
  23. const node_t *node_get_by_nickname(const char *nickname, int warn_if_unnamed);
  24. void node_get_verbose_nickname(const node_t *node,
  25. char *verbose_name_out);
  26. int node_is_named(const node_t *node);
  27. int node_is_dir(const node_t *node);
  28. int node_has_descriptor(const node_t *node);
  29. int node_get_purpose(const node_t *node);
  30. #define node_is_bridge(node) \
  31. (node_get_purpose((node)) == ROUTER_PURPOSE_BRIDGE)
  32. int node_is_me(const node_t *node);
  33. int node_exit_policy_rejects_all(const node_t *node);
  34. int node_get_addr(const node_t *node, tor_addr_t *addr_out);
  35. uint32_t node_get_addr_ipv4h(const node_t *node);
  36. int node_allows_single_hop_exits(const node_t *node);
  37. uint16_t node_get_orport(const node_t *node);
  38. const char *node_get_nickname(const node_t *node);
  39. const char *node_get_platform(const node_t *node);
  40. void node_get_address_string(const node_t *node, char *cp, size_t len);
  41. long node_get_declared_uptime(const node_t *node);
  42. time_t node_get_published_on(const node_t *node);
  43. const smartlist_t *node_get_declared_family(const node_t *node);
  44. smartlist_t *nodelist_get_list(void);
  45. /* XXXX These need to move out of routerlist.c */
  46. void nodelist_refresh_countries(void);
  47. void node_set_country(node_t *node);
  48. void nodelist_add_node_family(smartlist_t *nodes, const node_t *node);
  49. int nodes_in_same_family(const node_t *node1, const node_t *node2);
  50. #endif