Merge branch 'maint-0.4.8'
[tor.git] / src / core / or / extendinfo.h
blob3419a4e043da8a38b830392b9da79a176c0f13c9
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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * @file extendinfo.h
9 * @brief Header for core/or/extendinfo.c
10 **/
12 #ifndef TOR_CORE_OR_EXTENDINFO_H
13 #define TOR_CORE_OR_EXTENDINFO_H
15 extend_info_t *extend_info_new(const char *nickname,
16 const char *rsa_id_digest,
17 const struct ed25519_public_key_t *ed_id,
18 const struct curve25519_public_key_t *ntor_key,
19 const tor_addr_t *addr, uint16_t port,
20 const struct protover_summary_flags_t *pv,
21 bool for_exit_use);
22 extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect,
23 bool for_exit);
24 extend_info_t *extend_info_dup(extend_info_t *info);
25 void extend_info_free_(extend_info_t *info);
26 #define extend_info_free(info) \
27 FREE_AND_NULL(extend_info_t, extend_info_free_, (info))
28 int extend_info_addr_is_allowed(const tor_addr_t *addr);
29 int extend_info_supports_ntor(const extend_info_t* ei);
30 int extend_info_supports_ntor_v3(const extend_info_t *ei);
31 int extend_info_has_preferred_onion_key(const extend_info_t* ei);
32 bool extend_info_has_orport(const extend_info_t *ei,
33 const tor_addr_t *addr, uint16_t port);
34 int extend_info_add_orport(extend_info_t *ei,
35 const tor_addr_t *addr,
36 uint16_t port);
37 const tor_addr_port_t *extend_info_get_orport(const extend_info_t *ei,
38 int family);
39 const tor_addr_port_t *extend_info_pick_orport(const extend_info_t *ei);
40 bool extend_info_any_orport_addr_is_internal(const extend_info_t *ei);
42 #endif /* !defined(TOR_CORE_OR_EXTENDINFO_H) */