commit | 24db71fbb553c056f887be1eaafd10e2c7dd1f3f | [log] [tgz] |
---|---|---|
author | Jeremy Kerr <jk@ozlabs.org> | Thu Feb 07 21:37:35 2019 +0800 |
committer | Jeremy Kerr <jk@ozlabs.org> | Fri Feb 08 10:03:00 2019 +0800 |
tree | 93085934115f887f77feacef79d06cabf0973a59 | |
parent | 73d8bc801d7470da3674456d0b7c97f7ff82ec60 [diff] |
core: implement packetisation and reassembly Add a naive implementation of packetisation and reassembly of MCTP messages. We use a (unbounded!) message buffer for reception, and a queue of messages for transmission. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
This library is intended to be a portable implementation of the Management Component Transport Protocol (MCTP), as defined by DMTF standard "DSP0236", plus transport binding specifications.
Currently, the library is is only at prototyping stage. Interfaces will likely change, and are missing lots of components of the standard.
To initialise the MCTP stack with a single hardware bus:
mctp = mctp_init()
: Initialise the MCTP corebinding = mctp_<binding>_init()
: Initialise a hardware bindingmctp_register_bus(mctp, binding, eid)
: Register the hardware binding with the core, using a predefined EIDThen, register a function call to be invoked when a message is received:
mctp_set_rx_all(mctp, function)
: Provide a callback to be invoked when a MCTP message is receivedOr transmit a message:
mctp_message_tx(mctp, message, len)
: Transmit a MCTP messageThe binding may require you to notify it to receive packets. For example, for the serial binding, the mctp_serial_read()
function should be invoked when the file-descriptor for the serial device has data available.
This library is intended to be portable to be used in a range of environments, but the main targets are:
For the latter, we need to support customisation of the functions that libmctp uses (for example, POSIX file IO is not available).
In order to support these, we have a couple of compile-time definitions:
MCTP_FILEIO
: define if POSIX file io is available, allowing the serial hardware binding to access char devices for IO.
MCTP_LOG_
: allows selection of a logging backend. Currently available are:
MCTP_LOG_STDERR
: use fprintf(stderr, ...)
for log output
MCTP_LOG_SYSLOG
: use syslog()
for log output
MCTP_LOG_CUSTOM
: provide your own macro for logging, of the format: #define mctp_prlog(level, fmt, ...) (....)