scripts: Fix Python3 warnings
[tor.git] / src / lib / container / namemap_st.h
blobe9cafe8f53ca1cc9cf1d681ef6b854de28c47f03
1 /* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
6 #ifndef NAMEMAP_ST_H
7 #define NAMEMAP_ST_H
9 /**
10 * @file namemap_st.h
11 * @brief Internal declarations for namemap structure.
12 **/
14 #include "lib/cc/compat_compiler.h"
15 #include "ext/ht.h"
17 struct smartlist_t;
19 /** Longest allowed name that's allowed in a namemap_t. */
20 #define MAX_NAMEMAP_NAME_LEN 128
22 /** An entry inside a namemap_t. Maps a string to a numeric identifier. */
23 typedef struct mapped_name_t {
24 HT_ENTRY(mapped_name_t) node;
25 unsigned intval;
26 char name[FLEXIBLE_ARRAY_MEMBER];
27 } mapped_name_t;
29 /** A structure that allocates small numeric identifiers for names and maps
30 * back and forth between them. */
31 struct namemap_t {
32 HT_HEAD(namemap_ht, mapped_name_t) ht;
33 struct smartlist_t *names;
36 #ifndef COCCI
37 /** Macro to initialize a namemap. */
38 #define NAMEMAP_INIT() { HT_INITIALIZER(), NULL }
39 #endif
41 #endif /* !defined(NAMEMAP_ST_H) */