The doip_rw crate provides a set of encoders and decoders for Diagnostics Over Internet Protocol (DoIP) messages.
The encoding and decoding are supported by synchronous IO such as Reader and Writer.
For asynchronous IO, only DiagnosticMessage struct should be augmented, as the other messages are always very small.
- zero copy serialization/deserialization
- deserialization "in place" to replace an existing DoIP payload
- for larger messages such as
DiagnosticMessageboth owned and borrowed buffer are available
Add the following to your Cargo.toml:
[dependencies]
doip_rw = "0.1.0"A simple synchronous client example is provided in simple_client It can be run against a DoIP server on localhost, tcp port 13400, by invoking:
cargo run --example simple_client
A simple vehicle announcement would look like :
let udp = UdpSocket::bind("0.0.0.0:13400").unwrap();
let mut vin: Vin = [0u8; 17];
vin.copy_from_slice("VF1YYYYYZTT ".as_bytes());
let announce = VehicleIdentificationResponse {
vin,
logical_address: 0xed00,
eid: [0xaa, 0xbb, 0xcc, 0xdd, 0x00, 0x38],
gid: None,
further_action: FurtherActionRequired::NoFurtherActionRequired,
vin_gid_sync_status: VinGidSyncStatus::Synchronized,
};
let mut buf = vec![];
write_message(&announce, &mut Cursor::new(&mut buf)).unwrap();
udp.set_broadcast(true).unwrap();
udp.send_to(&buf, "255.255.255.255:13400").unwrap();Comprehensive API documentation is available on docs.rs.
Contributions are welcome! Feel free to open issues, submit pull requests, or suggest features. Please follow the Rust Code of Conduct when contributing.
This project is licensed under the MIT License. See the LICENSE file for details.