Tor
0.4.6.0-alpha-dev
lib
confmgt
unitparse.h
Go to the documentation of this file.
1
/* Copyright (c) 2001 Matej Pfajfar.
2
* Copyright (c) 2001-2004, Roger Dingledine.
3
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4
* Copyright (c) 2007-2020, The Tor Project, Inc. */
5
/* See LICENSE for licensing information */
6
7
/**
8
* @file unitparse.h
9
* @brief Header for lib/confmgt/unitparse.c
10
**/
11
12
#ifndef TOR_LIB_CONFMGT_UNITPARSE_H
13
#define TOR_LIB_CONFMGT_UNITPARSE_H
14
15
#include <
lib/cc/torint.h
>
16
17
/** Mapping from a unit name to a multiplier for converting that unit into a
18
* base unit. Used by config_parse_unit. */
19
typedef
struct
unit_table_t
{
20
const
char
*
unit
;
/**< The name of the unit */
21
uint64_t
multiplier
;
/**< How many of the base unit appear in this unit */
22
}
unit_table_t
;
23
24
extern
const
unit_table_t
memory_units
[];
25
extern
const
unit_table_t
time_units
[];
26
extern
const
struct
unit_table_t
time_msec_units
[];
27
28
uint64_t
config_parse_units
(
const
char
*val,
const
unit_table_t
*u,
int
*ok,
29
char
**errmsg_out);
30
31
uint64_t
config_parse_memunit
(
const
char
*s,
int
*ok);
32
int
config_parse_msec_interval
(
const
char
*s,
int
*ok);
33
int
config_parse_interval
(
const
char
*s,
int
*ok);
34
35
#endif
/* !defined(TOR_LIB_CONFMGT_UNITPARSE_H) */
config_parse_interval
int config_parse_interval(const char *s, int *ok)
Definition:
unitparse.c:250
unit_table_t::multiplier
uint64_t multiplier
Definition:
unitparse.h:21
config_parse_units
uint64_t config_parse_units(const char *val, const unit_table_t *u, int *ok, char **errmsg_out)
Definition:
unitparse.c:127
torint.h
Integer definitions used throughout Tor.
memory_units
const unit_table_t memory_units[]
Definition:
unitparse.c:27
unit_table_t::unit
const char * unit
Definition:
unitparse.h:20
time_msec_units
const struct unit_table_t time_msec_units[]
Definition:
unitparse.c:97
time_units
const unit_table_t time_units[]
Definition:
unitparse.c:76
unit_table_t
Definition:
unitparse.h:19
config_parse_msec_interval
int config_parse_msec_interval(const char *s, int *ok)
Definition:
unitparse.c:233
config_parse_memunit
uint64_t config_parse_memunit(const char *s, int *ok)
Definition:
unitparse.c:222
Generated by
1.8.20