mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'protover-rust-impl_squashed'
This commit is contained in:
@@ -78,6 +78,7 @@ LIBTOR_A_SOURCES = \
|
||||
src/or/parsecommon.c \
|
||||
src/or/periodic.c \
|
||||
src/or/protover.c \
|
||||
src/or/protover_rust.c \
|
||||
src/or/proto_cell.c \
|
||||
src/or/proto_control0.c \
|
||||
src/or/proto_ext_or.c \
|
||||
|
||||
+10
-8
@@ -60,7 +60,6 @@
|
||||
#include "circuitlist.h"
|
||||
#include "circuituse.h"
|
||||
#include "command.h"
|
||||
#include "compat_rust.h"
|
||||
#include "compress.h"
|
||||
#include "config.h"
|
||||
#include "confparse.h"
|
||||
@@ -128,6 +127,10 @@
|
||||
|
||||
void evdns_shutdown(int);
|
||||
|
||||
// helper function defined in Rust to output a log message indicating if tor is
|
||||
// running with Rust enabled. See src/rust/tor_util
|
||||
char *rust_welcome_string(void);
|
||||
|
||||
/********* PROTOTYPES **********/
|
||||
|
||||
static void dumpmemusage(int severity);
|
||||
@@ -3111,14 +3114,13 @@ tor_init(int argc, char *argv[])
|
||||
"Expect more bugs than usual.");
|
||||
}
|
||||
|
||||
{
|
||||
rust_str_t rust_str = rust_welcome_string();
|
||||
const char *s = rust_str_get(rust_str);
|
||||
if (strlen(s) > 0) {
|
||||
log_notice(LD_GENERAL, "%s", s);
|
||||
}
|
||||
rust_str_free(rust_str);
|
||||
#ifdef HAVE_RUST
|
||||
char *rust_str = rust_welcome_string();
|
||||
if (rust_str != NULL && strlen(rust_str) > 0) {
|
||||
log_notice(LD_GENERAL, "%s", rust_str);
|
||||
}
|
||||
tor_free(rust_str);
|
||||
#endif
|
||||
|
||||
if (network_init()<0) {
|
||||
log_err(LD_BUG,"Error initializing network; exiting.");
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "protover.h"
|
||||
#include "routerparse.h"
|
||||
|
||||
#ifndef HAVE_RUST
|
||||
|
||||
static const smartlist_t *get_supported_protocol_list(void);
|
||||
static int protocol_list_contains(const smartlist_t *protos,
|
||||
protocol_type_t pr, uint32_t ver);
|
||||
@@ -735,3 +737,5 @@ protover_free_all(void)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+5
-1
@@ -70,11 +70,15 @@ typedef struct proto_entry_t {
|
||||
smartlist_t *ranges;
|
||||
} proto_entry_t;
|
||||
|
||||
#if !defined(HAVE_RUST) && defined(TOR_UNIT_TESTS)
|
||||
STATIC smartlist_t *parse_protocol_list(const char *s);
|
||||
STATIC void proto_entry_free(proto_entry_t *entry);
|
||||
STATIC char *encode_protocol_list(const smartlist_t *sl);
|
||||
STATIC const char *protocol_type_to_str(protocol_type_t pr);
|
||||
STATIC int str_to_protocol_type(const char *s, protocol_type_t *pr_out);
|
||||
STATIC void proto_entry_free(proto_entry_t *entry);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* defined(PROTOVER_PRIVATE) */
|
||||
|
||||
#endif /* !defined(TOR_PROTOVER_H) */
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/* Copyright (c) 2016-2017, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/*
|
||||
* \file protover_rust.c
|
||||
* \brief Provide a C wrapper for functions exposed in /src/rust/protover,
|
||||
* and safe translation/handling between the Rust/C boundary.
|
||||
*/
|
||||
|
||||
#include "or.h"
|
||||
#include "protover.h"
|
||||
|
||||
#ifdef HAVE_RUST
|
||||
|
||||
/* Define for compatibility, used in main.c */
|
||||
void protover_free_all(void) {};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user