Tor  0.4.7.0-alpha-dev
or_sys.c
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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * @file or_sys.c
9  * @brief Subsystem definitions for OR module.
10  **/
11 
12 #include "orconfig.h"
13 #include "core/or/or.h"
14 #include "core/or/or_periodic.h"
15 #include "core/or/or_sys.h"
16 #include "core/or/policies.h"
17 #include "core/or/protover.h"
18 #include "core/or/versions.h"
19 
20 #include "lib/subsys/subsys.h"
21 
22 static int
23 subsys_or_initialize(void)
24 {
25  or_register_periodic_events();
26  return 0;
27 }
28 
29 static void
30 subsys_or_shutdown(void)
31 {
35 }
36 
37 static int
38 subsys_or_add_pubsub(struct pubsub_connector_t *connector)
39 {
40  int rv = 0;
41  if (orconn_add_pubsub(connector) < 0)
42  rv = -1;
43  if (ocirc_add_pubsub(connector) < 0)
44  rv = -1;
45  return rv;
46 }
47 
48 const struct subsys_fns_t sys_or = {
49  .name = "or",
51  .supported = true,
52  .level = 20,
53  .initialize = subsys_or_initialize,
54  .shutdown = subsys_or_shutdown,
55  .add_pubsub = subsys_or_add_pubsub,
56 };
Master header file for Tor-specific functionality.
Header for core/or/or_periodic.c.
Header for core/or/or_sys.c.
void policies_free_all(void)
Definition: policies.c:3097
Header file for policies.c.
void protover_free_all(void)
Definition: protover.c:746
Headers and type declarations for protover.c.
struct pubsub_connector_t pubsub_connector_t
const char * name
Definition: subsys.h:43
Types used to declare a subsystem.
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211
void protover_summary_cache_free_all(void)
Definition: versions.c:531
Header file for versions.c.