Crate someip_rs

Crate someip_rs 

Source
Expand description

SOME/IP protocol implementation built on std::net.

This crate provides a synchronous implementation of the SOME/IP (Scalable service-Oriented MiddlewarE over IP) protocol, commonly used in automotive applications.

§Features

  • Complete SOME/IP message header support
  • TCP and UDP transport layers
  • Type-safe service, method, client, and session IDs
  • Request/response pattern support
  • Fire-and-forget (notification) messages

§Example

use someip_rs::{SomeIpMessage, ServiceId, MethodId, ClientId, SessionId};
use someip_rs::transport::TcpClient;

// Create a request message
let request = SomeIpMessage::request(ServiceId(0x1234), MethodId(0x0001))
    .client_id(ClientId(0x0100))
    .payload(b"hello".as_slice())
    .build();

// Send via TCP and receive response
let mut client = TcpClient::connect("127.0.0.1:30490").unwrap();
let response = client.call(request).unwrap();

println!("Response: {:?}", response.payload);

§Protocol Overview

SOME/IP messages consist of a 16-byte header followed by an optional payload:

+--------+--------+--------+--------+
|    Service ID   |   Method ID     |  (4 bytes)
+--------+--------+--------+--------+
|           Length                  |  (4 bytes)
+--------+--------+--------+--------+
|    Client ID    |   Session ID    |  (4 bytes)
+--------+--------+--------+--------+
|Proto|Iface|MsgType|RetCode|        (4 bytes)
+--------+--------+--------+--------+
|           Payload ...             |  (variable)
+--------+--------+--------+--------+

Re-exports§

pub use error::Result;
pub use error::SomeIpError;
pub use header::ClientId;
pub use header::MethodId;
pub use header::ServiceId;
pub use header::SessionId;
pub use header::SomeIpHeader;
pub use header::HEADER_SIZE;
pub use message::MessageBuilder;
pub use message::SomeIpMessage;
pub use types::MessageType;
pub use types::ReturnCode;
pub use types::PROTOCOL_VERSION;

Modules§

codec
SOME/IP message framing and codec utilities.
error
Error types for SOME/IP operations.
header
SOME/IP header types and ID newtypes.
message
SOME/IP message handling.
transport
Transport layer implementations for SOME/IP.
types
Core SOME/IP types and constants.