diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-11-19 08:26:49 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-11-19 08:26:49 -0500 |
commit | 48b08f0592734085d88b7546e39d42f6606026d6 (patch) | |
tree | 11f18270c35a3d10953a19a832340e2af8e69f59 /src/feature/nodelist/nodefamily.h | |
parent | bf82389e198a0cc6c7e078cada7f35a9cbf65fe1 (diff) | |
parent | 0e762c0cf5260040c38e93b4d4204be3f6746301 (diff) | |
download | tor-48b08f0592734085d88b7546e39d42f6606026d6.tar.gz tor-48b08f0592734085d88b7546e39d42f6606026d6.zip |
Merge branch 'ticket27359_v2_squashed'
Diffstat (limited to 'src/feature/nodelist/nodefamily.h')
-rw-r--r-- | src/feature/nodelist/nodefamily.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/feature/nodelist/nodefamily.h b/src/feature/nodelist/nodefamily.h new file mode 100644 index 0000000000..342f161a07 --- /dev/null +++ b/src/feature/nodelist/nodefamily.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2018, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * \file nodefamily.h + * \brief Header file for nodefamily.c. + **/ + +#ifndef TOR_NODEFAMILY_H +#define TOR_NODEFAMILY_H + +#include "lib/malloc/malloc.h" +#include <stdbool.h> + +typedef struct nodefamily_t nodefamily_t; +struct node_t; +struct smartlist_t; + +#define NF_WARN_MALFORMED (1u<<0) +#define NF_REJECT_MALFORMED (1u<<1) + +nodefamily_t *nodefamily_parse(const char *s, + const uint8_t *rsa_id_self, + unsigned flags); +nodefamily_t *nodefamily_from_members(const struct smartlist_t *members, + const uint8_t *rsa_id_self, + unsigned flags); +void nodefamily_free_(nodefamily_t *family); +#define nodefamily_free(family) \ + FREE_AND_NULL(nodefamily_t, nodefamily_free_, (family)) + +bool nodefamily_contains_rsa_id(const nodefamily_t *family, + const uint8_t *rsa_id); +bool nodefamily_contains_nickname(const nodefamily_t *family, + const char *name); +bool nodefamily_contains_node(const nodefamily_t *family, + const struct node_t *node); +void nodefamily_add_nodes_to_smartlist(const nodefamily_t *family, + struct smartlist_t *out); +char *nodefamily_format(const nodefamily_t *family); + +void nodefamily_free_all(void); + +#endif |