unitparse.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * @file unitparse.h
  8. * @brief Header for lib/confmgt/unitparse.c
  9. **/
  10. #ifndef TOR_LIB_CONFMGT_UNITPARSE_H
  11. #define TOR_LIB_CONFMGT_UNITPARSE_H
  12. #include <lib/cc/torint.h>
  13. /** Mapping from a unit name to a multiplier for converting that unit into a
  14. * base unit. Used by config_parse_unit. */
  15. typedef struct unit_table_t {
  16. const char *unit; /**< The name of the unit */
  17. uint64_t multiplier; /**< How many of the base unit appear in this unit */
  18. } unit_table_t;
  19. extern const unit_table_t memory_units[];
  20. extern const unit_table_t time_units[];
  21. extern const struct unit_table_t time_msec_units[];
  22. uint64_t config_parse_units(const char *val, const unit_table_t *u, int *ok);
  23. uint64_t config_parse_memunit(const char *s, int *ok);
  24. int config_parse_msec_interval(const char *s, int *ok);
  25. int config_parse_interval(const char *s, int *ok);
  26. #endif /* !defined(TOR_LIB_CONFMGT_UNITPARSE_H) */