commit bda1dfb9e0a863ae1ec1230c23ed74837be01a35 Merge: acb7a536c a4797a7e6 Author: Nick Mathewson nickm@torproject.org Date: Thu Feb 15 20:35:30 2018 -0500
Merge remote-tracking branch 'isis/bug25185'
src/rust/protover/ffi.rs | 34 +--------- src/rust/protover/lib.rs | 1 + src/rust/protover/protover.rs | 95 ++++++++++++++------------ src/rust/tor_util/strings.rs | 154 +++++++++++++++++++++++++++++------------- 4 files changed, 161 insertions(+), 123 deletions(-)
diff --cc src/rust/protover/protover.rs index e5dc69b9a,e9fcdddd9..03776411c --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@@ -9,10 -10,7 +10,8 @@@ use std::fmt use std::collections::{HashMap, HashSet}; use std::ops::Range; use std::string::String; +use std::u32;
- use tor_util::strings::NUL_BYTE; - /// The first version of Tor that included "proto" entries in its descriptors. /// Authorities should use this to decide whether to guess proto lines. /// @@@ -24,32 -22,8 +23,8 @@@ const FIRST_TOR_VERSION_TO_ADVERTISE_PR /// before concluding that someone is trying to DoS us /// /// C_RUST_COUPLED: src/or/protover.c `MAX_PROTOCOLS_TO_EXPAND` -const MAX_PROTOCOLS_TO_EXPAND: u32 = 500; +const MAX_PROTOCOLS_TO_EXPAND: usize = (1<<16);
- /// Currently supported protocols and their versions, as a byte-slice. - /// - /// # Warning - /// - /// This byte-slice ends in a NUL byte. This is so that we can directly convert - /// it to an `&'static CStr` in the FFI code, in order to hand the static string - /// to C in a way that is compatible with C static strings. - /// - /// Rust code which wishes to accesses this string should use - /// `protover::get_supported_protocols()` instead. - /// - /// C_RUST_COUPLED: src/or/protover.c `protover_get_supported_protocols` - pub(crate) const SUPPORTED_PROTOCOLS: &'static [u8] = - b"Cons=1-2 \ - Desc=1-2 \ - DirCache=1-2 \ - HSDir=1-2 \ - HSIntro=3-4 \ - HSRend=1-2 \ - Link=1-5 \ - LinkAuth=1,3 \ - Microdesc=1-2 \ - Relay=1-2\0"; - /// Known subprotocols in Tor. Indicates which subprotocol a relay supports. /// /// C_RUST_COUPLED: src/or/protover.h `protocol_type_t`
tor-commits@lists.torproject.org