Crate mctp_linux

Source
Expand description

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)?;

MctpLinuxEp 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.

Structs§

MctpAddr
Helper for applications taking an MCTP address as an argument, configuration, etc.
MctpLinuxEp
Encapsulation of a remote endpoint: a socket and an Endpoint ID.
MctpSockAddr
Address information for a socket
MctpSocket
MCTP socket object.

Constants§

MCTP_NET_ANY
Special value for Network ID: any network. May be used in bind().