Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 100% dependencies from crates.io #106

Merged
merged 7 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
286 changes: 110 additions & 176 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The library supports Modbus TCP, RTU, and TLS including role-based access contro

## License

Refer to [`License.txt`](./LICENSE.txt) for the terms of the non-commercial license. This software is "source available", but is not
Refer to [`LICENSE`](./LICENSE) for the terms of the non-commercial license. This software is "source available", but is not
"open source". You must purchase a commercial license to use this software for profit.

## Library
Expand Down
18 changes: 13 additions & 5 deletions dep_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,41 @@
"build_only": [
"addr2line",
"adler",
"atty",
"autocfg",
"backtrace",
"cc",
"clap",
"clap_derive",
"clap_lex",
"dunce",
"gimli",
"heck",
"java-oo-bindgen",
"miniz_oxide",
"object",
"oo-bindgen",
"os_str_bytes",
"pathdiff",
"pest",
"platforms",
"proc-macro-error",
"proc-macro-error-attr",
"rodbus-schema",
"rust-oo-bindgen",
"rustc-demangle",
"same-file",
"semver",
"semver-parser",
"serde_derive",
"strsim",
"termcolor",
"ucd-trie",
"unicode-segmentation",
"version_check",
"walkdir",
"winapi-util"
],
"vendor": {
"rasn": {
"rx509": {
"url": "https://github.com/stepfunc/rasn"
},
"rodbus": {
Expand All @@ -43,10 +51,10 @@
"scursor": {
"url": "https://github.com/stepfunc/scursor"
},
"tokio-ffi-schema": {
"sfio-tokio-ffi": {
"url": "https://github.com/stepfunc/tokio-ffi"
},
"tracing-ffi-schema": {
"sfio-tracing-ffi": {
"url": "https://github.com/stepfunc/tracing-ffi"
}
},
Expand Down
3 changes: 1 addition & 2 deletions ffi/rodbus-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ name = "rodbus-bindings"
version = "1.1.0-rc1"
authors = ["Step Function I/O LLC <[email protected]>"]
edition = "2021"
license = "GPL-3.0-only"
description = "oobindgen schema for Rodbus"
keywords = ["ffi", "c", "modbus", "ics", "industrial", "plc", "security"]
categories = ["network-programming"]
repository = "https://github.com/stepfunc/rodbus"
readme = "../README.md"

[dependencies]
ci-script = { git = "https://github.com/stepfunc/oo_bindgen.git", tag = "0.5.1" }
oo-bindgen = "0.6"
rodbus-schema = { path = "../rodbus-schema" }
tracing = "^0.1"
tracing-subscriber = "^0.3"
Expand Down
4 changes: 2 additions & 2 deletions ffi/rodbus-bindings/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn main() {

let library = rodbus_schema::build_lib().unwrap();

let builder_settings = ci_script::BindingBuilderSettings {
let builder_settings = oo_bindgen::cli::BindingBuilderSettings {
ffi_target_name: "rodbus-ffi",
jni_target_name: "rodbus-ffi-java",
ffi_name: "rodbus_ffi",
Expand All @@ -19,5 +19,5 @@ pub fn main() {
library: Rc::new(library),
};

ci_script::run(builder_settings);
oo_bindgen::cli::run(builder_settings);
}
2 changes: 1 addition & 1 deletion ffi/rodbus-ffi-java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ tls = ["rodbus-ffi/tls"]

[build-dependencies]
rodbus-schema = { path = "../rodbus-schema" }
java-oo-bindgen = { git = "https://github.com/stepfunc/oo_bindgen.git", tag = "0.5.1" }
oo-bindgen = "0.6"
8 changes: 4 additions & 4 deletions ffi/rodbus-ffi-java/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ fn main() {
// normally you'd never want to write files here, but this crate isn't used as a dependency
let out_path: PathBuf = Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("jni.rs");

let config = java_oo_bindgen::JniBindgenConfig {
group_id: "io.stepfunc".to_string(),
ffi_name: "rodbus_ffi".to_string(),
let config = oo_bindgen::backend::java::JniBindgenConfig {
group_id: "io.stepfunc",
ffi_name: "rodbus_ffi",
};

match rodbus_schema::build_lib() {
Expand All @@ -18,7 +18,7 @@ fn main() {
std::process::exit(-1);
}
Ok(lib) => {
java_oo_bindgen::generate_java_ffi(&out_path, &lib, &config).unwrap();
oo_bindgen::backend::java::generate_jni(&out_path, &lib, &config).unwrap();
}
}
}
7 changes: 4 additions & 3 deletions ffi/rodbus-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ num_cpus = "1"

[build-dependencies]
rodbus-schema = { path = "../rodbus-schema" }
rust-oo-bindgen = { git = "https://github.com/stepfunc/oo_bindgen.git", tag = "0.5.1" }
tracing-ffi-schema = { git = "https://github.com/stepfunc/tracing-ffi.git", tag = "0.4.0" }
tokio-ffi-schema = { git = "https://github.com/stepfunc/tokio-ffi.git", tag = "0.4.0" }
oo-bindgen = "0.6"
sfio-tracing-ffi = "0.5"
sfio-tokio-ffi = "0.5"


[features]
default = ["serial", "tls"]
Expand Down
6 changes: 3 additions & 3 deletions ffi/rodbus-ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ fn write_tracing_ffi() {
let mut file =
std::fs::File::create(Path::new(&env::var_os("OUT_DIR").unwrap()).join("tracing.rs"))
.unwrap();
file.write_all(tracing_ffi_schema::get_impl_file().as_bytes())
file.write_all(sfio_tracing_ffi::get_impl_file().as_bytes())
.unwrap();
}

fn write_tokio_ffi() {
let mut file =
std::fs::File::create(Path::new(&env::var_os("OUT_DIR").unwrap()).join("runtime.rs"))
.unwrap();
file.write_all(tokio_ffi_schema::get_impl_file().as_bytes())
file.write_all(sfio_tokio_ffi::get_impl_file().as_bytes())
.unwrap();
}

Expand All @@ -26,7 +26,7 @@ fn main() {

match rodbus_schema::build_lib() {
Ok(lib) => {
rust_oo_bindgen::RustCodegen::new(&lib).generate().unwrap();
oo_bindgen::backend::rust::generate_ffi(&lib).unwrap();
}
Err(err) => {
eprintln!("rodbus model error: {}", err);
Expand Down
7 changes: 3 additions & 4 deletions ffi/rodbus-schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ name = "rodbus-schema"
version = "1.1.0-rc1"
authors = ["Step Function I/O LLC <[email protected]>"]
edition = "2021"
license = "GPL-3.0-only"
description = "oobindgen schema for Rodbus"
keywords = ["ffi", "c", "modbus", "ics", "industrial", "plc", "security"]
categories = ["network-programming"]
repository = "https://github.com/stepfunc/rodbus"
readme = "../README.md"

[dependencies]
oo-bindgen = { git = "https://github.com/stepfunc/oo_bindgen.git", tag = "0.5.1" }
tracing-ffi-schema = { git = "https://github.com/stepfunc/tracing-ffi.git", tag = "0.4.0" }
tokio-ffi-schema = { git = "https://github.com/stepfunc/tokio-ffi.git", tag = "0.4.0" }
oo-bindgen = "0.6"
sfio-tokio-ffi = "0.5"
sfio-tracing-ffi = "0.5"
4 changes: 2 additions & 2 deletions ffi/rodbus-schema/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl CommonDefinitions {
error_type: error_type.clone(),
nothing,
decode_level,
runtime_handle: tokio_ffi_schema::define(lib, error_type)?,
runtime_handle: sfio_tokio_ffi::define(lib, error_type)?,
error_info: build_request_error(lib)?,
address_range: build_address_range(lib)?,
request_param: build_request_param(lib)?,
Expand Down Expand Up @@ -204,7 +204,7 @@ fn build_iterator(
lib: &mut LibraryBuilder,
item_type: &UniversalStructHandle,
) -> BackTraced<AbstractIteratorHandle> {
let base_name = item_type.declaration.name();
let base_name = item_type.name();
let iter =
lib.define_iterator_with_lifetime(format!("{}_iterator", base_name), item_type.clone())?;
Ok(iter)
Expand Down
2 changes: 1 addition & 1 deletion ffi/rodbus-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn build_lib() -> BackTraced<Library> {

let common = CommonDefinitions::build(&mut builder)?;

tracing_ffi_schema::define(&mut builder, common.error_type.clone())?;
sfio_tracing_ffi::define(&mut builder, common.error_type.clone())?;

client::build(&mut builder, &common)?;
server::build(&mut builder, &common)?;
Expand Down
8 changes: 4 additions & 4 deletions ffi/rodbus-schema/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) fn build_server(
.begin_callback("callback", "callback function")?
.param(
"database",
database.declaration.clone(),
database.declaration(),
"Database on which to perform updates",
)?
.enable_functional_transform()
Expand Down Expand Up @@ -91,7 +91,7 @@ pub(crate) fn build_server(
)?
.param(
"endpoints",
handler_map.declaration.clone(),
handler_map.declaration(),
"map of endpoints which is emptied upon passing to this function",
)?
.param(
Expand All @@ -117,7 +117,7 @@ pub(crate) fn build_server(
.param("max_sessions", Primitive::U16, "Maximum number of concurrent sessions")?
.param(
"endpoints",
handler_map.declaration.clone(),
handler_map.declaration(),
"map of endpoints which is emptied upon passing to this function",
)?
.param(
Expand Down Expand Up @@ -152,7 +152,7 @@ pub(crate) fn build_server(
.param("max_sessions", Primitive::U16, "Maximum number of concurrent sessions")?
.param(
"endpoints",
handler_map.declaration.clone(),
handler_map.declaration(),
"map of endpoints which is emptied upon passing to this function",
)?
.param(
Expand Down
10 changes: 6 additions & 4 deletions rodbus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,35 @@ version = "1.1.0-rc1"
authors = ["Step Function I/O LLC <[email protected]>"]
edition = "2021"
description = "A high-performance async implementation of the Modbus protocol using tokio"
license-file = "../LICENSE.txt"
keywords = ["modbus", "ics", "industrial", "plc", "security"]
categories = ["network-programming"]
repository = "https://github.com/stepfunc/rodbus"
readme = "../README.md"

[dependencies]
crc = "2.0"
scursor = { git = "https://github.com/stepfunc/scursor.git", tag="0.1.0" }
scursor = "0.1"
tokio = { version = "1", features = ["net", "sync", "io-util", "io-std", "time", "rt", "rt-multi-thread", "macros"] }
tracing = "0.1"

# TLS dependencies
pem = { version = "1.0", optional = true }
pkcs8 = { version = "0.7", features = ["encryption", "pem", "std"], optional = true }
rasn = { git = "https://github.com/stepfunc/rasn.git", tag = "0.1.2", optional = true }
rx509 = { version = "0.2", optional = true }
tokio-rustls = { version = "0.23", features = ["dangerous_configuration", "tls12"], default-features = false, optional = true }
# serial dependencies
tokio-serial = { version = "5.4", default-features = false, optional = true }

[dev-dependencies]
clap = { version = "3.2.20", features = ["derive"] }
tokio-stream = "0.1"
tokio-util = { version = "0.6", features = ["codec"] }
tokio-test = "0.4.2"
tokio-mock-io = { git = "https://github.com/stepfunc/tokio-mock-io.git", tag = "0.2.0" }
sfio-tokio-mock-io = "0.2"
tracing-subscriber = "0.2"

[features]
default = ["tls", "serial"]
tls = ["pem", "pkcs8", "rasn", "tokio-rustls"]
tls = ["pem", "pkcs8", "rx509", "tokio-rustls"]
serial = ["tokio-serial"]
6 changes: 3 additions & 3 deletions rodbus/src/client/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ mod tests {
use crate::types::{AddressRange, UnitId};
use crate::{ExceptionCode, Indexed, ReadBitsRange};

use tokio_mock_io::Event;
use sfio_tokio_mock_io::Event;

fn spawn_client_loop() -> (
Channel,
tokio::task::JoinHandle<SessionError>,
tokio_mock_io::Handle,
sfio_tokio_mock_io::Handle,
) {
let (tx, rx) = tokio::sync::mpsc::channel(16);
let (mock, io_handle) = tokio_mock_io::mock();
let (mock, io_handle) = sfio_tokio_mock_io::mock();
let mut client_loop = ClientLoop::new(
rx,
FrameWriter::tcp(),
Expand Down
2 changes: 1 addition & 1 deletion rodbus/src/common/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ mod tests {
fn preserves_data_over_multiple_reads() {
let mut buffer = ReadBuffer::new();

let (io, mut io_handle) = tokio_mock_io::mock();
let (io, mut io_handle) = sfio_tokio_mock_io::mock();
let mut phys = PhysLayer::new_mock(io);

{
Expand Down
4 changes: 2 additions & 2 deletions rodbus/src/common/phys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) enum PhysLayerImpl {
#[cfg(feature = "tls")]
Tls(Box<tokio_rustls::TlsStream<tokio::net::TcpStream>>),
#[cfg(test)]
Mock(tokio_mock_io::Mock),
Mock(sfio_tokio_mock_io::Mock),
}

impl std::fmt::Debug for PhysLayer {
Expand Down Expand Up @@ -59,7 +59,7 @@ impl PhysLayer {
}

#[cfg(test)]
pub(crate) fn new_mock(mock: tokio_mock_io::Mock) -> Self {
pub(crate) fn new_mock(mock: sfio_tokio_mock_io::Mock) -> Self {
Self {
layer: PhysLayerImpl::Mock(mock),
}
Expand Down
8 changes: 4 additions & 4 deletions rodbus/src/serial/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ mod tests {
];

fn assert_can_parse_frame(mut reader: FramedReader, frame: &[u8]) {
let (io, mut io_handle) = tokio_mock_io::mock();
let (io, mut io_handle) = sfio_tokio_mock_io::mock();
let mut layer = PhysLayer::new_mock(io);
let mut task =
tokio_test::task::spawn(reader.next_frame(&mut layer, DecodeLevel::nothing()));
Expand Down Expand Up @@ -555,7 +555,7 @@ mod tests {
}

fn assert_can_parse_frame_byte_per_byte(mut reader: FramedReader, frame: &[u8]) {
let (io, mut io_handle) = tokio_mock_io::mock();
let (io, mut io_handle) = sfio_tokio_mock_io::mock();
let mut layer = PhysLayer::new_mock(io);
let mut task =
tokio_test::task::spawn(reader.next_frame(&mut layer, DecodeLevel::nothing()));
Expand Down Expand Up @@ -601,7 +601,7 @@ mod tests {
}

fn assert_can_parse_two_frames(mut reader: FramedReader, frame: &[u8]) {
let (io, mut io_handle) = tokio_mock_io::mock();
let (io, mut io_handle) = sfio_tokio_mock_io::mock();
let mut layer = PhysLayer::new_mock(io);

// Build single array with two identical frames
Expand Down Expand Up @@ -682,7 +682,7 @@ mod tests {
];

let mut reader = FramedReader::rtu_request();
let (io, mut io_handle) = tokio_mock_io::mock();
let (io, mut io_handle) = sfio_tokio_mock_io::mock();
let mut layer = PhysLayer::new_mock(io);
let mut task =
tokio_test::task::spawn(reader.next_frame(&mut layer, DecodeLevel::nothing()));
Expand Down
Loading