Line data Source code
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 relay_sys.c 9 : * @brief Subsystem definitions for the relay module. 10 : **/ 11 : 12 : #include "orconfig.h" 13 : #include "core/or/or.h" 14 : 15 : #include "feature/relay/dns.h" 16 : #include "feature/relay/ext_orport.h" 17 : #include "feature/relay/relay_metrics.h" 18 : #include "feature/relay/onion_queue.h" 19 : #include "feature/relay/relay_periodic.h" 20 : #include "feature/relay/relay_sys.h" 21 : #include "feature/relay/routerkeys.h" 22 : #include "feature/relay/router.h" 23 : 24 : #include "lib/subsys/subsys.h" 25 : 26 : static int 27 244 : subsys_relay_initialize(void) 28 : { 29 244 : relay_metrics_init(); 30 244 : relay_register_periodic_events(); 31 244 : return 0; 32 : } 33 : 34 : static void 35 235 : subsys_relay_shutdown(void) 36 : { 37 235 : dns_free_all(); 38 235 : ext_orport_free_all(); 39 235 : clear_pending_onions(); 40 235 : routerkeys_free_all(); 41 235 : router_free_all(); 42 235 : relay_metrics_free(); 43 235 : } 44 : 45 : const struct subsys_fns_t sys_relay = { 46 : .name = "relay", 47 : SUBSYS_DECLARE_LOCATION(), 48 : .supported = true, 49 : .level = RELAY_SUBSYS_LEVEL, 50 : .initialize = subsys_relay_initialize, 51 : .shutdown = subsys_relay_shutdown, 52 : 53 : .get_metrics = relay_metrics_get_stores, 54 : };