rustorb 0.4.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rustorb-0.4.0 → rustorb-0.6.0}/Cargo.lock +8 -8
- {rustorb-0.4.0 → rustorb-0.6.0}/Cargo.toml +6 -6
- {rustorb-0.4.0 → rustorb-0.6.0}/PKG-INFO +1 -1
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/value.rs +6 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/xcdr.rs +14 -12
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/tests/xcdr.rs +24 -23
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/connection.rs +100 -45
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/lib.rs +6 -3
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/object.rs +176 -45
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/orb.rs +48 -11
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/pi.rs +24 -14
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/poa.rs +154 -19
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/policy.rs +184 -47
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/servant.rs +1 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/server.rs +304 -53
- rustorb-0.6.0/crates/rustorb-core/src/sock.rs +220 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/stream.rs +57 -0
- rustorb-0.6.0/crates/rustorb-core/src/unix.rs +153 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/value.rs +38 -2
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/wire.rs +20 -31
- rustorb-0.6.0/crates/rustorb-core/tests/poa_manager_factory.rs +243 -0
- rustorb-0.6.0/crates/rustorb-core/tests/sync_scope.rs +573 -0
- rustorb-0.6.0/crates/rustorb-core/tests/unix.rs +521 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/component.rs +32 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/lib.rs +1 -1
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/tests/ior.rs +32 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/error.rs +7 -1
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/poa.rs +47 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/pyproject.toml +1 -1
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/CORBA.py +11 -5
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/Messaging.py +41 -7
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/PortableServer.py +43 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/_native.pyi +4 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/timeouts.py +2 -2
- {rustorb-0.4.0 → rustorb-0.6.0}/README.md +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/Cargo.toml +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/LICENSE-APACHE +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/LICENSE-MIT +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/README.md +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/decoder.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/encoder.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/error.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/lib.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/long_double.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/octets.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/src/traits.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-cdr/tests/cdr.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/Cargo.toml +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/LICENSE-APACHE +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/LICENSE-MIT +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/README.md +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/benches/throughput.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/codeset.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/dii.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/dynany/mod.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/dynany/tests.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/exception.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/fixed.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/idl/abstract_iface.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/idl/mod.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/idl/tests.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/idl/value.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/idle.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/iop.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/name.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/pool.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/timeout.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/tls.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/trace.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/typecode/cdr.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/typecode/mod.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/src/typecode/tests.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/ami.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/any.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/async_api.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/bidir.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/client.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/connections.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/dii.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/message_size.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/pi.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/poa.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/policy.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/server.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/soak.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/stress.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/ca.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/client-bundle.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/client.key +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/client.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/make-certs.sh +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/other-ca.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/other-server.key +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/other-server.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/server-bundle.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/server.key +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/server.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/wrong-name.key +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls/wrong-name.pem +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/tls.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/trace.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-core/tests/valuetype.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/Cargo.toml +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/LICENSE-APACHE +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/LICENSE-MIT +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/README.md +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/corbaloc.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/error.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/fragment.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/header.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/iiop.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/ior.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/message.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/service_context.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/src/writer.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/tests/giop.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-giop/tests/omniorb_golden.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/Cargo.toml +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/LICENSE-APACHE +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/LICENSE-MIT +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/README.md +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/build.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/any.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/dii.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/dynany.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/lib.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/log.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/orb.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/pi.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/tc.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/crates/rustorb-python/src/value.rs +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/BiDirPolicy.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/DynamicAny.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/IOP.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/Messaging__POA.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/PortableInterceptor.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/PortableServer__POA.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/TimeBase.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/__init__.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/_log.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/_rt.py +0 -0
- {rustorb-0.4.0 → rustorb-0.6.0}/rustorb/_types.py +0 -0
|
@@ -438,11 +438,11 @@ dependencies = [
|
|
|
438
438
|
|
|
439
439
|
[[package]]
|
|
440
440
|
name = "rustorb-cdr"
|
|
441
|
-
version = "0.
|
|
441
|
+
version = "0.6.0"
|
|
442
442
|
|
|
443
443
|
[[package]]
|
|
444
444
|
name = "rustorb-core"
|
|
445
|
-
version = "0.
|
|
445
|
+
version = "0.6.0"
|
|
446
446
|
dependencies = [
|
|
447
447
|
"criterion",
|
|
448
448
|
"libc",
|
|
@@ -457,7 +457,7 @@ dependencies = [
|
|
|
457
457
|
|
|
458
458
|
[[package]]
|
|
459
459
|
name = "rustorb-ffi"
|
|
460
|
-
version = "0.
|
|
460
|
+
version = "0.6.0"
|
|
461
461
|
dependencies = [
|
|
462
462
|
"rustorb-cdr",
|
|
463
463
|
"rustorb-core",
|
|
@@ -466,7 +466,7 @@ dependencies = [
|
|
|
466
466
|
|
|
467
467
|
[[package]]
|
|
468
468
|
name = "rustorb-giop"
|
|
469
|
-
version = "0.
|
|
469
|
+
version = "0.6.0"
|
|
470
470
|
dependencies = [
|
|
471
471
|
"rustorb-cdr",
|
|
472
472
|
"serde_json",
|
|
@@ -474,7 +474,7 @@ dependencies = [
|
|
|
474
474
|
|
|
475
475
|
[[package]]
|
|
476
476
|
name = "rustorb-interop"
|
|
477
|
-
version = "0.
|
|
477
|
+
version = "0.6.0"
|
|
478
478
|
dependencies = [
|
|
479
479
|
"rustorb-core",
|
|
480
480
|
"rustorb-naming",
|
|
@@ -491,14 +491,14 @@ dependencies = [
|
|
|
491
491
|
|
|
492
492
|
[[package]]
|
|
493
493
|
name = "rustorb-naming"
|
|
494
|
-
version = "0.
|
|
494
|
+
version = "0.6.0"
|
|
495
495
|
dependencies = [
|
|
496
496
|
"rustorb-core",
|
|
497
497
|
]
|
|
498
498
|
|
|
499
499
|
[[package]]
|
|
500
500
|
name = "rustorb-python"
|
|
501
|
-
version = "0.
|
|
501
|
+
version = "0.6.0"
|
|
502
502
|
dependencies = [
|
|
503
503
|
"pyo3",
|
|
504
504
|
"pyo3-build-config",
|
|
@@ -508,7 +508,7 @@ dependencies = [
|
|
|
508
508
|
|
|
509
509
|
[[package]]
|
|
510
510
|
name = "rustorb-typesupport"
|
|
511
|
-
version = "0.
|
|
511
|
+
version = "0.6.0"
|
|
512
512
|
dependencies = [
|
|
513
513
|
"rustorb-cdr",
|
|
514
514
|
]
|
|
@@ -3,7 +3,7 @@ resolver = "3"
|
|
|
3
3
|
members = ["crates/rustorb-cdr", "crates/rustorb-giop", "crates/rustorb-core", "crates/rustorb-python"]
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.6.0"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
rust-version = "1.85"
|
|
9
9
|
license = "MIT OR Apache-2.0"
|
|
@@ -13,11 +13,11 @@ keywords = ["corba", "giop", "iiop", "orb", "rpc"]
|
|
|
13
13
|
categories = ["network-programming"]
|
|
14
14
|
|
|
15
15
|
[workspace.dependencies]
|
|
16
|
-
rustorb-cdr = { path = "crates/rustorb-cdr", version = "0.
|
|
17
|
-
rustorb-typesupport = { path = "crates/rustorb-typesupport", version = "0.
|
|
18
|
-
rustorb-giop = { path = "crates/rustorb-giop", version = "0.
|
|
19
|
-
rustorb-core = { path = "crates/rustorb-core", version = "0.
|
|
20
|
-
rustorb-naming = { path = "crates/rustorb-naming", version = "0.
|
|
16
|
+
rustorb-cdr = { path = "crates/rustorb-cdr", version = "0.6.0" }
|
|
17
|
+
rustorb-typesupport = { path = "crates/rustorb-typesupport", version = "0.6.0" }
|
|
18
|
+
rustorb-giop = { path = "crates/rustorb-giop", version = "0.6.0" }
|
|
19
|
+
rustorb-core = { path = "crates/rustorb-core", version = "0.6.0" }
|
|
20
|
+
rustorb-naming = { path = "crates/rustorb-naming", version = "0.6.0" }
|
|
21
21
|
tokio = { version = "1", default-features = false }
|
|
22
22
|
|
|
23
23
|
[workspace.lints.rust]
|
|
@@ -84,6 +84,12 @@ struct Frame {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
impl Encoder {
|
|
87
|
+
/// The number of values written so far (not counting indirections):
|
|
88
|
+
/// the slot a reader gives the next new value.
|
|
89
|
+
pub fn value_count(&self) -> usize {
|
|
90
|
+
self.values.as_ref().map_or(0, |s| s.written.len())
|
|
91
|
+
}
|
|
92
|
+
|
|
87
93
|
/// Writes a `null` value.
|
|
88
94
|
pub fn write_null_value(&mut self) {
|
|
89
95
|
self.write_u32(0);
|
|
@@ -76,7 +76,7 @@ impl XcdrFormat {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/// The encapsulation identifier at the start of a payload: a format and a
|
|
79
|
-
/// byte order (DDS-XTypes Table
|
|
79
|
+
/// byte order (DDS-XTypes Table 60, Table 39; DDSI-RTPS 2.5 Table 10.3).
|
|
80
80
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
81
81
|
pub struct EncapsulationId {
|
|
82
82
|
/// The format of the top-level object.
|
|
@@ -88,18 +88,20 @@ pub struct EncapsulationId {
|
|
|
88
88
|
impl EncapsulationId {
|
|
89
89
|
/// The two octets of the identifier.
|
|
90
90
|
///
|
|
91
|
-
/// The encoding version 2 values are those of DDS-XTypes Table
|
|
92
|
-
///
|
|
93
|
-
///
|
|
94
|
-
/// are accepted by
|
|
95
|
-
/// never written
|
|
91
|
+
/// The encoding version 2 values are those of DDS-XTypes Table 60,
|
|
92
|
+
/// the RTPS encapsulation identifiers (`0x06` to `0x0b`). DDS-XTypes
|
|
93
|
+
/// Table 39 and DDSI-RTPS 2.5 Table 10.3 list other values (`0x10` to
|
|
94
|
+
/// `0x15`) for the same formats; they are accepted by
|
|
95
|
+
/// [`from_bytes`](EncapsulationId::from_bytes) but never written, as
|
|
96
|
+
/// DDS implementations in use (Cyclone DDS 0.10 among them) drop
|
|
97
|
+
/// payloads that carry them.
|
|
96
98
|
pub fn to_bytes(self) -> [u8; 2] {
|
|
97
99
|
let base = match self.format {
|
|
98
100
|
XcdrFormat::PlainCdr => 0x00,
|
|
99
101
|
XcdrFormat::PlCdr => 0x02,
|
|
100
|
-
XcdrFormat::PlainCdr2 =>
|
|
101
|
-
XcdrFormat::
|
|
102
|
-
XcdrFormat::
|
|
102
|
+
XcdrFormat::PlainCdr2 => 0x06,
|
|
103
|
+
XcdrFormat::DelimitedCdr2 => 0x08,
|
|
104
|
+
XcdrFormat::PlCdr2 => 0x0a,
|
|
103
105
|
};
|
|
104
106
|
[0x00, base | self.order.flag()]
|
|
105
107
|
}
|
|
@@ -113,9 +115,9 @@ impl EncapsulationId {
|
|
|
113
115
|
let format = match id & !1 {
|
|
114
116
|
0x00 => XcdrFormat::PlainCdr,
|
|
115
117
|
0x02 => XcdrFormat::PlCdr,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
0x06 | 0x10 => XcdrFormat::PlainCdr2,
|
|
119
|
+
0x08 | 0x14 => XcdrFormat::DelimitedCdr2,
|
|
120
|
+
0x0a | 0x12 => XcdrFormat::PlCdr2,
|
|
119
121
|
_ => return Err(Error::InvalidXcdr("unknown encapsulation identifier")),
|
|
120
122
|
};
|
|
121
123
|
// In every identifier the low bit is the byte order.
|
|
@@ -71,7 +71,8 @@ fn payload_alignment_starts_after_header() {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/// DDS-XTypes Table
|
|
74
|
+
/// DDS-XTypes Table 60 (the RTPS encapsulation identifiers), written and
|
|
75
|
+
/// read.
|
|
75
76
|
#[test]
|
|
76
77
|
fn encapsulation_identifiers() {
|
|
77
78
|
let cases = [
|
|
@@ -79,32 +80,32 @@ fn encapsulation_identifiers() {
|
|
|
79
80
|
(XcdrFormat::PlainCdr, LE, [0x00, 0x01]),
|
|
80
81
|
(XcdrFormat::PlCdr, BE, [0x00, 0x02]),
|
|
81
82
|
(XcdrFormat::PlCdr, LE, [0x00, 0x03]),
|
|
82
|
-
(XcdrFormat::PlainCdr2, BE, [0x00,
|
|
83
|
-
(XcdrFormat::PlainCdr2, LE, [0x00,
|
|
84
|
-
(XcdrFormat::
|
|
85
|
-
(XcdrFormat::
|
|
86
|
-
(XcdrFormat::
|
|
87
|
-
(XcdrFormat::
|
|
83
|
+
(XcdrFormat::PlainCdr2, BE, [0x00, 0x06]),
|
|
84
|
+
(XcdrFormat::PlainCdr2, LE, [0x00, 0x07]),
|
|
85
|
+
(XcdrFormat::DelimitedCdr2, BE, [0x00, 0x08]),
|
|
86
|
+
(XcdrFormat::DelimitedCdr2, LE, [0x00, 0x09]),
|
|
87
|
+
(XcdrFormat::PlCdr2, BE, [0x00, 0x0a]),
|
|
88
|
+
(XcdrFormat::PlCdr2, LE, [0x00, 0x0b]),
|
|
88
89
|
];
|
|
89
90
|
for (format, order, bytes) in cases {
|
|
90
91
|
let id = EncapsulationId { format, order };
|
|
91
92
|
assert_eq!(id.to_bytes(), bytes, "{id:?}");
|
|
92
93
|
assert_eq!(EncapsulationId::from_bytes(bytes).unwrap(), id);
|
|
93
94
|
}
|
|
94
|
-
// DDS-XTypes Table
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
([0x00,
|
|
98
|
-
([0x00,
|
|
99
|
-
([0x00,
|
|
100
|
-
([0x00,
|
|
101
|
-
([0x00,
|
|
95
|
+
// DDS-XTypes Table 39 and DDSI-RTPS 2.5 Table 10.3 give other values
|
|
96
|
+
// for the version 2 formats: read, never written.
|
|
97
|
+
let table39 = [
|
|
98
|
+
([0x00, 0x10], XcdrFormat::PlainCdr2, BE),
|
|
99
|
+
([0x00, 0x11], XcdrFormat::PlainCdr2, LE),
|
|
100
|
+
([0x00, 0x12], XcdrFormat::PlCdr2, BE),
|
|
101
|
+
([0x00, 0x13], XcdrFormat::PlCdr2, LE),
|
|
102
|
+
([0x00, 0x14], XcdrFormat::DelimitedCdr2, BE),
|
|
103
|
+
([0x00, 0x15], XcdrFormat::DelimitedCdr2, LE),
|
|
102
104
|
];
|
|
103
|
-
for (bytes, format, order) in
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
);
|
|
105
|
+
for (bytes, format, order) in table39 {
|
|
106
|
+
let id = EncapsulationId { format, order };
|
|
107
|
+
assert_eq!(EncapsulationId::from_bytes(bytes).unwrap(), id);
|
|
108
|
+
assert_ne!(id.to_bytes(), bytes);
|
|
108
109
|
}
|
|
109
110
|
// XML and unknown identifiers.
|
|
110
111
|
for bytes in [[0x00, 0x04], [0x01, 0x00], [0x00, 0x20]] {
|
|
@@ -210,7 +211,7 @@ fn dheader() {
|
|
|
210
211
|
enc.end_dheader(mark).unwrap();
|
|
211
212
|
enc.write_octet(0xEE);
|
|
212
213
|
let bytes = enc.finish_xcdr_payload();
|
|
213
|
-
assert_eq!(&bytes[..8], [0x00,
|
|
214
|
+
assert_eq!(&bytes[..8], [0x00, 0x09, 0x00, 0x03, 20, 0, 0, 0]);
|
|
214
215
|
|
|
215
216
|
// An older reader knows the first two members only.
|
|
216
217
|
let (mut dec, _) = Decoder::xcdr_payload(&bytes).unwrap();
|
|
@@ -262,7 +263,7 @@ fn emheader() {
|
|
|
262
263
|
let bytes = enc.finish_xcdr_payload();
|
|
263
264
|
#[rustfmt::skip]
|
|
264
265
|
let expected = [
|
|
265
|
-
0x00,
|
|
266
|
+
0x00, 0x0a, 0x00, 0x01,
|
|
266
267
|
0x00, 0x00, 0x00, 51, // DHEADER
|
|
267
268
|
0x00, 0x00, 0x00, 0x01, 0xAA, 0x00, 0x00, 0x00, // LC 0, id 1
|
|
268
269
|
0x90, 0x00, 0x00, 0x02, 0xBB, 0xBB, 0x00, 0x00, // M_FLAG, LC 1, id 2
|
|
@@ -522,7 +523,7 @@ fn optional_members() {
|
|
|
522
523
|
assert_eq!(
|
|
523
524
|
enc.finish_xcdr_payload(),
|
|
524
525
|
[
|
|
525
|
-
0x00,
|
|
526
|
+
0x00, 0x06, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x05
|
|
526
527
|
]
|
|
527
528
|
);
|
|
528
529
|
}
|
|
@@ -25,12 +25,12 @@ use std::time::{Duration, Instant};
|
|
|
25
25
|
use rustorb_cdr::ByteOrder;
|
|
26
26
|
use rustorb_giop::{Message, MessageEncoder, OutMessage, ServiceContext, Version};
|
|
27
27
|
use tokio::io::AsyncWriteExt;
|
|
28
|
-
use tokio::net::TcpSocket;
|
|
29
|
-
use tokio::net::tcp::OwnedWriteHalf;
|
|
28
|
+
use tokio::net::{TcpSocket, TcpStream};
|
|
30
29
|
use tokio::sync::oneshot;
|
|
31
30
|
|
|
32
31
|
use crate::idle::Stamp;
|
|
33
32
|
use crate::server::{Outbox, Server, ServerConn};
|
|
33
|
+
use crate::sock::{Stream, WriteHalf};
|
|
34
34
|
use crate::tls::{self, Tls};
|
|
35
35
|
use crate::trace;
|
|
36
36
|
use crate::wire::{Here, Inbound, ReadError};
|
|
@@ -65,9 +65,21 @@ pub(crate) enum SendError {
|
|
|
65
65
|
Closing,
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
/// What
|
|
69
|
-
|
|
70
|
-
pub(crate)
|
|
68
|
+
/// What a connection runs over.
|
|
69
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
70
|
+
pub(crate) enum Transport {
|
|
71
|
+
/// Plain TCP (`giop:tcp`).
|
|
72
|
+
Tcp,
|
|
73
|
+
/// TLS over TCP (`giop:ssl`, SSLIOP).
|
|
74
|
+
Tls,
|
|
75
|
+
/// A Unix domain socket (omniORB's `giop:unix`); the host is the path
|
|
76
|
+
/// of the socket and the port 0.
|
|
77
|
+
Unix,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// What the ORB pools connections by: host (or socket path), port, and
|
|
81
|
+
/// the transport.
|
|
82
|
+
pub(crate) type EndpointKey = (String, u16, Transport);
|
|
71
83
|
|
|
72
84
|
/// The ORB's client connections, one per endpoint.
|
|
73
85
|
pub(crate) type ConnectionPool = Mutex<HashMap<EndpointKey, Arc<Connection>>>;
|
|
@@ -84,7 +96,7 @@ struct Pending {
|
|
|
84
96
|
/// Where a connection writes its requests.
|
|
85
97
|
enum Writer {
|
|
86
98
|
/// A stream of its own (a connection this ORB opened).
|
|
87
|
-
Stream(tokio::sync::Mutex<
|
|
99
|
+
Stream(tokio::sync::Mutex<WriteHalf>),
|
|
88
100
|
/// The outbox of a server connection a client offered for
|
|
89
101
|
/// bidirectional GIOP.
|
|
90
102
|
Outbox(Arc<Outbox>),
|
|
@@ -140,61 +152,48 @@ pub(crate) struct Connection {
|
|
|
140
152
|
}
|
|
141
153
|
|
|
142
154
|
impl Connection {
|
|
143
|
-
/// Connects to `host:port`, with TLS when `tls` is given,
|
|
144
|
-
///
|
|
145
|
-
///
|
|
155
|
+
/// Connects to `host:port`, with TLS when `tls` is given, or to the
|
|
156
|
+
/// Unix socket at the path `host` with `unix`, and starts the reader
|
|
157
|
+
/// task on the current runtime. The socket buffers are set before
|
|
158
|
+
/// connecting, so that the window scale fits them.
|
|
146
159
|
pub(crate) async fn connect(
|
|
147
160
|
host: &str,
|
|
148
161
|
port: u16,
|
|
162
|
+
unix: bool,
|
|
149
163
|
tls: Option<Arc<rustls::ClientConfig>>,
|
|
150
164
|
options: &OrbOptions,
|
|
151
165
|
pool: Weak<ConnectionPool>,
|
|
152
166
|
) -> io::Result<Arc<Connection>> {
|
|
153
167
|
let max_message_size = options.max_message_size;
|
|
154
|
-
let
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
};
|
|
162
|
-
if let Some(size) = options.socket_send_buffer {
|
|
163
|
-
socket.set_send_buffer_size(u32::try_from(size).unwrap_or(u32::MAX))?;
|
|
164
|
-
}
|
|
165
|
-
if let Some(size) = options.socket_receive_buffer {
|
|
166
|
-
socket.set_recv_buffer_size(u32::try_from(size).unwrap_or(u32::MAX))?;
|
|
167
|
-
}
|
|
168
|
-
match socket.connect(addr).await {
|
|
169
|
-
Ok(stream) => {
|
|
170
|
-
connected = Some(stream);
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
Err(e) => {
|
|
174
|
-
trace::info!("could not connect to {addr} ({host}:{port}): {e}");
|
|
175
|
-
last = e;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
let stream = connected.ok_or(last)?;
|
|
180
|
-
stream.set_nodelay(true)?;
|
|
181
|
-
let session = match tls {
|
|
182
|
-
Some(config) => match tls::connect(&stream, config, host).await {
|
|
168
|
+
let stream = if unix {
|
|
169
|
+
connect_unix(host, options).await?
|
|
170
|
+
} else {
|
|
171
|
+
Stream::Tcp(connect_tcp(host, port, options).await?)
|
|
172
|
+
};
|
|
173
|
+
let session = match (tls, stream.tcp()) {
|
|
174
|
+
(Some(config), Some(tcp)) => match tls::connect(tcp, config, host).await {
|
|
183
175
|
Ok(session) => Some(session),
|
|
184
176
|
Err(e) => {
|
|
185
177
|
trace::info!("TLS handshake with {host}:{port} failed: {e}");
|
|
186
178
|
return Err(e);
|
|
187
179
|
}
|
|
188
180
|
},
|
|
189
|
-
|
|
181
|
+
_ => None,
|
|
190
182
|
};
|
|
183
|
+
let transport = match (unix, session.is_some()) {
|
|
184
|
+
(true, _) => Transport::Unix,
|
|
185
|
+
(false, true) => Transport::Tls,
|
|
186
|
+
(false, false) => Transport::Tcp,
|
|
187
|
+
};
|
|
188
|
+
let endpoint = (host.to_owned(), port, transport);
|
|
191
189
|
trace::info!(
|
|
192
|
-
"connected to {
|
|
190
|
+
"connected to {}{}",
|
|
191
|
+
Peer(&endpoint),
|
|
193
192
|
if session.is_some() { " with TLS" } else { "" }
|
|
194
193
|
);
|
|
195
194
|
let (reader, writer) = stream.into_split();
|
|
196
195
|
let conn = Arc::new(Connection {
|
|
197
|
-
endpoint
|
|
196
|
+
endpoint,
|
|
198
197
|
inbound: Arc::new(Inbound::new(reader, session.clone(), max_message_size)),
|
|
199
198
|
writer: Writer::Stream(tokio::sync::Mutex::new(writer)),
|
|
200
199
|
tls: session,
|
|
@@ -574,7 +573,7 @@ impl Connection {
|
|
|
574
573
|
async fn send_tls(
|
|
575
574
|
&self,
|
|
576
575
|
tls: &Tls,
|
|
577
|
-
writer: &
|
|
576
|
+
writer: &WriteHalf,
|
|
578
577
|
msg: &OutMessage,
|
|
579
578
|
deadline: Option<Instant>,
|
|
580
579
|
) -> Result<(), SendError> {
|
|
@@ -697,13 +696,69 @@ impl Connection {
|
|
|
697
696
|
}
|
|
698
697
|
}
|
|
699
698
|
|
|
699
|
+
/// Opens a TCP connection to `host:port`, trying each address in turn.
|
|
700
|
+
async fn connect_tcp(host: &str, port: u16, options: &OrbOptions) -> io::Result<TcpStream> {
|
|
701
|
+
let mut last = io::Error::new(io::ErrorKind::NotFound, "no address");
|
|
702
|
+
for addr in tokio::net::lookup_host((host, port)).await? {
|
|
703
|
+
let socket = if addr.is_ipv4() {
|
|
704
|
+
TcpSocket::new_v4()?
|
|
705
|
+
} else {
|
|
706
|
+
TcpSocket::new_v6()?
|
|
707
|
+
};
|
|
708
|
+
if let Some(size) = options.socket_send_buffer {
|
|
709
|
+
socket.set_send_buffer_size(u32::try_from(size).unwrap_or(u32::MAX))?;
|
|
710
|
+
}
|
|
711
|
+
if let Some(size) = options.socket_receive_buffer {
|
|
712
|
+
socket.set_recv_buffer_size(u32::try_from(size).unwrap_or(u32::MAX))?;
|
|
713
|
+
}
|
|
714
|
+
match socket.connect(addr).await {
|
|
715
|
+
Ok(stream) => {
|
|
716
|
+
stream.set_nodelay(true)?;
|
|
717
|
+
return Ok(stream);
|
|
718
|
+
}
|
|
719
|
+
Err(e) => {
|
|
720
|
+
trace::info!("could not connect to {addr} ({host}:{port}): {e}");
|
|
721
|
+
last = e;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
Err(last)
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/// Opens a connection to the Unix socket at `path`.
|
|
729
|
+
#[cfg(unix)]
|
|
730
|
+
async fn connect_unix(path: &str, options: &OrbOptions) -> io::Result<Stream> {
|
|
731
|
+
let stream = match tokio::net::UnixStream::connect(path).await {
|
|
732
|
+
Ok(stream) => stream,
|
|
733
|
+
Err(e) => {
|
|
734
|
+
trace::info!("could not connect to unix:{path}: {e}");
|
|
735
|
+
return Err(e);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
let socket = socket2::SockRef::from(&stream);
|
|
739
|
+
if let Some(size) = options.socket_send_buffer {
|
|
740
|
+
socket.set_send_buffer_size(size)?;
|
|
741
|
+
}
|
|
742
|
+
if let Some(size) = options.socket_receive_buffer {
|
|
743
|
+
socket.set_recv_buffer_size(size)?;
|
|
744
|
+
}
|
|
745
|
+
Ok(Stream::Unix(stream))
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
#[cfg(not(unix))]
|
|
749
|
+
async fn connect_unix(_: &str, _: &OrbOptions) -> io::Result<Stream> {
|
|
750
|
+
Err(io::ErrorKind::Unsupported.into())
|
|
751
|
+
}
|
|
752
|
+
|
|
700
753
|
/// The server of a connection in trace lines.
|
|
701
|
-
struct Peer<'a>(&'a EndpointKey);
|
|
754
|
+
pub(crate) struct Peer<'a>(pub(crate) &'a EndpointKey);
|
|
702
755
|
|
|
703
756
|
impl std::fmt::Display for Peer<'_> {
|
|
704
757
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
705
|
-
|
|
706
|
-
|
|
758
|
+
match self.0 {
|
|
759
|
+
(path, _, Transport::Unix) => write!(f, "unix:{path}"),
|
|
760
|
+
(host, port, _) => write!(f, "{host}:{port}"),
|
|
761
|
+
}
|
|
707
762
|
}
|
|
708
763
|
}
|
|
709
764
|
|
|
@@ -73,11 +73,14 @@ pub mod policy;
|
|
|
73
73
|
mod pool;
|
|
74
74
|
mod servant;
|
|
75
75
|
mod server;
|
|
76
|
+
mod sock;
|
|
76
77
|
mod stream;
|
|
77
78
|
mod timeout;
|
|
78
79
|
mod tls;
|
|
79
80
|
pub mod trace;
|
|
80
81
|
pub mod typecode;
|
|
82
|
+
#[cfg(unix)]
|
|
83
|
+
mod unix;
|
|
81
84
|
mod value;
|
|
82
85
|
mod wire;
|
|
83
86
|
|
|
@@ -91,8 +94,8 @@ pub use object::{AsyncRequest, CallbackRequest, ObjectRef, Reply, Request};
|
|
|
91
94
|
pub use orb::{ClientAuth, EndpointAddr, Orb, OrbOptions, ResolveError, TlsOptions};
|
|
92
95
|
pub use poa::{
|
|
93
96
|
Bidirectional, IdAssignment, IdUniqueness, ImplicitActivation, Lifespan, ObjectId, Poa,
|
|
94
|
-
PoaCurrent, PoaError, PoaManager, PoaManagerState, Policies, Policy,
|
|
95
|
-
ServantRetention, ThreadPolicy,
|
|
97
|
+
PoaCurrent, PoaError, PoaManager, PoaManagerFactory, PoaManagerState, Policies, Policy,
|
|
98
|
+
RequestProcessing, ServantRetention, ThreadPolicy,
|
|
96
99
|
};
|
|
97
100
|
pub use policy::{PolicyError, PolicyType, PolicyValue, SetOverrideType};
|
|
98
101
|
pub use rustorb_cdr as cdr;
|
|
@@ -107,7 +110,7 @@ pub use stream::{InStream, OutStream};
|
|
|
107
110
|
pub use timeout::{set_thread_call_timeout, thread_call_timeout};
|
|
108
111
|
pub use typecode::{TCKind, TypeCode, TypeCodeError};
|
|
109
112
|
pub use value::{
|
|
110
|
-
Any, CustomReader, Native, Value, ValueRef, ValueTypeResolver, lookup_value_type,
|
|
113
|
+
Any, CustomReader, Native, Value, ValueRef, ValueTypeResolver, WeakValueRef, lookup_value_type,
|
|
111
114
|
register_custom_reader, register_value_type, set_value_type_resolver, unregister_custom_reader,
|
|
112
115
|
unregister_value_type,
|
|
113
116
|
};
|