doip_sockets/lib.rs
1#![warn(unused_extern_crates)]
2#![warn(missing_docs)]
3//! Simple socket implementations which wrap Tokio Sockets with a codec for
4//! Diagnostics over Internet Protocol.
5//!
6//! This crate is built for those wants strong type checking for sending and receiving DoIP messages
7//! from sockets. Each UDP or TCP IO has typed alongside it the supported messaging formats so only
8//! those payloads can be sent. This reduces the number of error paths which users code can go down.
9//!
10//! Each socket implementation is light, there is not a 1:1 with the Tokio sockets,
11//! however users can access the inner Framed and then Tokio sockets through helper methods.
12//!
13//! Along side the sockets this crate include the ability to create a config
14//! currently of which is solely limited to the version of the protocol used,
15//! however can be extended in future version.
16
17use doip_definitions::header::DoipVersion;
18mod error;
19
20/// Simple TCP Stream and Split implentation for a TCP Stream allowing the conversion of a
21/// socket into a stream for Codec use, or the creating of a new TCP Stream
22/// from scratch.
23pub mod tcp;
24
25/// Simple UDP Socket implementation for UDP communication.
26pub mod udp;
27
28/// Configuration for UDP and TCP Sockets
29///
30/// This provides the methods within each struct with constants which can be set
31/// during a typical usage with DoIP such as the protocol_version.
32#[derive(Debug, Copy, Clone)]
33pub struct SocketConfig {
34 protocol_version: DoipVersion,
35}