diff options
Diffstat (limited to 'src/rust')
-rw-r--r-- | src/rust/.cargo/config.in | 5 | ||||
-rw-r--r-- | src/rust/build.rs | 17 | ||||
-rw-r--r-- | src/rust/external/external.rs | 2 | ||||
-rw-r--r-- | src/rust/protover/ffi.rs | 4 | ||||
-rw-r--r-- | src/rust/protover/protover.rs | 12 | ||||
-rw-r--r-- | src/rust/tor_log/tor_log.rs | 2 | ||||
-rw-r--r-- | src/rust/tor_rust/include.am | 12 |
7 files changed, 33 insertions, 21 deletions
diff --git a/src/rust/.cargo/config.in b/src/rust/.cargo/config.in index 70481bbcbe..6eddc75459 100644 --- a/src/rust/.cargo/config.in +++ b/src/rust/.cargo/config.in @@ -7,5 +7,6 @@ @RUST_DL@ [source.vendored-sources] @RUST_DL@ directory = '@TOR_RUST_DEPENDENCIES@' -@RUST_WARN@ [build] -@RUST_WARN@ rustflags = [ "-D", "warnings" ]
\ No newline at end of file +[build] +@RUST_WARN@ rustflags = [ "-D", "warnings" ] +@RUST_TARGET_PROP@ diff --git a/src/rust/build.rs b/src/rust/build.rs index 8b0ea8ed65..2cf85b404a 100644 --- a/src/rust/build.rs +++ b/src/rust/build.rs @@ -139,7 +139,6 @@ pub fn main() { cfg.from_cflags("TOR_LDFLAGS_libevent"); cfg.link_relpath("src/lib"); - cfg.link_relpath("src/common"); cfg.link_relpath("src/ext/keccak-tiny"); cfg.link_relpath("src/ext/ed25519/ref10"); cfg.link_relpath("src/ext/ed25519/donna"); @@ -150,9 +149,21 @@ pub fn main() { // tor uses. We must be careful with factoring and dependencies // moving forward! cfg.component("tor-crypt-ops-testing"); - cfg.component("or-testing"); + cfg.component("tor-sandbox"); + cfg.component("tor-encoding-testing"); + cfg.component("tor-net"); + cfg.component("tor-thread-testing"); + cfg.component("tor-memarea-testing"); + cfg.component("tor-log"); + cfg.component("tor-lock"); + cfg.component("tor-fdio"); + cfg.component("tor-container-testing"); + cfg.component("tor-smartlist-core-testing"); + cfg.component("tor-string-testing"); + cfg.component("tor-malloc"); + cfg.component("tor-wallclock"); cfg.component("tor-err-testing"); - cfg.component("or-event-testing"); + cfg.component("tor-intmath-testing"); cfg.component("tor-ctime-testing"); cfg.component("curve25519_donna"); cfg.component("keccak-tiny"); diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs index 66317f2128..059fdd0df7 100644 --- a/src/rust/external/external.rs +++ b/src/rust/external/external.rs @@ -11,7 +11,7 @@ extern "C" { ) -> c_int; } -/// Wrap calls to tor_version_as_new_as, defined in src/or/routerparse.c +/// Wrap calls to tor_version_as_new_as, defined in routerparse.c pub fn c_tor_version_as_new_as(platform: &str, cutoff: &str) -> bool { // CHK: These functions should log a warning if an error occurs. This // can be added when integration with tor's logger is added to rust diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs index 034f16e221..91bd83addf 100644 --- a/src/rust/protover/ffi.rs +++ b/src/rust/protover/ffi.rs @@ -3,7 +3,7 @@ //! FFI functions, only to be called from C. //! -//! Equivalent C versions of this api are in `src/or/protover.c` +//! Equivalent C versions of this api are in `protover.c` use libc::{c_char, c_int, uint32_t}; use std::ffi::CStr; @@ -18,7 +18,7 @@ use protover::*; /// Translate C enums to Rust Proto enums, using the integer value of the C /// enum to map to its associated Rust enum. /// -/// C_RUST_COUPLED: src/or/protover.h `protocol_type_t` +/// C_RUST_COUPLED: protover.h `protocol_type_t` fn translate_to_rust(c_proto: uint32_t) -> Result<Protocol, ProtoverError> { match c_proto { 0 => Ok(Protocol::Link), diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs index f50419ed19..299e433722 100644 --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@ -19,13 +19,13 @@ use protoset::ProtoSet; /// Authorities should use this to decide whether to guess proto lines. /// /// C_RUST_COUPLED: -/// src/or/protover.h `FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS` +/// protover.h `FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS` const FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS: &'static str = "0.2.9.3-alpha"; /// The maximum number of subprotocol version numbers we will attempt to expand /// before concluding that someone is trying to DoS us /// -/// C_RUST_COUPLED: src/or/protover.c `MAX_PROTOCOLS_TO_EXPAND` +/// C_RUST_COUPLED: protover.c `MAX_PROTOCOLS_TO_EXPAND` const MAX_PROTOCOLS_TO_EXPAND: usize = (1<<16); /// The maximum size an `UnknownProtocol`'s name may be. @@ -33,7 +33,7 @@ pub(crate) const MAX_PROTOCOL_NAME_LENGTH: usize = 100; /// Known subprotocols in Tor. Indicates which subprotocol a relay supports. /// -/// C_RUST_COUPLED: src/or/protover.h `protocol_type_t` +/// C_RUST_COUPLED: protover.h `protocol_type_t` #[derive(Clone, Hash, Eq, PartialEq, Debug)] pub enum Protocol { Cons, @@ -57,7 +57,7 @@ impl fmt::Display for Protocol { /// Translates a string representation of a protocol into a Proto type. /// Error if the string is an unrecognized protocol name. /// -/// C_RUST_COUPLED: src/or/protover.c `PROTOCOL_NAMES` +/// C_RUST_COUPLED: protover.c `PROTOCOL_NAMES` impl FromStr for Protocol { type Err = ProtoverError; @@ -130,7 +130,7 @@ impl From<Protocol> for UnknownProtocol { /// Rust code can use the `&'static CStr` as a normal `&'a str` by /// calling `protover::get_supported_protocols`. /// -// C_RUST_COUPLED: src/or/protover.c `protover_get_supported_protocols` +// C_RUST_COUPLED: protover.c `protover_get_supported_protocols` pub(crate) fn get_supported_protocols_cstr() -> &'static CStr { cstr!("Cons=1-2 \ Desc=1-2 \ @@ -601,7 +601,7 @@ impl ProtoverVote { /// let vote = ProtoverVote::compute(protos, &2); /// assert_eq!("Link=3", vote.to_string()); /// ``` - // C_RUST_COUPLED: /src/or/protover.c protover_compute_vote + // C_RUST_COUPLED: protover.c protover_compute_vote pub fn compute(proto_entries: &[UnvalidatedProtoEntry], threshold: &usize) -> UnvalidatedProtoEntry { let mut all_count: ProtoverVote = ProtoverVote::default(); let mut final_output: UnvalidatedProtoEntry = UnvalidatedProtoEntry::default(); diff --git a/src/rust/tor_log/tor_log.rs b/src/rust/tor_log/tor_log.rs index 963c68afa8..49a1e7b158 100644 --- a/src/rust/tor_log/tor_log.rs +++ b/src/rust/tor_log/tor_log.rs @@ -129,7 +129,7 @@ pub mod log { } /// The main entry point into Tor's logger. When in non-test mode, this - /// will link directly with `tor_log_string` in /src/or/log.c + /// will link directly with `tor_log_string` in torlog.c extern "C" { pub fn tor_log_string( severity: c_int, diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am index c02324cb77..ecc821a887 100644 --- a/src/rust/tor_rust/include.am +++ b/src/rust/tor_rust/include.am @@ -4,25 +4,25 @@ EXTRA_DIST +=\ EXTRA_CARGO_OPTIONS= -src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE +@TOR_RUST_LIB_PATH@: FORCE ( cd "$(abs_top_builddir)/src/rust" ; \ CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \ CARGO_HOME="$(abs_top_builddir)/src/rust" \ $(CARGO) build --release $(EXTRA_CARGO_OPTIONS) \ - $(CARGO_ONLINE) \ - --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" ) + $(CARGO_ONLINE) \ + --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" ) distclean-rust: ( cd "$(abs_top_builddir)/src/rust" ; \ CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \ CARGO_HOME="$(abs_top_builddir)/src/rust" \ $(CARGO) clean $(EXTRA_CARGO_OPTIONS) \ - $(CARGO_ONLINE) \ - --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" ) + $(CARGO_ONLINE) \ + --manifest-path "$(abs_top_srcdir)/src/rust/tor_rust/Cargo.toml" ) rm -rf "$(abs_top_builddir)/src/rust/registry" if USE_RUST -build-rust: src/rust/target/release/@TOR_RUST_STATIC_NAME@ +build-rust: @TOR_RUST_LIB_PATH@ else build-rust: endif |