nodefamily.h (1852B)
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 */ 6 7 /** 8 * \file nodefamily.h 9 * \brief Header file for nodefamily.c. 10 **/ 11 12 #ifndef TOR_NODEFAMILY_H 13 #define TOR_NODEFAMILY_H 14 15 #include "lib/malloc/malloc.h" 16 #include <stdbool.h> 17 18 typedef struct nodefamily_t nodefamily_t; 19 struct node_t; 20 struct smartlist_t; 21 22 #define NF_WARN_MALFORMED (1u<<0) 23 #define NF_REJECT_MALFORMED (1u<<1) 24 25 nodefamily_t *nodefamily_parse(const char *s, 26 const uint8_t *rsa_id_self, 27 unsigned flags); 28 nodefamily_t *nodefamily_from_members(const struct smartlist_t *members, 29 const uint8_t *rsa_id_self, 30 unsigned flags, 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)) 35 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, 39 const char *name); 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, 46 unsigned flags); 47 48 void nodefamily_free_all(void); 49 50 #endif /* !defined(TOR_NODEFAMILY_H) */