Tor  0.4.6.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-2020, 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 };
SUBSYS_DECLARE_LOCATION
#define SUBSYS_DECLARE_LOCATION()
Definition: subsys.h:211
versions.h
Header file for versions.c.
protover.h
Headers and type declarations for protover.c.
protover_summary_cache_free_all
void protover_summary_cache_free_all(void)
Definition: versions.c:531
subsys.h
Types used to declare a subsystem.
protover_free_all
void protover_free_all(void)
Definition: protover.c:746
or_periodic.h
Header for core/or/or_periodic.c.
subsys_fns_t::name
const char * name
Definition: subsys.h:43
policies_free_all
void policies_free_all(void)
Definition: policies.c:3097
policies.h
Header file for policies.c.
or_sys.h
Header for core/or/or_sys.c.
subsys_fns_t
Definition: subsys.h:38
pubsub_connector_t
struct pubsub_connector_t pubsub_connector_t
Definition: pubsub_connect.h:28
or.h
Master header file for Tor-specific functionality.