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 */
9 * \brief Header file for nodefamily.c.
12 #ifndef TOR_NODEFAMILY_H
13 #define TOR_NODEFAMILY_H
15 #include "lib/malloc/malloc.h"
18 typedef struct nodefamily_t nodefamily_t
;
22 #define NF_WARN_MALFORMED (1u<<0)
23 #define NF_REJECT_MALFORMED (1u<<1)
25 nodefamily_t
*nodefamily_parse(const char *s
,
26 const uint8_t *rsa_id_self
,
28 nodefamily_t
*nodefamily_from_members(const struct smartlist_t
*members
,
29 const uint8_t *rsa_id_self
,
31 smartlist_t
*unrecognized_out
);
32 void nodefamily_free_(nodefamily_t
*family
);
33 #define nodefamily_free(family) \
34 FREE_AND_NULL(nodefamily_t, nodefamily_free_, (family))
36 bool nodefamily_contains_rsa_id(const nodefamily_t
*family
,
37 const uint8_t *rsa_id
);
38 bool nodefamily_contains_nickname(const nodefamily_t
*family
,
40 bool nodefamily_contains_node(const nodefamily_t
*family
,
41 const struct node_t
*node
);
42 void nodefamily_add_nodes_to_smartlist(const nodefamily_t
*family
,
43 struct smartlist_t
*out
);
44 char *nodefamily_format(const nodefamily_t
*family
);
45 char *nodefamily_canonicalize(const char *s
, const uint8_t *rsa_id_self
,
48 void nodefamily_free_all(void);
50 #endif /* !defined(TOR_NODEFAMILY_H) */