tor  0.4.2.0-alpha-dev
nodefamily_st.h
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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef TOR_NODEFAMILY_ST_H
8 #define TOR_NODEFAMILY_ST_H
9 
10 #include "orconfig.h"
11 #include "ht.h"
12 
13 struct nodefamily_t {
15  HT_ENTRY(nodefamily_t) ht_ent;
17  uint32_t refcnt;
19  uint32_t n_members;
20  /* A byte-array encoding the members of this family. We encode each member
21  * as one byte to indicate whether it's a nickname or a fingerprint, plus
22  * DIGEST_LEN bytes of data. The entries are lexically sorted.
23  */
24  uint8_t family_members[FLEXIBLE_ARRAY_MEMBER];
25 };
26 
27 #define NODEFAMILY_MEMBER_LEN (1+DIGEST_LEN)
28 
31 #define NODEFAMILY_BY_RSA_ID 0
32 
34 #define NODEFAMILY_BY_NICKNAME 1
35 
39 #define NODEFAMILY_ARRAY_SIZE(n) \
40  ((n) * NODEFAMILY_MEMBER_LEN)
41 
45 #define NODEFAMILY_MEMBER_PTR(nf, i) \
46  (&((nf)->family_members[(i) * NODEFAMILY_MEMBER_LEN]))
47 
48 #endif /* !defined(TOR_NODEFAMILY_ST_H) */
uint32_t n_members
Definition: nodefamily_st.h:19
HT_ENTRY(nodefamily_t) ht_ent
uint32_t refcnt
Definition: nodefamily_st.h:17