nodefamily.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file nodefamily.h
  8. * \brief Header file for nodefamily.c.
  9. **/
  10. #ifndef TOR_NODEFAMILY_H
  11. #define TOR_NODEFAMILY_H
  12. #include "lib/malloc/malloc.h"
  13. #include <stdbool.h>
  14. typedef struct nodefamily_t nodefamily_t;
  15. struct node_t;
  16. struct smartlist_t;
  17. #define NF_WARN_MALFORMED (1u<<0)
  18. #define NF_REJECT_MALFORMED (1u<<1)
  19. nodefamily_t *nodefamily_parse(const char *s,
  20. const uint8_t *rsa_id_self,
  21. unsigned flags);
  22. nodefamily_t *nodefamily_from_members(const struct smartlist_t *members,
  23. const uint8_t *rsa_id_self,
  24. unsigned flags,
  25. smartlist_t *unrecognized_out);
  26. void nodefamily_free_(nodefamily_t *family);
  27. #define nodefamily_free(family) \
  28. FREE_AND_NULL(nodefamily_t, nodefamily_free_, (family))
  29. bool nodefamily_contains_rsa_id(const nodefamily_t *family,
  30. const uint8_t *rsa_id);
  31. bool nodefamily_contains_nickname(const nodefamily_t *family,
  32. const char *name);
  33. bool nodefamily_contains_node(const nodefamily_t *family,
  34. const struct node_t *node);
  35. void nodefamily_add_nodes_to_smartlist(const nodefamily_t *family,
  36. struct smartlist_t *out);
  37. char *nodefamily_format(const nodefamily_t *family);
  38. char *nodefamily_canonicalize(const char *s, const uint8_t *rsa_id_self,
  39. unsigned flags);
  40. void nodefamily_free_all(void);
  41. #endif