blob: ad36988f704e2f68e8b2632381aaecfe9fd80d63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/* Copyright (c) 2003-2004, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2021, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_NAMEMAP_H
#define TOR_NAMEMAP_H
/**
* \file namemap.h
*
* \brief Header for namemap.c
**/
#include "lib/cc/compat_compiler.h"
#include "ext/ht.h"
#include <stddef.h>
typedef struct namemap_t namemap_t;
/** Returned in place of an identifier when an error occurs. */
#define NAMEMAP_ERR UINT_MAX
void namemap_init(namemap_t *map);
const char *namemap_get_name(const namemap_t *map, unsigned id);
const char *namemap_fmt_name(const namemap_t *map, unsigned id);
unsigned namemap_get_id(const namemap_t *map,
const char *name);
unsigned namemap_get_or_create_id(namemap_t *map,
const char *name);
size_t namemap_get_size(const namemap_t *map);
void namemap_clear(namemap_t *map);
#endif /* !defined(TOR_NAMEMAP_H) */
|