diff --git a/Cargo.lock b/Cargo.lock index fa1381a3f..552df45f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1449,11 +1449,45 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "opcua" +version = "0.10.0" +dependencies = [ + "actix-web", + "base64 0.12.3", + "bitflags", + "byteorder", + "bytes 1.1.0", + "chrono", + "derivative", + "env_logger", + "foreign-types", + "futures 0.3.19", + "gethostname", + "lazy_static", + "libc", + "log 0.4.14", + "openssl", + "openssl-sys", + "regex", + "rustc-serialize", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tempdir", + "time", + "tokio 1.15.0", + "tokio-util", + "url", + "uuid 0.8.2", +] + [[package]] name = "opcua-certificate-creator" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "pico-args", ] @@ -1461,7 +1495,7 @@ dependencies = [ name = "opcua-chess-server" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "uci", ] @@ -1473,7 +1507,7 @@ dependencies = [ "lazy_static", "log 0.4.14", "log4rs", - "opcua-rs", + "opcua", "pico-args", "rand 0.7.3", ] @@ -1482,7 +1516,7 @@ dependencies = [ name = "opcua-discovery-client" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "pico-args", ] @@ -1490,7 +1524,7 @@ dependencies = [ name = "opcua-event-client" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "pico-args", ] @@ -1500,7 +1534,7 @@ version = "0.10.0" dependencies = [ "chrono", "log 0.4.14", - "opcua-rs", + "opcua", ] [[package]] @@ -1508,7 +1542,7 @@ name = "opcua-modbus-server" version = "0.10.0" dependencies = [ "futures 0.1.31", - "opcua-rs", + "opcua", "pico-args", "serde", "serde_derive", @@ -1524,49 +1558,16 @@ dependencies = [ name = "opcua-mqtt-client" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "pico-args", "rumqtt", ] -[[package]] -name = "opcua-rs" -version = "0.10.0" -dependencies = [ - "actix-web", - "base64 0.12.3", - "bitflags", - "byteorder", - "bytes 1.1.0", - "chrono", - "derivative", - "env_logger", - "foreign-types", - "futures 0.3.19", - "gethostname", - "lazy_static", - "libc", - "log 0.4.14", - "openssl", - "openssl-sys", - "regex", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tempdir", - "time", - "tokio 1.15.0", - "tokio-util", - "url", - "uuid 0.8.2", -] - [[package]] name = "opcua-simple-client" version = "0.10.0" dependencies = [ - "opcua-rs", + "opcua", "pico-args", ] @@ -1576,7 +1577,7 @@ version = "0.10.0" dependencies = [ "chrono", "log 0.4.14", - "opcua-rs", + "opcua", ] [[package]] @@ -1585,7 +1586,7 @@ version = "0.10.0" dependencies = [ "actix", "actix-web", - "opcua-rs", + "opcua", "pico-args", "serde", "serde_derive", @@ -2162,6 +2163,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" + [[package]] name = "rustc_version" version = "0.2.3" diff --git a/integration/Cargo.toml b/integration/Cargo.toml index 719615257..5714f1156 100644 --- a/integration/Cargo.toml +++ b/integration/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" log = "0.4" chrono = "0.4" -[dev-dependencies.opcua-rs] +[dev-dependencies.opcua] path = "../lib" version = "0.10.0" # OPCUARustVersion features = ["all"] diff --git a/integration/src/harness.rs b/integration/src/harness.rs index 6b3a0c6bb..c359b6c1b 100644 --- a/integration/src/harness.rs +++ b/integration/src/harness.rs @@ -12,12 +12,13 @@ use std::{ use chrono::Utc; use log::*; -use crate::client::prelude::*; -use crate::console_logging; -use crate::core::{self, runtime_components}; -use crate::server::{ - self, builder::ServerBuilder, callbacks, config::ServerEndpoint, prelude::*, - session::SessionManager, +use opcua::{ + client::prelude::*, + runtime_components, + server::{ + builder::ServerBuilder, callbacks, config::ServerEndpoint, prelude::*, + session::SessionManager, + }, }; use crate::*; @@ -45,7 +46,7 @@ fn next_port_offset() -> u16 { pub fn hostname() -> String { // To avoid certificate trouble, use the computer's own name for the endpoint - let mut names = opcua_crypto::X509Data::computer_hostnames(); + let mut names = opcua::crypto::X509Data::computer_hostnames(); if names.is_empty() { "localhost".to_string() } else { @@ -105,7 +106,7 @@ pub fn new_server(port: u16) -> Server { // Create user tokens - anonymous and a sample user let user_token_ids = vec![ - opcua_server::prelude::ANONYMOUS_USER_TOKEN_ID, + opcua::server::prelude::ANONYMOUS_USER_TOKEN_ID, sample_user_id, x509_user_id, ]; @@ -380,7 +381,7 @@ pub fn perform_test( CT: FnOnce(mpsc::Receiver, Client) + Send + 'static, ST: FnOnce(mpsc::Receiver, Server) + Send + 'static, { - opcua_console_logging::init(); + opcua::console_logging::init(); // Spawn the CLIENT thread let (client_thread, tx_client_command, rx_client_response) = { @@ -682,7 +683,7 @@ pub fn connect_with_get_endpoints(port: u16) { pub fn connect_with_invalid_token( port: u16, - mut client_endpoint: EndpointDescription, + client_endpoint: EndpointDescription, identity_token: IdentityToken, ) { connect_with_client_test( diff --git a/integration/src/tests.rs b/integration/src/tests.rs index f3afe798a..c86e732e6 100644 --- a/integration/src/tests.rs +++ b/integration/src/tests.rs @@ -6,9 +6,8 @@ use std::{ use chrono::Utc; use log::*; -use crate::client::prelude::*; -use crate::console_logging; -use crate::server::{self, prelude::*}; +use opcua::client::prelude::*; +use opcua::server::prelude::*; use crate::harness::*; @@ -123,7 +122,7 @@ fn endpoint_aes256sha256rsapss_sign_encrypt(port: u16) -> EndpointDescription { #[test] #[ignore] fn server_abort() { - opcua_console_logging::init(); + opcua::console_logging::init(); let server = Arc::new(RwLock::new(new_server(0))); let server2 = server.clone(); @@ -180,7 +179,7 @@ fn hello_timeout() { let client_test = move |_rx_client_command: mpsc::Receiver, _client: Client| { // Client will open a socket, and sit there waiting for the socket to close, which should happen in under the timeout_wait_duration let timeout_wait_duration = std::time::Duration::from_secs( - opcua_server::constants::DEFAULT_HELLO_TIMEOUT_SECONDS as u64 + 3, + opcua::server::constants::DEFAULT_HELLO_TIMEOUT_SECONDS as u64 + 3, ); let host = crate::harness::hostname(); diff --git a/lib/Cargo.toml b/lib/Cargo.toml index fe15eac0c..34ada4ab9 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "opcua-rs" +name = "opcua" version = "0.10.0" # OPCUARustVersion description = "OPC UA client API" authors = ["Adam Lock "] @@ -20,7 +20,7 @@ appveyor = { repository = "locka99/opcua" } [features] default = ["server", "client"] -all = ["server", "client", "console-logging"] +all = ["server", "client", "console-logging", "http"] server = ["generated-address-space", "discovery-server-registration"] client = [] console-logging = ["env_logger"] @@ -62,7 +62,7 @@ libc = "0.2" foreign-types = "0.3" [dependencies.env_logger] -env_logger = "0.5" +version = "0.5" optional = true [dependencies.actix-web] @@ -71,4 +71,5 @@ optional = true [dev-dependencies] tempdir = "0.3" -serde_json = "1.0" \ No newline at end of file +serde_json = "1.0" +rustc-serialize = "0.3.24" diff --git a/lib/src/client/builder.rs b/lib/src/client/builder.rs index b08122064..87a0f5f39 100644 --- a/lib/src/client/builder.rs +++ b/lib/src/client/builder.rs @@ -13,7 +13,7 @@ use crate::core::config::Config; /// # Example /// /// ```no_run -/// use crate::client::prelude::*; +/// use opcua::client::prelude::*; /// /// fn main() { /// let builder = ClientBuilder::new() diff --git a/lib/src/client/mod.rs b/lib/src/client/mod.rs index 22a9a0fb7..9c7028a91 100644 --- a/lib/src/client/mod.rs +++ b/lib/src/client/mod.rs @@ -37,7 +37,7 @@ //! //! ```no_run //! use std::sync::{Arc, RwLock}; -//! use crate::client::prelude::*; +//! use opcua::client::prelude::*; //! //! fn main() { //! let mut client = ClientBuilder::new() diff --git a/lib/src/client/tests/mod.rs b/lib/src/client/tests/mod.rs index 1abaab832..596299810 100644 --- a/lib/src/client/tests/mod.rs +++ b/lib/src/client/tests/mod.rs @@ -4,7 +4,7 @@ use crate::core::config::Config; use crate::crypto::SecurityPolicy; use crate::types::*; -use crate::{ +use crate::client::{ builder::ClientBuilder, config::{ClientConfig, ClientEndpoint, ClientUserToken, ANONYMOUS_USER_TOKEN_ID}, }; diff --git a/lib/src/console-logging/mod.rs b/lib/src/console_logging/mod.rs similarity index 100% rename from lib/src/console-logging/mod.rs rename to lib/src/console_logging/mod.rs diff --git a/lib/src/core/fuzz/Cargo.toml b/lib/src/core/fuzz/Cargo.toml index a3de33c98..2c0f2a542 100644 --- a/lib/src/core/fuzz/Cargo.toml +++ b/lib/src/core/fuzz/Cargo.toml @@ -24,7 +24,7 @@ path = "../../types" path = "../../crypto" [dependencies.opcua-console-logging] -path = "../../console-logging" +path = "../../console_logging" # Prevent this from interfering with workspaces [workspace] diff --git a/lib/src/core/fuzz/fuzz_targets/fuzz_comms.rs b/lib/src/core/fuzz/fuzz_targets/fuzz_comms.rs index 89bfe1adf..0edd70543 100644 --- a/lib/src/core/fuzz/fuzz_targets/fuzz_comms.rs +++ b/lib/src/core/fuzz/fuzz_targets/fuzz_comms.rs @@ -13,7 +13,7 @@ pub fn decode(buf: &mut BytesMut, codec: &mut TcpCodec) -> Result {{ - use crate::core::RUNTIME; + use $crate::core::RUNTIME; RUNTIME.components() }}; } @@ -91,7 +91,7 @@ pub mod debug { } #[cfg(test)] -mod tests; +pub mod tests; pub mod comms; pub mod config; diff --git a/lib/src/core/tests/chunk.rs b/lib/src/core/tests/chunk.rs index 29b1d13ec..2005db5bc 100644 --- a/lib/src/core/tests/chunk.rs +++ b/lib/src/core/tests/chunk.rs @@ -5,7 +5,7 @@ use std::io::{Cursor, Write}; use crate::crypto::{x509::X509, SecurityPolicy}; use crate::types::DecodingOptions; -use crate::{ +use crate::core::{ comms::{chunker::*, message_chunk::*, secure_channel::*, tcp_types::MIN_CHUNK_SIZE}, supported_message::SupportedMessage, tests::*, @@ -475,7 +475,7 @@ fn security_policy_symmetric_encrypt_decrypt() { fn asymmetric_decrypt_and_verify_sample_chunk() { let _ = Test::setup(); - use crate::tests::chunk::serialize::hex::FromHex; + use serialize::hex::FromHex; let their_cert_data = include_bytes!("test_data/their_cert.der"); let their_cert = X509::from_der(&their_cert_data[..]).unwrap(); diff --git a/lib/src/core/tests/comms.rs b/lib/src/core/tests/comms.rs index 4f2b109a0..a36e36cff 100644 --- a/lib/src/core/tests/comms.rs +++ b/lib/src/core/tests/comms.rs @@ -3,7 +3,7 @@ use std::io::*; use crate::crypto::SecurityPolicy; use crate::types::*; -use crate::comms::{secure_channel::*, tcp_types::*}; +use crate::core::comms::{secure_channel::*, tcp_types::*}; fn hello_data() -> Vec { vec![ diff --git a/lib/src/core/tests/hello.rs b/lib/src/core/tests/hello.rs index c4205e11f..32e7af1c0 100644 --- a/lib/src/core/tests/hello.rs +++ b/lib/src/core/tests/hello.rs @@ -4,7 +4,7 @@ use crate::types::{ string::UAString, }; -use crate::comms::tcp_types::{HelloMessage, MessageHeader, MessageType}; +use crate::core::comms::tcp_types::{HelloMessage, MessageHeader, MessageType}; #[test] fn endpoint_url() { diff --git a/lib/src/core/tests/mod.rs b/lib/src/core/tests/mod.rs index 530c7648d..d5c258546 100644 --- a/lib/src/core/tests/mod.rs +++ b/lib/src/core/tests/mod.rs @@ -9,7 +9,7 @@ use crate::crypto::{ }; use crate::types::{status_code::StatusCode, *}; -use crate::{comms::secure_channel::SecureChannel, supported_message::SupportedMessage}; +use crate::core::{comms::secure_channel::SecureChannel, supported_message::SupportedMessage}; pub fn serialize_test_and_return(value: T) -> T where diff --git a/lib/src/core/tests/secure_channel.rs b/lib/src/core/tests/secure_channel.rs index 9429f25ba..4cd740a91 100644 --- a/lib/src/core/tests/secure_channel.rs +++ b/lib/src/core/tests/secure_channel.rs @@ -3,10 +3,10 @@ use crate::crypto::SecurityPolicy; -use crate::comms::chunker::*; -use crate::comms::secure_channel::*; - -use crate::tests::*; +use crate::core::{ + comms::{chunker::*, secure_channel::*}, + tests::*, +}; fn test_symmetric_encrypt_decrypt( message: SupportedMessage, diff --git a/lib/src/core/tests/services.rs b/lib/src/core/tests/services.rs index 19855e1ab..c1bf27e34 100644 --- a/lib/src/core/tests/services.rs +++ b/lib/src/core/tests/services.rs @@ -1,6 +1,4 @@ -use crate::types::*; - -use crate::tests::*; +use crate::core::tests::*; fn request_header() -> RequestHeader { RequestHeader { diff --git a/lib/src/core/tests/supported_message.rs b/lib/src/core/tests/supported_message.rs index 081d1e249..009c6bfad 100644 --- a/lib/src/core/tests/supported_message.rs +++ b/lib/src/core/tests/supported_message.rs @@ -1,4 +1,4 @@ -use crate::supported_message::SupportedMessage; +use crate::core::supported_message::SupportedMessage; #[test] fn size() { diff --git a/lib/src/crypto/tests/authentication.rs b/lib/src/crypto/tests/authentication.rs index 958ab6cf9..7e36432ef 100644 --- a/lib/src/crypto/tests/authentication.rs +++ b/lib/src/crypto/tests/authentication.rs @@ -1,10 +1,8 @@ -use crate::{ +use crate::crypto::{ self as crypto, decrypt_user_identity_token_password, make_user_name_identity_token, random, - SecurityPolicy, + tests::*, SecurityPolicy, }; -use crate::tests::*; - #[test] fn user_name_identity_token_valid() { let mut id = UserNameIdentityToken { @@ -57,7 +55,7 @@ fn user_name_identity_token_encrypted() { let (cert, pkey) = make_test_cert_1024(); let cert = Some(cert); - let mut user_token_policy = opcua_types::service_types::UserTokenPolicy { + let mut user_token_policy = crate::types::service_types::UserTokenPolicy { policy_id: UAString::from("x"), token_type: UserTokenType::UserName, issued_token_type: UAString::null(), diff --git a/lib/src/crypto/tests/crypto.rs b/lib/src/crypto/tests/crypto.rs index 3ca851ccf..d4ea7b48a 100644 --- a/lib/src/crypto/tests/crypto.rs +++ b/lib/src/crypto/tests/crypto.rs @@ -5,11 +5,11 @@ use std::io::Write; use crate::types::status_code::StatusCode; -use crate::tests::{ +use crate::crypto::tests::{ make_certificate_store, make_test_cert_1024, make_test_cert_2048, APPLICATION_HOSTNAME, APPLICATION_URI, }; -use crate::{ +use crate::crypto::{ aeskey::AesKey, certificate_store::*, pkey::{KeySize, PrivateKey, RsaPadding}, @@ -228,7 +228,7 @@ fn test_asymmetric_encrypt_and_decrypt( #[test] fn asymmetric_encrypt_and_decrypt() { - opcua_console_logging::init(); + crate::console_logging::init(); let (cert, key) = make_test_cert_2048(); // Try all security policies, ensure they encrypt / decrypt for various sizes @@ -382,8 +382,8 @@ fn sign_verify_sha256_pss() { #[test] fn sign_hmac_sha1() { - use crate::hash; - use crate::tests::crypto::serialize::hex::FromHex; + use crate::crypto::hash; + use serialize::hex::FromHex; let key = b""; let data = b""; @@ -412,8 +412,8 @@ fn sign_hmac_sha1() { #[test] fn sign_hmac_sha256() { - use crate::hash; - use crate::tests::crypto::serialize::hex::FromHex; + use crate::crypto::hash; + use serialize::hex::FromHex; let key = b""; let data = b""; diff --git a/lib/src/crypto/tests/mod.rs b/lib/src/crypto/tests/mod.rs index 5ddd9330b..f958178bb 100644 --- a/lib/src/crypto/tests/mod.rs +++ b/lib/src/crypto/tests/mod.rs @@ -2,7 +2,7 @@ use tempdir::TempDir; use crate::types::*; -use crate::{ +use crate::crypto::{ certificate_store::*, pkey::PrivateKey, x509::{X509Data, X509}, diff --git a/lib/src/crypto/tests/security_policy.rs b/lib/src/crypto/tests/security_policy.rs index faaf116dd..ee4209519 100644 --- a/lib/src/crypto/tests/security_policy.rs +++ b/lib/src/crypto/tests/security_policy.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use crate::SecurityPolicy; +use crate::crypto::SecurityPolicy; #[test] fn is_deprecated() { diff --git a/lib/src/crypto/x509.rs b/lib/src/crypto/x509.rs index 22e5289bd..6ee263985 100644 --- a/lib/src/crypto/x509.rs +++ b/lib/src/crypto/x509.rs @@ -596,7 +596,7 @@ mod tests { /// This test checks that a cert will validate dns or ip entries in the subject alt host names #[test] fn alt_hostnames() { - opcua_console_logging::init(); + crate::console_logging::init(); let alt_host_names = ["uri:foo", "host2", "www.google.com", "192.168.1.1", "::1"]; diff --git a/lib/src/lib.rs b/lib/src/lib.rs index d4cd63c72..c5f5d511e 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -60,7 +60,7 @@ macro_rules! trace_write_lock { #[cfg(feature = "client")] pub mod client; -#[cfg(feature = "console_logging")] +#[cfg(feature = "console-logging")] pub mod console_logging; pub mod core; pub mod crypto; diff --git a/lib/src/server/events/event.rs b/lib/src/server/events/event.rs index 9d1218d0a..f080895a7 100644 --- a/lib/src/server/events/event.rs +++ b/lib/src/server/events/event.rs @@ -661,10 +661,9 @@ fn test_events_for_object() { #[test] fn test_purge_events() { - use crate::console_logging; use crate::types::Identifier; - opcua_console_logging::init(); + crate::console_logging::init(); let mut address_space = AddressSpace::new(); diff --git a/lib/src/server/http/mod.rs b/lib/src/server/http/mod.rs index 009268b1f..ffbf0cf96 100644 --- a/lib/src/server/http/mod.rs +++ b/lib/src/server/http/mod.rs @@ -12,7 +12,7 @@ use actix_web::{actix, fs, http, server, App, HttpRequest, HttpResponse, Respond use tokio::time::{interval_at, Duration, Instant}; -use crate::{metrics::ServerMetrics, server::Connections, state::ServerState}; +use crate::server::{metrics::ServerMetrics, server::Connections, state::ServerState}; /// This is our metrics service, the thing called to handle requests coming from hyper #[derive(Clone)] diff --git a/lib/src/server/mod.rs b/lib/src/server/mod.rs index f0bafc4a8..bbe5618cf 100644 --- a/lib/src/server/mod.rs +++ b/lib/src/server/mod.rs @@ -19,7 +19,7 @@ //! This is a very simple server which runs with the default address space on the default port. //! //! ```no_run -//! use crate::server::prelude::*; +//! use opcua::server::prelude::*; //! //! fn main() { //! let server: Server = ServerBuilder::new_sample().server().unwrap(); diff --git a/lib/src/server/tests/address_space.rs b/lib/src/server/tests/address_space.rs index 86e316404..50e46913b 100644 --- a/lib/src/server/tests/address_space.rs +++ b/lib/src/server/tests/address_space.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use crate::{ +use crate::server::{ address_space::{ references::Reference, relative_path::{find_node_from_browse_path, find_nodes_relative_path_simple}, @@ -746,7 +746,7 @@ impl callbacks::Method for HelloWorld { #[test] fn simple_delete_node() { - opcua_console_logging::init(); + crate::console_logging::init(); // This is a super basic, debuggable delete test. There is a single Root node, and a // child object. After deleting the child, only the Root should exist with no references at @@ -783,7 +783,7 @@ fn simple_delete_node() { #[test] fn delete_node() { - opcua_console_logging::init(); + crate::console_logging::init(); // Try creating and deleting a node, verifying that it's totally gone afterwards (0..2).for_each(|i| { diff --git a/lib/src/server/tests/events.rs b/lib/src/server/tests/events.rs index e52b71033..c203b1865 100644 --- a/lib/src/server/tests/events.rs +++ b/lib/src/server/tests/events.rs @@ -8,7 +8,7 @@ use crate::types::{ UAString, VariableTypeId, Variant, }; -use crate::{ +use crate::server::{ address_space::{object_type::ObjectTypeBuilder, variable::VariableBuilder, AddressSpace}, events::event::{BaseEventType, Event}, events::event_filter, @@ -148,7 +148,8 @@ fn do_operator_test(f: T) where T: FnOnce(&AddressSpace, &NodeId, &mut HashSet, &Vec), { - opcua_console_logging::init(); + crate::console_logging::init(); + let mut used_elements = HashSet::new(); let elements = vec![]; let address_space = address_space(); diff --git a/lib/src/server/tests/mod.rs b/lib/src/server/tests/mod.rs index addbe60bc..890425b35 100644 --- a/lib/src/server/tests/mod.rs +++ b/lib/src/server/tests/mod.rs @@ -7,10 +7,9 @@ use chrono; use time; use crate::core::{config::Config, supported_message::SupportedMessage}; -use crate::crypto::*; use crate::types::{status_code::StatusCode, *}; -use crate::{ +use crate::server::{ address_space::{address_space::*, variable::*}, builder::ServerBuilder, config::ServerConfig, diff --git a/lib/src/server/tests/services/attribute.rs b/lib/src/server/tests/services/attribute.rs index 034eb273b..5a42b0d32 100644 --- a/lib/src/server/tests/services/attribute.rs +++ b/lib/src/server/tests/services/attribute.rs @@ -1,9 +1,9 @@ use chrono::Duration; +use crate::server::{address_space::AccessLevel, services::attribute::AttributeService}; +use crate::supported_message_as; use crate::types::{Variant, WriteMask}; -use crate::{address_space::AccessLevel, services::attribute::AttributeService}; - use super::*; fn read_value(node_id: &NodeId, attribute_id: AttributeId) -> ReadValueId { diff --git a/lib/src/server/tests/services/discovery.rs b/lib/src/server/tests/services/discovery.rs index eab8ec43b..ee3cd36b6 100644 --- a/lib/src/server/tests/services/discovery.rs +++ b/lib/src/server/tests/services/discovery.rs @@ -1,7 +1,7 @@ +use crate::server::services::discovery::DiscoveryService; +use crate::supported_message_as; use crate::types::UAString; -use crate::services::discovery::DiscoveryService; - use super::*; fn do_discovery_service_test(f: F) diff --git a/lib/src/server/tests/services/method.rs b/lib/src/server/tests/services/method.rs index 9b3827a91..3993a9b5b 100644 --- a/lib/src/server/tests/services/method.rs +++ b/lib/src/server/tests/services/method.rs @@ -1,10 +1,11 @@ +use crate::supported_message_as; use crate::types::{ node_ids::{MethodId, ObjectId}, service_types::{CallMethodRequest, CallMethodResult, CallRequest, CallResponse}, status_code::StatusCode, }; -use crate::services::{ +use crate::server::services::{ method::MethodService, monitored_item::MonitoredItemService, subscription::SubscriptionService, }; diff --git a/lib/src/server/tests/services/mod.rs b/lib/src/server/tests/services/mod.rs index adbe6b543..509e97fab 100644 --- a/lib/src/server/tests/services/mod.rs +++ b/lib/src/server/tests/services/mod.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use crate::{ +use crate::server::{ prelude::*, services::{monitored_item::MonitoredItemService, subscription::SubscriptionService}, session::Session, diff --git a/lib/src/server/tests/services/monitored_item.rs b/lib/src/server/tests/services/monitored_item.rs index b759fcfba..4ec41e7d4 100644 --- a/lib/src/server/tests/services/monitored_item.rs +++ b/lib/src/server/tests/services/monitored_item.rs @@ -4,13 +4,14 @@ use std::ops::Add; use chrono::{self, Utc}; use super::*; -use crate::{ +use crate::server::{ services::{monitored_item::MonitoredItemService, subscription::SubscriptionService}, subscriptions::{ monitored_item::*, subscription::{SubscriptionState, TickReason}, }, }; +use crate::supported_message_as; fn test_var_node_id() -> NodeId { NodeId::new(1, 1) diff --git a/lib/src/server/tests/services/node_management.rs b/lib/src/server/tests/services/node_management.rs index 0ddbfbf51..e95ff301a 100644 --- a/lib/src/server/tests/services/node_management.rs +++ b/lib/src/server/tests/services/node_management.rs @@ -1,7 +1,7 @@ +use crate::server::services::node_management::NodeManagementService; +use crate::supported_message_as; use crate::types::node_ids::{DataTypeId, MethodId, ObjectId, ObjectTypeId, ReferenceTypeId}; -use crate::services::node_management::NodeManagementService; - use super::*; /// A helper that sets up a subscription service test @@ -14,7 +14,7 @@ where NodeManagementService, ), { - opcua_console_logging::init(); + crate::console_logging::init(); let st = ServiceTest::new(); diff --git a/lib/src/server/tests/services/session.rs b/lib/src/server/tests/services/session.rs index da71e3c2e..8792ab2c6 100644 --- a/lib/src/server/tests/services/session.rs +++ b/lib/src/server/tests/services/session.rs @@ -1,7 +1,7 @@ use crate::crypto::{random, user_identity::make_user_name_identity_token, SecurityPolicy}; use crate::types::{ActivateSessionRequest, RequestHeader, SignatureData}; -use crate::{ +use crate::server::{ builder::ServerBuilder, identity_token::{ POLICY_ID_USER_PASS_NONE, POLICY_ID_USER_PASS_RSA_15, POLICY_ID_USER_PASS_RSA_OAEP, @@ -35,7 +35,7 @@ fn do_session_service_test(pki_dir: Option<&str>, f: T) where T: FnOnce(Arc>, SessionService), { - opcua_console_logging::init(); + crate::console_logging::init(); let mut server_builder = ServerBuilder::new_sample(); if let Some(pki_dir) = pki_dir { @@ -107,7 +107,7 @@ fn make_encrypted_user_name_identity_token( user: &str, pass: &str, ) -> ExtensionObject { - let user_token_policy = opcua_types::service_types::UserTokenPolicy { + let user_token_policy = crate::types::service_types::UserTokenPolicy { policy_id: UAString::from(policy_id), token_type: UserTokenType::UserName, issued_token_type: UAString::null(), diff --git a/lib/src/server/tests/services/subscription.rs b/lib/src/server/tests/services/subscription.rs index 12b499a4a..7c3b33302 100644 --- a/lib/src/server/tests/services/subscription.rs +++ b/lib/src/server/tests/services/subscription.rs @@ -2,12 +2,13 @@ use std::ops::Add; use chrono::Utc; -use crate::{ +use crate::server::{ prelude::*, services::{monitored_item::MonitoredItemService, subscription::SubscriptionService}, state::ServerState, subscriptions::subscription::*, }; +use crate::supported_message_as; use super::*; @@ -101,7 +102,7 @@ fn keepalive_test( #[test] fn test_revised_keep_alive_lifetime_counts() { // Test that the keep alive and lifetime counts are correctly revised from their inputs - use crate::constants::{DEFAULT_KEEP_ALIVE_COUNT, MAX_KEEP_ALIVE_COUNT}; + use crate::server::constants::{DEFAULT_KEEP_ALIVE_COUNT, MAX_KEEP_ALIVE_COUNT}; const MAX_LIFETIME_COUNT: u32 = 3 * MAX_KEEP_ALIVE_COUNT; const DEFAULT_LIFETIME_COUNT: u32 = 3 * DEFAULT_KEEP_ALIVE_COUNT; diff --git a/lib/src/server/tests/services/view.rs b/lib/src/server/tests/services/view.rs index 430f20a79..b761f70b4 100644 --- a/lib/src/server/tests/services/view.rs +++ b/lib/src/server/tests/services/view.rs @@ -1,8 +1,7 @@ use std::sync::Weak; -use crate::console_logging; - -use crate::services::view::ViewService; +use crate::server::services::view::ViewService; +use crate::supported_message_as; use super::*; @@ -79,7 +78,7 @@ where &ViewService, ), { - opcua_console_logging::init(); + crate::console_logging::init(); let st = ServiceTest::new(); f( st.server_state.clone(), @@ -284,7 +283,7 @@ fn verify_references( #[test] fn browse_inverse() { - opcua_console_logging::init(); + crate::console_logging::init(); do_view_service_test(|server_state, session, address_space, vs| { // Ask for Inverse refs only @@ -431,7 +430,7 @@ fn browse_inverse() { #[test] fn browse_both() { - opcua_console_logging::init(); + crate::console_logging::init(); do_view_service_test(|server_state, session, address_space, vs| { // Ask for both forward and inverse refs diff --git a/lib/src/server/tests/subscriptions/subscription.rs b/lib/src/server/tests/subscriptions/subscription.rs index c92a5767a..77e234d72 100644 --- a/lib/src/server/tests/subscriptions/subscription.rs +++ b/lib/src/server/tests/subscriptions/subscription.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use crate::{ +use crate::server::{ diagnostics::ServerDiagnostics, subscriptions::subscription::{ HandledState, Subscription, SubscriptionState, SubscriptionStateParams, TickReason, diff --git a/lib/src/types/fuzz/Cargo.toml b/lib/src/types/fuzz/Cargo.toml index e436b42eb..c6359f8f6 100644 --- a/lib/src/types/fuzz/Cargo.toml +++ b/lib/src/types/fuzz/Cargo.toml @@ -15,7 +15,7 @@ libfuzzer-sys = "0.4" path = ".." [dependencies.opcua-console-logging] -path = "../../console-logging" +path = "../../console_logging" # Prevent this from interfering with workspaces [workspace] diff --git a/lib/src/types/fuzz/fuzz_targets/fuzz_deserialize.rs b/lib/src/types/fuzz/fuzz_targets/fuzz_deserialize.rs index 9b0d4a4aa..2aac12572 100644 --- a/lib/src/types/fuzz/fuzz_targets/fuzz_deserialize.rs +++ b/lib/src/types/fuzz/fuzz_targets/fuzz_deserialize.rs @@ -11,7 +11,7 @@ pub fn deserialize(data: &[u8], decoding_options: &DecodingOptions) -> Result(value: T) -> T where diff --git a/lib/src/types/tests/node_id.rs b/lib/src/types/tests/node_id.rs index ee01ead88..eb5b9d5f5 100644 --- a/lib/src/types/tests/node_id.rs +++ b/lib/src/types/tests/node_id.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use crate::*; +use crate::types::*; #[test] fn parse_invalid_node_id() { diff --git a/lib/src/types/tests/serde.rs b/lib/src/types/tests/serde.rs index b01474e90..a94447f79 100644 --- a/lib/src/types/tests/serde.rs +++ b/lib/src/types/tests/serde.rs @@ -1,8 +1,7 @@ -use crate::data_value::DataValue; -use crate::date_time::DateTime; -use crate::guid::Guid; -use crate::status_codes::StatusCode; -use crate::variant::Variant; +use crate::types::{ + data_value::DataValue, date_time::DateTime, guid::Guid, status_codes::StatusCode, + variant::Variant, +}; #[test] fn serialize_variant() { diff --git a/lib/src/types/tests/variant.rs b/lib/src/types/tests/variant.rs index 5e521fe50..be8b59c3e 100644 --- a/lib/src/types/tests/variant.rs +++ b/lib/src/types/tests/variant.rs @@ -1,7 +1,7 @@ use std::convert::TryFrom; use std::str::FromStr; -use crate::{ +use crate::types::{ numeric_range::NumericRange, status_code::StatusCode, variant::{Variant, VariantTypeId}, @@ -38,10 +38,9 @@ fn size() { #[test] fn variant_type_id() { - use crate::status_codes::StatusCode; - use crate::{ - ByteString, DateTime, ExpandedNodeId, ExtensionObject, Guid, LocalizedText, NodeId, - QualifiedName, UAString, XmlElement, + use crate::types::{ + status_codes::StatusCode, ByteString, DateTime, ExpandedNodeId, ExtensionObject, Guid, + LocalizedText, NodeId, QualifiedName, UAString, XmlElement, }; let types = [ diff --git a/samples/chess-server/Cargo.toml b/samples/chess-server/Cargo.toml index 3f330222a..025a1fddb 100644 --- a/samples/chess-server/Cargo.toml +++ b/samples/chess-server/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] uci = "0.1.1" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["server", "console-logging"] diff --git a/samples/demo-server/Cargo.toml b/samples/demo-server/Cargo.toml index a53c72fcc..38d4d0790 100644 --- a/samples/demo-server/Cargo.toml +++ b/samples/demo-server/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Adam Lock "] edition = "2018" [features] -vendored-openssl = ["opcua-rs/vendored-openssl"] +vendored-openssl = ["opcua/vendored-openssl"] [dependencies] chrono = "0.4" @@ -15,7 +15,7 @@ log4rs = "0.8" lazy_static = "1.4.0" pico-args = "0.3" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["all"] \ No newline at end of file diff --git a/samples/discovery-client/Cargo.toml b/samples/discovery-client/Cargo.toml index dda1e677d..4998efcd3 100644 --- a/samples/discovery-client/Cargo.toml +++ b/samples/discovery-client/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] pico-args = "0.3" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["client", "console-logging"] diff --git a/samples/event-client/Cargo.toml b/samples/event-client/Cargo.toml index 1b8eb8c02..de257cfbe 100644 --- a/samples/event-client/Cargo.toml +++ b/samples/event-client/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] pico-args="0.3" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["client", "console-logging"] diff --git a/samples/modbus-server/Cargo.toml b/samples/modbus-server/Cargo.toml index e1517f18c..df7bccdd4 100644 --- a/samples/modbus-server/Cargo.toml +++ b/samples/modbus-server/Cargo.toml @@ -16,7 +16,7 @@ serde = "1.0" serde_derive = "1.0" serde_yaml = "0.8" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["server", "console-logging"] \ No newline at end of file diff --git a/samples/modbus-server/src/main.rs b/samples/modbus-server/src/main.rs index 8e2bf72cf..ae1ba6bb9 100644 --- a/samples/modbus-server/src/main.rs +++ b/samples/modbus-server/src/main.rs @@ -16,6 +16,8 @@ use std::{ thread, }; +use ::opcua::console_logging; + mod config; mod master; mod opcua; @@ -113,7 +115,7 @@ fn main() -> Result<(), ()> { std::process::exit(1); }; - opcua::console_logging::init(); + console_logging::init(); run(config, args.run_demo_slave); } Ok(()) diff --git a/samples/mqtt-client/Cargo.toml b/samples/mqtt-client/Cargo.toml index caffb3cb4..6b15c4991 100644 --- a/samples/mqtt-client/Cargo.toml +++ b/samples/mqtt-client/Cargo.toml @@ -9,7 +9,7 @@ pico-args = "0.3" # This is a completely arbitrary snapshot of rumqtt that happens to work rumqtt = { git = "https://github.com/AtherEnergy/rumqtt.git", rev = "83b4694525061e2ccef617c0ac867db2044cc4e7" } -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["client", "console-logging"] diff --git a/samples/simple-client/Cargo.toml b/samples/simple-client/Cargo.toml index 8776edf03..cd783501e 100644 --- a/samples/simple-client/Cargo.toml +++ b/samples/simple-client/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] pico-args="0.3" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["client", "console-logging"] diff --git a/samples/simple-server/Cargo.toml b/samples/simple-server/Cargo.toml index b8b57bcd8..b35c73409 100644 --- a/samples/simple-server/Cargo.toml +++ b/samples/simple-server/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" chrono = "0.4" log = "0.4" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["server", "console-logging"] diff --git a/samples/web-client/Cargo.toml b/samples/web-client/Cargo.toml index 8177a7608..8ec48cc56 100644 --- a/samples/web-client/Cargo.toml +++ b/samples/web-client/Cargo.toml @@ -13,7 +13,7 @@ serde_json = "1.0" pico-args = "0.3" tokio = { version = "1", features = ["full"] } -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion features = ["client", "console-logging"] diff --git a/samples/web-client/src/main.rs b/samples/web-client/src/main.rs index 4f12d7872..185b403df 100644 --- a/samples/web-client/src/main.rs +++ b/samples/web-client/src/main.rs @@ -56,7 +56,7 @@ fn main() -> Result<(), ()> { Args::usage(); } else { // Optional - enable OPC UA logging - opcua_console_logging::init(); + opcua::console_logging::init(); // Run the http server run_server(format!("127.0.0.1:{}", args.http_port)); } diff --git a/tools/certificate-creator/Cargo.toml b/tools/certificate-creator/Cargo.toml index f2dc68b68..6c43fac94 100644 --- a/tools/certificate-creator/Cargo.toml +++ b/tools/certificate-creator/Cargo.toml @@ -16,7 +16,7 @@ appveyor = { repository = "locka99/opcua" } [dependencies] pico-args = "0.3" -[dependencies.opcua-rs] +[dependencies.opcua] path = "../../lib" version = "0.10.0" # OPCUARustVersion