Tor
0.4.7.0-alpha-dev
|
Mappings between identifiers and 16-bit ints. More...
#include "orconfig.h"
#include "lib/container/smartlist.h"
#include "lib/container/namemap.h"
#include "lib/container/namemap_st.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include "lib/string/printf.h"
#include "ext/siphash.h"
#include <string.h>
Go to the source code of this file.
Functions | |
static int | mapped_name_eq (const mapped_name_t *a, const mapped_name_t *b) |
static unsigned | mapped_name_hash (const mapped_name_t *a) |
HT_PROTOTYPE (namemap_ht, mapped_name_t, node, mapped_name_hash, mapped_name_eq) | |
HT_GENERATE2 (namemap_ht, mapped_name_t, node, mapped_name_hash, mapped_name_eq, 0.6, tor_reallocarray_, tor_free_) | |
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) |
static unsigned | namemap_get_id_unchecked (const namemap_t *map, const char *name, size_t namelen) |
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) |
Mappings between identifiers and 16-bit ints.
Definition in file namemap.c.
|
inlinestatic |
|
inlinestatic |
void namemap_clear | ( | namemap_t * | map | ) |
const char* namemap_fmt_name | ( | const namemap_t * | map, |
unsigned | id | ||
) |
unsigned namemap_get_id | ( | const namemap_t * | map, |
const char * | name | ||
) |
|
static |
Helper: As namemap_get_id(), but requires that name is namelen characters long, and that namelen is no more than MAX_NAMEMAP_NAME_LEN.
Definition at line 89 of file namemap.c.
Referenced by namemap_get_id().
const char* namemap_get_name | ( | const namemap_t * | map, |
unsigned | id | ||
) |
Return the name that map associates with a given id, or NULL if there is no such name.
Definition at line 54 of file namemap.c.
Referenced by namemap_fmt_name().
unsigned namemap_get_or_create_id | ( | namemap_t * | map, |
const char * | name | ||
) |
size_t namemap_get_size | ( | const namemap_t * | map | ) |