2 unstable releases

0.2.0 Jun 9, 2025
0.1.0 Jun 24, 2024

#682 in Unix APIs

Download history

82 downloads per month
Used in pldm-fw-cli

MIT/Apache

36KB
603 lines

Interface for the Linux socket-based MCTP support.

This crate provides some minimal wrappers around standard libc socket operations, using MCTP-specific addressing structures.

MctpSocket provides support for blocking socket operations sendto, recvfrom and bind.

use mctp_linux;

let sock = mctp_linux::MctpSocket::new()?;
let bind_addr = mctp_linux::MctpSockAddr::new(
    mctp::MCTP_ADDR_ANY.0,
    mctp_linux::MCTP_NET_ANY,
    1,
    0
);
sock.bind(&bind_addr)?;

let mut buf = [0; 64];
let (len, src) = sock.recvfrom(&mut buf)?;

MctpLinuxReq provides a thin wrapper that represents a remote endpoint, referenced by EID. It creates a single socket for communication with that endpoint. This is a convenience for simple consumers that perform single-endpoint communication; general MCTP requesters may want a different socket model.


Management Component Transport Protocol (MCTP) using Linux sockets

This crate provides an implementation of the mctp base crate, using Linux socket support for MCTP messsaging.

See https://codeconstruct.com.au/docs/mctp-on-linux-introduction/ for an overview on the kernel sockets support.

Using the standard sockets API, we implement the mctp::ReqChannel and mctp::Listener traits, allowing upper layers to implement MCTP applications without needing further details of the sockets interface.

Dependencies

~42KB