tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

namemap.h (1000B)


      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 */
      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);
     30 unsigned namemap_get_or_create_id(namemap_t *map,
     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) */