Tor  0.4.4.0-alpha-dev
namemap.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2020, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 #ifndef TOR_NAMEMAP_H
7 #define TOR_NAMEMAP_H
8 
9 /**
10  * \file namemap.h
11  *
12  * \brief Header for namemap.c
13  **/
14 
15 #include "lib/cc/compat_compiler.h"
16 #include "ext/ht.h"
17 
18 #include <stddef.h>
19 
20 typedef struct namemap_t namemap_t;
21 
22 /** Returned in place of an identifier when an error occurs. */
23 #define NAMEMAP_ERR UINT_MAX
24 
25 void namemap_init(namemap_t *map);
26 const char *namemap_get_name(const namemap_t *map, unsigned id);
27 const char *namemap_fmt_name(const namemap_t *map, unsigned id);
28 unsigned namemap_get_id(const namemap_t *map,
29  const char *name);
31  const char *name);
32 size_t namemap_get_size(const namemap_t *map);
33 void namemap_clear(namemap_t *map);
34 
35 #endif /* !defined(TOR_NAMEMAP_H) */
unsigned namemap_get_or_create_id(namemap_t *map, const char *name)
Definition: namemap.c:133
size_t namemap_get_size(const namemap_t *map)
Definition: namemap.c:165
void namemap_clear(namemap_t *map)
Definition: namemap.c:177
const char * namemap_get_name(const namemap_t *map, unsigned id)
Definition: namemap.c:54
const char * name
Definition: config.c:2441
Utility macros to handle different features and behavior in different compilers.
const char * namemap_fmt_name(const namemap_t *map, unsigned id)
Definition: namemap.c:70
unsigned namemap_get_id(const namemap_t *map, const char *name)
Definition: namemap.c:114