tor  0.4.2.1-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-2018, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 #ifndef TOR_NAMEMAP_H
7 #define TOR_NAMEMAP_H
8 
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 
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:128
size_t namemap_get_size(const namemap_t *map)
Definition: namemap.c:160
void namemap_clear(namemap_t *map)
Definition: namemap.c:172
const char * namemap_get_name(const namemap_t *map, unsigned id)
Definition: namemap.c:49
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:65
unsigned namemap_get_id(const namemap_t *map, const char *name)
Definition: namemap.c:109