diff --git a/Cargo.lock b/Cargo.lock index 4f98504c..a5073f88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,9 +132,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64ct" @@ -194,15 +194,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" -[[package]] -name = "c-oo-bindgen" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" -dependencies = [ - "oo-bindgen", - "tracing", -] - [[package]] name = "cc" version = "1.0.73" @@ -233,22 +224,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ci-script" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" -dependencies = [ - "c-oo-bindgen", - "clap 4.0.17", - "dotnet-oo-bindgen", - "java-oo-bindgen", - "oo-bindgen", - "pathdiff", - "serde", - "serde_json", - "tracing", -] - [[package]] name = "cipher" version = "0.3.0" @@ -275,9 +250,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.22" +version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ "atty", "bitflags", @@ -287,18 +262,18 @@ dependencies = [ "once_cell", "strsim 0.10.0", "termcolor", - "textwrap 0.15.1", + "textwrap 0.16.0", ] [[package]] name = "clap" -version = "4.0.17" +version = "4.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06badb543e734a2d6568e19a40af66ed5364360b9226184926f89d229b4b4267" +checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b" dependencies = [ "atty", "bitflags", - "clap_derive 4.0.13", + "clap_derive 4.0.18", "clap_lex 0.3.0", "once_cell", "strsim 0.10.0", @@ -320,9 +295,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.13" +version = "4.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad" +checksum = "16a1b0f6422af32d5da0c58e2703320f379216ee70198241c84173a8c5ac28f3" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -427,9 +402,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" dependencies = [ "cc", "cxxbridge-flags", @@ -439,9 +414,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" dependencies = [ "cc", "codespan-reporting", @@ -454,15 +429,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" [[package]] name = "cxxbridge-macro" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" dependencies = [ "proc-macro2", "quote", @@ -498,17 +473,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dotnet-oo-bindgen" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" -dependencies = [ - "clap 4.0.17", - "dunce", - "oo-bindgen", - "tracing", -] - [[package]] name = "dunce" version = "1.0.3" @@ -709,17 +673,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" -[[package]] -name = "java-oo-bindgen" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" -dependencies = [ - "dunce", - "oo-bindgen", - "pathdiff", - "tracing", -] - [[package]] name = "jni" version = "0.19.0" @@ -757,9 +710,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "link-cplusplus" @@ -832,9 +785,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", @@ -935,15 +888,20 @@ checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "oo-bindgen" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c34c9ff5b3e71d13b30394094d2423fa0d8755c1947ee6e160e6cf18a0e6d8e" dependencies = [ "backtrace", + "clap 4.0.18", + "dunce", "heck 0.3.3", "lazy_static", "platforms", "regex", "semver", + "serde", + "serde_json", "thiserror", "tracing", ] @@ -966,12 +924,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "pbkdf2" version = "0.9.0" @@ -1008,16 +960,6 @@ dependencies = [ "base64ct", ] -[[package]] -name = "pest" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" -dependencies = [ - "thiserror", - "ucd-trie", -] - [[package]] name = "pin-project-lite" version = "0.2.9" @@ -1114,11 +1056,6 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -[[package]] -name = "rasn" -version = "0.1.2" -source = "git+https://github.com/stepfunc/rasn.git?tag=0.1.2#bced2fd6bad873104b3d39966f42731315dd705e" - [[package]] name = "regex" version = "1.6.0" @@ -1164,14 +1101,14 @@ dependencies = [ name = "rodbus" version = "1.1.0-rc1" dependencies = [ - "clap 3.2.22", + "clap 3.2.23", "crc", "pem", "pkcs8", - "rasn", + "rx509", "scursor", + "sfio-tokio-mock-io", "tokio", - "tokio-mock-io", "tokio-rustls", "tokio-serial", "tokio-stream", @@ -1185,7 +1122,7 @@ dependencies = [ name = "rodbus-bindings" version = "1.1.0-rc1" dependencies = [ - "ci-script", + "oo-bindgen", "rodbus-schema", "tracing", "tracing-subscriber 0.3.16", @@ -1208,14 +1145,14 @@ version = "1.1.0-rc1" dependencies = [ "lazy_static", "num_cpus", + "oo-bindgen", "rodbus", "rodbus-schema", - "rust-oo-bindgen", + "sfio-tokio-ffi", + "sfio-tracing-ffi", "tokio", - "tokio-ffi-schema", "tracing", "tracing-core", - "tracing-ffi-schema", "tracing-subscriber 0.2.25", ] @@ -1223,8 +1160,8 @@ dependencies = [ name = "rodbus-ffi-java" version = "1.1.0-rc1" dependencies = [ - "java-oo-bindgen", "jni", + "oo-bindgen", "rodbus-ffi", "rodbus-schema", ] @@ -1234,17 +1171,8 @@ name = "rodbus-schema" version = "1.1.0-rc1" dependencies = [ "oo-bindgen", - "tokio-ffi-schema", - "tracing-ffi-schema", -] - -[[package]] -name = "rust-oo-bindgen" -version = "0.5.1" -source = "git+https://github.com/stepfunc/oo_bindgen.git?tag=0.5.1#1ed2f02a860e8e9cd382a17cb455acef0bedd3af" -dependencies = [ - "heck 0.3.3", - "oo-bindgen", + "sfio-tokio-ffi", + "sfio-tracing-ffi", ] [[package]] @@ -1264,6 +1192,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "rx509" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c177a3ff729f263173df3a7a58442fde7c0eb93d79ee8aaa66e67503c5c42fb" + [[package]] name = "ryu" version = "1.0.11" @@ -1319,40 +1253,29 @@ dependencies = [ [[package]] name = "scursor" version = "0.1.0" -source = "git+https://github.com/stepfunc/scursor.git?tag=0.1.0#4d876ce9d08cb42a22b039c847b04728ddc88fd5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d22f5a1672640fcdfc63720cdda822d784d62d89070e8d05b39a5319006f7f7" [[package]] name = "semver" -version = "0.11.0" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -1386,6 +1309,33 @@ dependencies = [ "winapi", ] +[[package]] +name = "sfio-tokio-ffi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2fa39638cdae09f196ef7ec440429e291007bf81af3d5134fd5742b34b44529" +dependencies = [ + "oo-bindgen", +] + +[[package]] +name = "sfio-tokio-mock-io" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bfa6a7160e6e19effd9dcd3601c10432eda4b36daa45b58030605ad332586" +dependencies = [ + "tokio", +] + +[[package]] +name = "sfio-tracing-ffi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e582bebc03d7f2e8ebc86f0d44daa75ac6340b7a58d0da29b475aeddd6ac24f" +dependencies = [ + "oo-bindgen", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1479,9 +1429,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -1508,9 +1458,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" @@ -1559,14 +1509,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "tokio-ffi-schema" -version = "0.4.0" -source = "git+https://github.com/stepfunc/tokio-ffi.git?tag=0.4.0#64803e1437fc73218e37c2262bfe980f6b0b04b7" -dependencies = [ - "oo-bindgen", -] - [[package]] name = "tokio-macros" version = "1.8.0" @@ -1578,14 +1520,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-mock-io" -version = "0.2.0" -source = "git+https://github.com/stepfunc/tokio-mock-io.git?tag=0.2.0#8bac8f7be852fba655becc8b1d4157a55bb2b9fc" -dependencies = [ - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.23.4" @@ -1681,14 +1615,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-ffi-schema" -version = "0.4.0" -source = "git+https://github.com/stepfunc/tracing-ffi.git?tag=0.4.0#67bd216093060bd6a724d391bbc4f34e4bb0c802" -dependencies = [ - "oo-bindgen", -] - [[package]] name = "tracing-log" version = "0.1.3" @@ -1752,12 +1678,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" -[[package]] -name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - [[package]] name = "unicode-ident" version = "1.0.5" @@ -1924,46 +1844,60 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ + "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", + "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "zeroize" diff --git a/README.md b/README.md index f46a3d68..6603a3f9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/dep_config.json b/dep_config.json index a094407d..0d9d725e 100644 --- a/dep_config.json +++ b/dep_config.json @@ -2,25 +2,33 @@ "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", @@ -28,7 +36,7 @@ "winapi-util" ], "vendor": { - "rasn": { + "rx509": { "url": "https://github.com/stepfunc/rasn" }, "rodbus": { @@ -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" } }, diff --git a/ffi/rodbus-bindings/Cargo.toml b/ffi/rodbus-bindings/Cargo.toml index f2a9bbe3..bf39bbf9 100644 --- a/ffi/rodbus-bindings/Cargo.toml +++ b/ffi/rodbus-bindings/Cargo.toml @@ -3,7 +3,6 @@ name = "rodbus-bindings" version = "1.1.0-rc1" authors = ["Step Function I/O LLC "] edition = "2021" -license = "GPL-3.0-only" description = "oobindgen schema for Rodbus" keywords = ["ffi", "c", "modbus", "ics", "industrial", "plc", "security"] categories = ["network-programming"] @@ -11,7 +10,7 @@ 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" diff --git a/ffi/rodbus-bindings/src/main.rs b/ffi/rodbus-bindings/src/main.rs index 540d0256..4c49157b 100644 --- a/ffi/rodbus-bindings/src/main.rs +++ b/ffi/rodbus-bindings/src/main.rs @@ -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", @@ -19,5 +19,5 @@ pub fn main() { library: Rc::new(library), }; - ci_script::run(builder_settings); + oo_bindgen::cli::run(builder_settings); } diff --git a/ffi/rodbus-ffi-java/Cargo.toml b/ffi/rodbus-ffi-java/Cargo.toml index 0a0133c3..fc1f30a8 100644 --- a/ffi/rodbus-ffi-java/Cargo.toml +++ b/ffi/rodbus-ffi-java/Cargo.toml @@ -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" } \ No newline at end of file +oo-bindgen = "0.6" \ No newline at end of file diff --git a/ffi/rodbus-ffi-java/build.rs b/ffi/rodbus-ffi-java/build.rs index a9a4a60a..c7d01513 100644 --- a/ffi/rodbus-ffi-java/build.rs +++ b/ffi/rodbus-ffi-java/build.rs @@ -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() { @@ -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(); } } } diff --git a/ffi/rodbus-ffi/Cargo.toml b/ffi/rodbus-ffi/Cargo.toml index 90f99615..bd712444 100644 --- a/ffi/rodbus-ffi/Cargo.toml +++ b/ffi/rodbus-ffi/Cargo.toml @@ -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"] diff --git a/ffi/rodbus-ffi/build.rs b/ffi/rodbus-ffi/build.rs index f945e14f..c1d04421 100644 --- a/ffi/rodbus-ffi/build.rs +++ b/ffi/rodbus-ffi/build.rs @@ -6,7 +6,7 @@ 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(); } @@ -14,7 +14,7 @@ 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(); } @@ -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); diff --git a/ffi/rodbus-schema/Cargo.toml b/ffi/rodbus-schema/Cargo.toml index 1debadc1..7b4b6573 100644 --- a/ffi/rodbus-schema/Cargo.toml +++ b/ffi/rodbus-schema/Cargo.toml @@ -4,7 +4,6 @@ name = "rodbus-schema" version = "1.1.0-rc1" authors = ["Step Function I/O LLC "] edition = "2021" -license = "GPL-3.0-only" description = "oobindgen schema for Rodbus" keywords = ["ffi", "c", "modbus", "ics", "industrial", "plc", "security"] categories = ["network-programming"] @@ -12,6 +11,6 @@ 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" diff --git a/ffi/rodbus-schema/src/common.rs b/ffi/rodbus-schema/src/common.rs index abda6a78..f2857e7d 100644 --- a/ffi/rodbus-schema/src/common.rs +++ b/ffi/rodbus-schema/src/common.rs @@ -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)?, @@ -204,7 +204,7 @@ fn build_iterator( lib: &mut LibraryBuilder, item_type: &UniversalStructHandle, ) -> BackTraced { - 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) diff --git a/ffi/rodbus-schema/src/lib.rs b/ffi/rodbus-schema/src/lib.rs index 0d971f80..a0164539 100644 --- a/ffi/rodbus-schema/src/lib.rs +++ b/ffi/rodbus-schema/src/lib.rs @@ -63,7 +63,7 @@ pub fn build_lib() -> BackTraced { 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)?; diff --git a/ffi/rodbus-schema/src/server.rs b/ffi/rodbus-schema/src/server.rs index 8b5493b5..263f7b44 100644 --- a/ffi/rodbus-schema/src/server.rs +++ b/ffi/rodbus-schema/src/server.rs @@ -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() @@ -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( @@ -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( @@ -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( diff --git a/rodbus/Cargo.toml b/rodbus/Cargo.toml index f3bfc346..b03353c8 100644 --- a/rodbus/Cargo.toml +++ b/rodbus/Cargo.toml @@ -4,6 +4,7 @@ version = "1.1.0-rc1" authors = ["Step Function I/O LLC "] 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" @@ -11,15 +12,16 @@ 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] @@ -27,10 +29,10 @@ 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"] diff --git a/rodbus/src/client/task.rs b/rodbus/src/client/task.rs index e8d22efc..ccc9025d 100644 --- a/rodbus/src/client/task.rs +++ b/rodbus/src/client/task.rs @@ -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, - 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(), diff --git a/rodbus/src/common/buffer.rs b/rodbus/src/common/buffer.rs index 8aeb255f..acdb6ed8 100644 --- a/rodbus/src/common/buffer.rs +++ b/rodbus/src/common/buffer.rs @@ -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); { diff --git a/rodbus/src/common/phys.rs b/rodbus/src/common/phys.rs index 8340a272..7d45e132 100644 --- a/rodbus/src/common/phys.rs +++ b/rodbus/src/common/phys.rs @@ -19,7 +19,7 @@ pub(crate) enum PhysLayerImpl { #[cfg(feature = "tls")] Tls(Box>), #[cfg(test)] - Mock(tokio_mock_io::Mock), + Mock(sfio_tokio_mock_io::Mock), } impl std::fmt::Debug for PhysLayer { @@ -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), } diff --git a/rodbus/src/serial/frame.rs b/rodbus/src/serial/frame.rs index a76b3fc0..500dd80f 100644 --- a/rodbus/src/serial/frame.rs +++ b/rodbus/src/serial/frame.rs @@ -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())); @@ -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())); @@ -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 @@ -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())); diff --git a/rodbus/src/tcp/frame.rs b/rodbus/src/tcp/frame.rs index 9ac2002c..a851a518 100644 --- a/rodbus/src/tcp/frame.rs +++ b/rodbus/src/tcp/frame.rs @@ -238,7 +238,7 @@ mod tests { fn test_segmented_parse(split_at: usize) { let (f1, f2) = SIMPLE_FRAME.split_at(split_at); - let (io, mut io_handle) = tokio_mock_io::mock(); + let (io, mut io_handle) = sfio_tokio_mock_io::mock(); let mut reader = FramedReader::tcp(); let mut layer = PhysLayer::new_mock(io); let mut task = @@ -256,7 +256,7 @@ mod tests { } fn test_error(input: &[u8]) -> RequestError { - let (io, mut io_handle) = tokio_mock_io::mock(); + let (io, mut io_handle) = sfio_tokio_mock_io::mock(); let mut reader = FramedReader::tcp(); let mut layer = PhysLayer::new_mock(io); let mut task = @@ -290,7 +290,7 @@ mod tests { #[test] fn can_parse_frame_from_stream() { - let (io, mut io_handle) = tokio_mock_io::mock(); + let (io, mut io_handle) = sfio_tokio_mock_io::mock(); let mut reader = FramedReader::tcp(); let mut layer = PhysLayer::new_mock(io); let mut task = @@ -310,7 +310,7 @@ mod tests { let header = &[0x00, 0x07, 0x00, 0x00, 0x00, 0xFE, 0x2A]; let payload = &[0xCC; 253]; - let (io, mut io_handle) = tokio_mock_io::mock(); + let (io, mut io_handle) = sfio_tokio_mock_io::mock(); let mut reader = FramedReader::tcp(); let mut task = tokio_test::task::spawn(async { assert_eq!( diff --git a/rodbus/src/tcp/tls/client.rs b/rodbus/src/tcp/tls/client.rs index 576c0d71..ebd5018f 100644 --- a/rodbus/src/tcp/tls/client.rs +++ b/rodbus/src/tcp/tls/client.rs @@ -312,7 +312,7 @@ impl rustls::client::ServerCertVerifier for SelfSignedCertificateServerCertVerif } // Check that the certificate is still valid - let parsed_cert = rasn::x509::Certificate::parse(&end_entity.0).map_err(|err| { + let parsed_cert = rx509::x509::Certificate::parse(&end_entity.0).map_err(|err| { rustls::Error::InvalidCertificateData(format!( "unable to parse cert with rasn: {:?}", err @@ -322,7 +322,7 @@ impl rustls::client::ServerCertVerifier for SelfSignedCertificateServerCertVerif let now = now .duration_since(std::time::UNIX_EPOCH) .map_err(|_| rustls::Error::FailedToGetCurrentTime)?; - let now = rasn::types::UtcTime::from_seconds_since_epoch(now.as_secs()); + let now = rx509::der::UtcTime::from_seconds_since_epoch(now.as_secs()); if !parsed_cert.tbs_certificate.value.validity.is_valid(now) { return Err(rustls::Error::InvalidCertificateData( diff --git a/rodbus/src/tcp/tls/mod.rs b/rodbus/src/tcp/tls/mod.rs index 2d9e3733..356ffc15 100644 --- a/rodbus/src/tcp/tls/mod.rs +++ b/rodbus/src/tcp/tls/mod.rs @@ -102,7 +102,7 @@ fn verify_dns_name(cert: &rustls::Certificate, server_name: &str) -> Result<(), Err(webpki::Error::CertNotValidForName) => { // Let's extend our search to the CN // Parse the certificate using rasn - let parsed_cert = rasn::x509::Certificate::parse(&cert.0).map_err(|err| { + let parsed_cert = rx509::x509::Certificate::parse(&cert.0).map_err(|err| { rustls::Error::InvalidCertificateData(format!( "unable to parse cert with rasn: {:?}", err @@ -123,7 +123,7 @@ fn verify_dns_name(cert: &rustls::Certificate, server_name: &str) -> Result<(), if extensions.iter().any(|x| { matches!( x.content, - rasn::extensions::SpecificExtension::SubjectAlternativeName(_) + rx509::x509::ext::SpecificExtension::SubjectAlternativeName(_) ) }) { return Err(rustls::Error::InvalidCertificateData( diff --git a/rodbus/src/tcp/tls/server.rs b/rodbus/src/tcp/tls/server.rs index 08795360..3b5dbddc 100644 --- a/rodbus/src/tcp/tls/server.rs +++ b/rodbus/src/tcp/tls/server.rs @@ -95,7 +95,7 @@ impl TlsServerConfig { .0 .as_slice(); - let parsed = rasn::x509::Certificate::parse(peer_cert) + let parsed = rx509::x509::Certificate::parse(peer_cert) .map_err(|err| format!("ASNError: {}", err))?; let role = extract_modbus_role(&parsed).map_err(|err| format!("{}", err))?; @@ -202,7 +202,7 @@ impl rustls::server::ClientCertVerifier for SelfSignedCertificateClientCertVerif )); } - let parsed_cert = rasn::x509::Certificate::parse(&end_entity.0).map_err(|err| { + let parsed_cert = rx509::x509::Certificate::parse(&end_entity.0).map_err(|err| { rustls::Error::InvalidCertificateData(format!( "unable to parse cert with rasn: {:?}", err @@ -213,7 +213,7 @@ impl rustls::server::ClientCertVerifier for SelfSignedCertificateClientCertVerif let now = now .duration_since(std::time::UNIX_EPOCH) .map_err(|_| rustls::Error::FailedToGetCurrentTime)?; - let now = rasn::types::UtcTime::from_seconds_since_epoch(now.as_secs()); + let now = rx509::der::UtcTime::from_seconds_since_epoch(now.as_secs()); if !parsed_cert.tbs_certificate.value.validity.is_valid(now) { return Err(rustls::Error::InvalidCertificateData( @@ -243,7 +243,7 @@ fn build_server_config( Ok(config) } -fn extract_modbus_role(cert: &rasn::x509::Certificate) -> Result { +fn extract_modbus_role(cert: &rx509::x509::Certificate) -> Result { // Parse the extensions let extensions = cert .tbs_certificate @@ -264,7 +264,7 @@ fn extract_modbus_role(cert: &rasn::x509::Certificate) -> Result Some(role.role), + rx509::x509::ext::SpecificExtension::ModbusRole(role) => Some(role.role), _ => None, });