aboutsummaryrefslogtreecommitdiff
path: root/src/rust/external/external.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rust/external/external.rs')
-rw-r--r--src/rust/external/external.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs
index b9e17f021d..d342fe096e 100644
--- a/src/rust/external/external.rs
+++ b/src/rust/external/external.rs
@@ -1,17 +1,14 @@
-// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// Copyright (c) 2016-2018, The Tor Project, Inc. */
// See LICENSE for licensing information */
use libc::{c_char, c_int};
use std::ffi::CString;
extern "C" {
- fn tor_version_as_new_as(
- platform: *const c_char,
- cutoff: *const c_char,
- ) -> c_int;
+ fn tor_version_as_new_as(platform: *const c_char, cutoff: *const c_char) -> 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
@@ -25,9 +22,17 @@ pub fn c_tor_version_as_new_as(platform: &str, cutoff: &str) -> bool {
Err(_) => return false,
};
- let result: c_int = unsafe {
- tor_version_as_new_as(c_platform.as_ptr(), c_cutoff.as_ptr())
- };
+ let result: c_int = unsafe { tor_version_as_new_as(c_platform.as_ptr(), c_cutoff.as_ptr()) };
result == 1
}
+
+extern "C" {
+ fn tor_is_using_nss() -> c_int;
+}
+
+/// Return true if Tor was built to use NSS.
+pub fn c_tor_is_using_nss() -> bool
+{
+ 0 != unsafe { tor_is_using_nss() }
+}