tor

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

opts_test_helpers.c (1077B)


      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-2021, The Tor Project, Inc. */
      5 /* See LICENSE for licensing information */
      6 
      7 /**
      8 * @file opts_testing_helpers.c
      9 * @brief Helper functions to access module-specific config options.
     10 **/
     11 
     12 #include "orconfig.h"
     13 #include "test/opts_test_helpers.h"
     14 
     15 #define CONFIG_PRIVATE
     16 #include "core/or/or.h"
     17 #include "lib/confmgt/confmgt.h"
     18 #include "app/main/subsysmgr.h"
     19 #include "app/config/config.h"
     20 
     21 #include "lib/crypt_ops/crypto_sys.h"
     22 #include "feature/dirauth/dirauth_sys.h"
     23 
     24 struct dirauth_options_t *
     25 get_dirauth_options(struct or_options_t *opt)
     26 {
     27  int idx = subsystems_get_options_idx(&sys_dirauth);
     28  tor_assert(idx >= 0);
     29  return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx);
     30 }
     31 
     32 struct crypto_options_t *
     33 get_crypto_options(struct or_options_t *opt)
     34 {
     35  int idx = subsystems_get_options_idx(&sys_crypto);
     36  tor_assert(idx >= 0);
     37  return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx);
     38 }