Tor  0.4.3.0-alpha-dev
routermode.h
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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file routermode.h
9  * \brief Header file for routermode.c.
10  **/
11 
12 #ifndef TOR_ROUTERMODE_H
13 #define TOR_ROUTERMODE_H
14 
15 #ifdef HAVE_MODULE_RELAY
16 
17 int dir_server_mode(const or_options_t *options);
18 
19 MOCK_DECL(int, server_mode, (const or_options_t *options));
20 MOCK_DECL(int, public_server_mode, (const or_options_t *options));
21 MOCK_DECL(int, advertised_server_mode, (void));
22 
23 void set_server_advertised(int s);
24 
25 /** Is the relay module enabled? */
26 #define have_module_relay() (1)
27 
28 #else /* !defined(HAVE_MODULE_RELAY) */
29 
30 #define dir_server_mode(options) (((void)(options)),0)
31 #define server_mode(options) (((void)(options)),0)
32 #define public_server_mode(options) (((void)(options)),0)
33 #define advertised_server_mode() (0)
34 
35 /* We shouldn't be publishing descriptors when relay mode is disabled. */
36 #define set_server_advertised(s) tor_assert_nonfatal(!(s))
37 
38 #define have_module_relay() (0)
39 
40 #endif /* defined(HAVE_MODULE_RELAY) */
41 
42 #endif /* !defined(TOR_ROUTERMODE_H) */
int dir_server_mode(const or_options_t *options)
Definition: routermode.c:23
void set_server_advertised(int s)
Definition: routermode.c:65
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
int public_server_mode(const or_options_t *options)
Definition: routermode.c:43
int server_mode(const or_options_t *options)
Definition: routermode.c:34
int advertised_server_mode(void)
Definition: routermode.c:55