someip_rs/
lib.rs

1//! SOME/IP protocol implementation built on std::net.
2//!
3//! This crate provides a synchronous implementation of the SOME/IP
4//! (Scalable service-Oriented MiddlewarE over IP) protocol, commonly
5//! used in automotive applications.
6//!
7//! # Features
8//!
9//! - Complete SOME/IP message header support
10//! - TCP and UDP transport layers
11//! - Type-safe service, method, client, and session IDs
12//! - Request/response pattern support
13//! - Fire-and-forget (notification) messages
14//!
15//! # Example
16//!
17//! ```no_run
18//! use someip_rs::{SomeIpMessage, ServiceId, MethodId, ClientId, SessionId};
19//! use someip_rs::transport::TcpClient;
20//!
21//! // Create a request message
22//! let request = SomeIpMessage::request(ServiceId(0x1234), MethodId(0x0001))
23//!     .client_id(ClientId(0x0100))
24//!     .payload(b"hello".as_slice())
25//!     .build();
26//!
27//! // Send via TCP and receive response
28//! let mut client = TcpClient::connect("127.0.0.1:30490").unwrap();
29//! let response = client.call(request).unwrap();
30//!
31//! println!("Response: {:?}", response.payload);
32//! ```
33//!
34//! # Protocol Overview
35//!
36//! SOME/IP messages consist of a 16-byte header followed by an optional payload:
37//!
38//! ```text
39//! +--------+--------+--------+--------+
40//! |    Service ID   |   Method ID     |  (4 bytes)
41//! +--------+--------+--------+--------+
42//! |           Length                  |  (4 bytes)
43//! +--------+--------+--------+--------+
44//! |    Client ID    |   Session ID    |  (4 bytes)
45//! +--------+--------+--------+--------+
46//! |Proto|Iface|MsgType|RetCode|        (4 bytes)
47//! +--------+--------+--------+--------+
48//! |           Payload ...             |  (variable)
49//! +--------+--------+--------+--------+
50//! ```
51
52pub mod codec;
53pub mod error;
54pub mod header;
55pub mod message;
56pub mod transport;
57pub mod types;
58
59// Re-export commonly used types at the crate root
60pub use error::{Result, SomeIpError};
61pub use header::{ClientId, MethodId, ServiceId, SessionId, SomeIpHeader, HEADER_SIZE};
62pub use message::{MessageBuilder, SomeIpMessage};
63pub use types::{MessageType, ReturnCode, PROTOCOL_VERSION};