#dlt #autosar

no-std dlt_parse

A library for parsing the "Diagnostic Log and Trace" network protocol (currently without payload interpretation)

10 releases (6 breaking)

0.7.2 May 8, 2023
0.7.1 Jan 24, 2023
0.6.0 Jan 23, 2023
0.5.1 Jan 23, 2023
0.1.0 Feb 10, 2019

#572 in Network programming

Download history 20/week @ 2023-01-29 16/week @ 2023-02-05 23/week @ 2023-02-12 34/week @ 2023-02-19 46/week @ 2023-02-26 13/week @ 2023-03-05 1/week @ 2023-03-12 2/week @ 2023-03-19 16/week @ 2023-03-26 12/week @ 2023-04-02 74/week @ 2023-04-09 34/week @ 2023-04-16 16/week @ 2023-04-23 12/week @ 2023-04-30 73/week @ 2023-05-07 6/week @ 2023-05-14

107 downloads per month


3.5K SLoC

Crates.io docs.rs build status github build status appveyor build status gitlab codecov


A zero allocation rust library for basic parsing & writing DLT (Diagnostic Log and Trace) packets. Currently only the parsing and writing of the header is supported (excluding the verbose packet definitions).


First, add the following to your Cargo.toml:

dlt_parse = "0.7.2"

Next, add this to your crate:

use dlt_parse;

What is dlt_parse?

dlt_parse is a library that aims to provide serialisation & deserialisation funtions for DLT (Diagnostic Log and Trace) packets. It should make it possible to anlyse recordings of DLT packets as fast as possible, as well as writing servers that send DLT packets to the network.

Some key points are:

  • It is completly written in Rust and thoroughly tested.
  • Special attention has been paid to not use allocations or syscalls.
  • It is possible to use the crate in an no-std environment.
  • The package is still in development and can & will still change.
  • Methods for parsing verbose DLT packets are still missing (but maybe will be implemented in future versions).

Example: Serializing & Slicing/Deserializing DLT Packets

In this example a non verbose DLT packet is serialized and deserialized again. Specificly the serialized packet is converted into a DltPacketSlice. This has the advantage, that not all fields have to be deserialied to access the payload or specific fields in the header. Note that it is also possible to completely deserialize DLT headers with the DltHeader::read function. This can make sense, if most fields of the header are used anyways.

use self::dlt_parse::{DltHeader, DltLogLevel, DltExtendedHeader, SliceIterator};

let header = {
    let mut header = DltHeader {
        is_big_endian: true, //payload & message id are encoded with big endian
        version: 0,
        message_counter: 0,
        ecu_id: None,
        session_id: None,
        timestamp: None,
        extended_header: Some(DltExtendedHeader::new_non_verbose_log(
            [b'a', b'p', b'p', b'i'],//application id
            [b'c', b't', b'x', b'i'],//context id
    header.length = header.header_len() + 4 + 4; //header + message id + payload


//buffer to store serialized header & payload
let mut buffer = Vec::<u8>::with_capacity(usize::from(header.length));
header.write(&mut buffer).unwrap();

//write payload (message id 1234 & non verbose payload)
    //for write_all
    use std::io::Write;

    //write the message id & payload
    buffer.write_all(&1234u32.to_be_bytes()).unwrap(); //message id
    buffer.write_all(&[5,6,7,9]); //payload

//packets can contain multiple dlt messages, iterate through them
for dlt_message in SliceIterator::new(&buffer) {
    match dlt_message {
        Ok(dlt_slice) => {
            //check if the message is verbose or non verbose (non verbose messages have message ids)
            if let Some((message_id, non_verbose_payload)) = dlt_slice.message_id_and_payload() {
                println!("non verbose message {:x}", message_id);
                println!("  with payload {:?}", non_verbose_payload);
            } else {
                println!("verbose message (parsing not yet supported)");
        Err(err) => {
            //error parsing the dlt packet
            println!("ERROR: {:?}", err);

An complete example which includes the parsing of the ethernet & udp headers can be found in examples/print_messages_ids.rs



Licensed under either of Apache License, Version 2.0 or MIT license at your option. The corresponding license texts can be found in the LICENSE-APACHE file and the LICENSE-MIT file.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.