Tor  0.4.5.0-alpha-dev
proxymode.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 proxymode.c
9  * @brief Determine whether we are trying to be a proxy.
10  **/
11 
12 #include "core/or/or.h"
13 
14 #include "app/config/config.h"
16 #include "core/or/port_cfg_st.h"
18 
19 /** Return true iff we are trying to proxy client connections. */
20 int
21 proxy_mode(const or_options_t *options)
22 {
23  (void)options;
25  if (p->type == CONN_TYPE_AP_LISTENER ||
26  p->type == CONN_TYPE_AP_TRANS_LISTENER ||
27  p->type == CONN_TYPE_AP_DNS_LISTENER ||
28  p->type == CONN_TYPE_AP_NATD_LISTENER)
29  return 1;
30  } SMARTLIST_FOREACH_END(p);
31  return 0;
32 }
port_cfg_st.h
Listener port configuration structure.
CONN_TYPE_AP_TRANS_LISTENER
#define CONN_TYPE_AP_TRANS_LISTENER
Definition: connection.h:63
CONN_TYPE_AP_DNS_LISTENER
#define CONN_TYPE_AP_DNS_LISTENER
Definition: connection.h:68
proxy_mode
int proxy_mode(const or_options_t *options)
Definition: proxymode.c:21
port_cfg_t
Definition: port_cfg_st.h:19
connection.h
Header file for connection.c.
get_configured_ports
const smartlist_t * get_configured_ports(void)
Definition: config.c:6561
SMARTLIST_FOREACH_BEGIN
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
Definition: smartlist_foreach.h:78
proxymode.h
Header file for proxymode.c.
config.h
Header file for config.c.
or_options_t
Definition: or_options_st.h:45
CONN_TYPE_AP_LISTENER
#define CONN_TYPE_AP_LISTENER
Definition: connection.h:48
CONN_TYPE_AP_NATD_LISTENER
#define CONN_TYPE_AP_NATD_LISTENER
Definition: connection.h:66
or.h
Master header file for Tor-specific functionality.