summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-10 15:32:26 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-10 15:32:26 -0400
commit6bdfaa8b244ca3e10e57f6d99616af1d5f68fa67 (patch)
treea729843d38786f76d0314e14141a359c269cbc97 /src/or
parent6e467a7a340cdc0267206ebaf8dca54c1a4a7b0a (diff)
parent4178642bf83736d154176623ba8dce845a5b412c (diff)
downloadtor-6bdfaa8b244ca3e10e57f6d99616af1d5f68fa67.tar.gz
tor-6bdfaa8b244ca3e10e57f6d99616af1d5f68fa67.zip
Merge remote-tracking branch 'isis-github/bug25425_squashed2'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/bridges.c10
-rw-r--r--src/or/bridges.h13
-rw-r--r--src/or/transports.c6
-rw-r--r--src/or/transports.h5
4 files changed, 25 insertions, 9 deletions
diff --git a/src/or/bridges.c b/src/or/bridges.c
index 29d00f37ba..699e030e6c 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -11,6 +11,8 @@
* Bridges are fixed entry nodes, used for censorship circumvention.
**/
+#define TOR_BRIDGES_PRIVATE
+
#include "or.h"
#include "bridges.h"
#include "circuitbuild.h"
@@ -93,7 +95,7 @@ sweep_bridge_list(void)
}
/** Initialize the bridge list to empty, creating it if needed. */
-static void
+STATIC void
clear_bridge_list(void)
{
if (!bridge_list)
@@ -156,7 +158,7 @@ bridge_get_addr_port(const bridge_info_t *bridge)
* bridge with no known digest whose address matches any of the
* tor_addr_port_t's in <b>orports</b>, return that bridge. Else return
* NULL. */
-static bridge_info_t *
+STATIC bridge_info_t *
get_configured_bridge_by_orports_digest(const char *digest,
const smartlist_t *orports)
{
@@ -350,7 +352,7 @@ bridge_has_digest(const bridge_info_t *bridge, const char *digest)
* existing bridge with the same address and port, and warn the user as
* appropriate.
*/
-static void
+STATIC void
bridge_resolve_conflicts(const tor_addr_t *addr, uint16_t port,
const char *digest, const char *transport_name)
{
@@ -471,7 +473,7 @@ bridge_add_from_config(bridge_line_t *bridge_line)
}
/** If <b>digest</b> is one of our known bridges, return it. */
-bridge_info_t *
+STATIC bridge_info_t *
find_bridge_by_digest(const char *digest)
{
if (! bridge_list)
diff --git a/src/or/bridges.h b/src/or/bridges.h
index 54a6250259..3108eb555d 100644
--- a/src/or/bridges.h
+++ b/src/or/bridges.h
@@ -20,7 +20,6 @@ typedef struct bridge_info_t bridge_info_t;
void mark_bridge_list(void);
void sweep_bridge_list(void);
const smartlist_t *bridge_list_get(void);
-bridge_info_t *find_bridge_by_digest(const char *digest);
const uint8_t *bridge_get_rsa_id_digest(const bridge_info_t *bridge);
const tor_addr_port_t * bridge_get_addr_port(const bridge_info_t *bridge);
bridge_info_t *get_configured_bridge_by_addr_port_digest(
@@ -65,5 +64,17 @@ MOCK_DECL(download_status_t *, get_bridge_dl_status_by_id,
void bridges_free_all(void);
+#ifdef TOR_BRIDGES_PRIVATE
+STATIC void clear_bridge_list(void);
+STATIC bridge_info_t *find_bridge_by_digest(const char *digest);
+STATIC bridge_info_t *get_configured_bridge_by_orports_digest(
+ const char *digest,
+ const smartlist_t *orports);
+STATIC void bridge_resolve_conflicts(const tor_addr_t *addr,
+ uint16_t port,
+ const char *digest,
+ const char *transport_name);
+#endif /* defined(TOR_BRIDGES_PRIVATE) */
+
#endif /* !defined(TOR_BRIDGES_H) */
diff --git a/src/or/transports.c b/src/or/transports.c
index 5cbf1ddbc1..614fc81da8 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -135,7 +135,7 @@ static smartlist_t *transport_list = NULL;
/** Returns a transport_t struct for a transport proxy supporting the
protocol <b>name</b> listening at <b>addr</b>:<b>port</b> using
SOCKS version <b>socks_ver</b>. */
-static transport_t *
+STATIC transport_t *
transport_new(const tor_addr_t *addr, uint16_t port,
const char *name, int socks_ver,
const char *extra_info_args)
@@ -222,8 +222,8 @@ transport_copy(const transport_t *transport)
/** Returns the transport in our transport list that has the name <b>name</b>.
* Else returns NULL. */
-transport_t *
-transport_get_by_name(const char *name)
+MOCK_IMPL(transport_t *,
+transport_get_by_name,(const char *name))
{
tor_assert(name);
diff --git a/src/or/transports.h b/src/or/transports.h
index 1b2786472c..022b926a03 100644
--- a/src/or/transports.h
+++ b/src/or/transports.h
@@ -38,7 +38,7 @@ MOCK_DECL(int, transport_add_from_config,
void transport_free_(transport_t *transport);
#define transport_free(tr) FREE_AND_NULL(transport_t, transport_free_, (tr))
-transport_t *transport_get_by_name(const char *name);
+MOCK_DECL(transport_t*, transport_get_by_name, (const char *name));
MOCK_DECL(void, pt_kickstart_proxy,
(const smartlist_t *transport_list, char **proxy_argv,
@@ -113,6 +113,9 @@ typedef struct {
smartlist_t *transports;
} managed_proxy_t;
+STATIC transport_t *transport_new(const tor_addr_t *addr, uint16_t port,
+ const char *name, int socks_ver,
+ const char *extra_info_args);
STATIC int parse_cmethod_line(const char *line, managed_proxy_t *mp);
STATIC int parse_smethod_line(const char *line, managed_proxy_t *mp);