2019-05-01 21:36:18 +02:00
|
|
|
/* Copyright (c) 2001 Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2020-01-09 00:39:17 +01:00
|
|
|
* Copyright (c) 2007-2020, The Tor Project, Inc. */
|
2019-05-01 21:36:18 +02:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file relay_sys.c
|
|
|
|
* @brief Subsystem definitions for the relay module.
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include "orconfig.h"
|
|
|
|
#include "core/or/or.h"
|
|
|
|
|
|
|
|
#include "feature/relay/dns.h"
|
|
|
|
#include "feature/relay/ext_orport.h"
|
|
|
|
#include "feature/relay/onion_queue.h"
|
2019-05-02 15:52:03 +02:00
|
|
|
#include "feature/relay/relay_periodic.h"
|
2019-05-01 21:36:18 +02:00
|
|
|
#include "feature/relay/relay_sys.h"
|
|
|
|
#include "feature/relay/routerkeys.h"
|
|
|
|
#include "feature/relay/router.h"
|
|
|
|
|
|
|
|
#include "lib/subsys/subsys.h"
|
|
|
|
|
|
|
|
static int
|
|
|
|
subsys_relay_initialize(void)
|
|
|
|
{
|
2019-05-02 15:52:03 +02:00
|
|
|
relay_register_periodic_events();
|
2019-05-01 21:36:18 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
subsys_relay_shutdown(void)
|
|
|
|
{
|
|
|
|
dns_free_all();
|
|
|
|
ext_orport_free_all();
|
|
|
|
clear_pending_onions();
|
|
|
|
routerkeys_free_all();
|
|
|
|
router_free_all();
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct subsys_fns_t sys_relay = {
|
|
|
|
.name = "relay",
|
2020-02-14 15:57:46 +01:00
|
|
|
SUBSYS_DECLARE_LOCATION(),
|
2019-05-01 21:36:18 +02:00
|
|
|
.supported = true,
|
2019-12-18 17:49:26 +01:00
|
|
|
.level = RELAY_SUBSYS_LEVEL,
|
2019-05-01 21:36:18 +02:00
|
|
|
.initialize = subsys_relay_initialize,
|
|
|
|
.shutdown = subsys_relay_shutdown,
|
|
|
|
};
|