{"id":13438441,"url":"https://github.com/JulianSchmid/dlt-parse-rs","last_synced_at":"2025-03-20T05:31:58.933Z","repository":{"id":51164886,"uuid":"148987082","full_name":"JulianSchmid/dlt-parse-rs","owner":"JulianSchmid","description":"Rust DLT (Diagnostic Log and Trace) packet parser","archived":false,"fork":false,"pushed_at":"2024-07-01T05:54:34.000Z","size":607,"stargazers_count":31,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-14T20:55:23.523Z","etag":null,"topics":["autosar","packet-parser","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JulianSchmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-16T11:00:02.000Z","updated_at":"2024-12-18T14:38:00.000Z","dependencies_parsed_at":"2024-03-27T07:43:50.989Z","dependency_job_id":"ec1e16ce-4f11-4615-bcae-78b52ebfba07","html_url":"https://github.com/JulianSchmid/dlt-parse-rs","commit_stats":{"total_commits":106,"total_committers":2,"mean_commits":53.0,"dds":"0.018867924528301883","last_synced_commit":"d7fe36acecdfdf07e494ba5770a574dd5186e924"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianSchmid%2Fdlt-parse-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianSchmid%2Fdlt-parse-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianSchmid%2Fdlt-parse-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JulianSchmid%2Fdlt-parse-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JulianSchmid","download_url":"https://codeload.github.com/JulianSchmid/dlt-parse-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244560314,"owners_count":20472217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autosar","packet-parser","rust"],"created_at":"2024-07-31T03:01:05.549Z","updated_at":"2025-03-20T05:31:58.623Z","avatar_url":"https://github.com/JulianSchmid.png","language":"Rust","funding_links":[],"categories":["Libraries","库","库 Libraries"],"sub_categories":["Automotive","汽车","汽车 Automotive"],"readme":"[![Crates.io](https://img.shields.io/crates/v/dlt_parse.svg)](https://crates.io/crates/dlt_parse)\n[![docs.rs](https://docs.rs/dlt_parse/badge.svg)](https://docs.rs/dlt_parse)\n[![build status github](https://github.com/JulianSchmid/dlt-parse-rs/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/JulianSchmid/dlt-parse-rs/actions/workflows/main.yml)\n[![build status gitlab](https://gitlab.com/julian.schmid/dlt-parse-rs/badges/main/pipeline.svg)](https://gitlab.com/julian.schmid/dlt-parse-rs/-/commits/main)\n[![codecov](https://codecov.io/gh/JulianSchmid/dlt-parse-rs/branch/main/graph/badge.svg?token=D1LANr6nox)](https://codecov.io/gh/JulianSchmid/dlt-parse-rs)\n\n# dlt_parse\n\nA zero allocation rust library for basic parsing \u0026 writing DLT (Diagnostic Log and Trace)\npackets. Currently only the parsing and writing of the header is supported \u0026 parsing of verbose messages.\n\n## Usage:\n\nBy default `serde` is disabled and `std` is enabled if you add `dlt_parse` as dependency to your `Cargo.toml`:\n\n```toml\n[dependencies]\ndlt_parse = \"0.10.0\"\n```\n\nIf you additionally want `serde` support you will have to activate the `serde` feature:\n\n```toml\n[dependencies]\ndlt_parse = { version = \"0.10.0\", features = [\"serde\"] }\n```\n\nIf you want to use the crate in `no_std` mode you will have to disable the default features:\n\n```toml\n[dependencies]\ndlt_parse = { version = \"0.10.0\", default-features = false }\n```\n\n## What is dlt_parse?\ndlt_parse is a library that aims to provide serialisation \u0026 deserialisation funtions for DLT (Diagnostic Log and Trace) packets.\nIt should make it possible to anlyse recordings of DLT packets as fast as possible, as well as writing servers\nthat send DLT packets to the network.\n\nSome key points are:\n\n* It is completly written in Rust and thoroughly tested.\n* Special attention has been paid to not use allocations or syscalls.\n* It is possible to use the crate in an `no-std` environment.\n* The package is still in development and can \u0026 will still change.\n\n## Example: Serializing \u0026 Slicing/Deserializing DLT Packets\n\nIn this example a non verbose DLT packet is serialized and deserialized again. Specificly the serialized packet is\nconverted into a DltPacketSlice. This has the advantage, that not all fields have to be deserialied to\naccess the payload or specific fields in the header. Note that it is also possible to completely deserialize\nDLT headers with the DltHeader::read function. This can make sense, if most fields of the header are used anyways.\n\n```rust\nuse self::dlt_parse::{DltHeader, DltLogLevel, DltExtendedHeader, SliceIterator};\n\nlet header = {\n    let mut header = DltHeader {\n        is_big_endian: true, // payload \u0026 message id are encoded with big endian\n        message_counter: 0,\n        length: 0,\n        ecu_id: None,\n        session_id: None,\n        timestamp: None,\n        extended_header: Some(DltExtendedHeader::new_non_verbose_log(\n            DltLogLevel::Debug,\n            [b'a', b'p', b'p', b'i'],// application id\n            [b'c', b't', b'x', b'i'],// context id\n        ))\n    };\n    header.length = header.header_len() + 4 + 4; // header + message id + payload\n\n    header\n};\n\n// buffer to store serialized header \u0026 payload\nlet mut buffer = Vec::\u003cu8\u003e::with_capacity(usize::from(header.length));\nbuffer.extend_from_slice(\u0026header.to_bytes());\n\n// write payload (message id 1234 \u0026 non verbose payload)\n{\n    // for write_all\n    use std::io::Write;\n\n    // write the message id \u0026 payload\n    buffer.write_all(\u00261234u32.to_be_bytes()).unwrap(); // message id\n    buffer.write_all(\u0026[5,6,7,9]); // payload\n}\n\n// packets can contain multiple dlt messages, iterate through them\nfor dlt_message in SliceIterator::new(\u0026buffer) {\n    match dlt_message {\n        Ok(dlt_slice) =\u003e {\n            // check what type of message was received\n            match dlt_slice.typed_payload() {\n                Ok(typed_payload) =\u003e {\n                    use dlt_parse::DltTypedPayload::*;\n                    match typed_payload {\n                        UnknownNv(p) =\u003e {\n                            println!(\n                                \"non verbose message 0x{:x} (unknown) with {} bytes of payload.\",\n                                p.msg_id,\n                                p.payload.len(),\n                            );\n                        }\n                        LogNv(p) =\u003e {\n                            println!(\n                                \"non verbose log message 0x{:x} with log level {:?} and {} bytes of payload.\",\n                                p.msg_id,\n                                p.log_level,\n                                p.payload.len(),\n                            );\n                        }\n                        LogV(p) =\u003e {\n                            println!(\n                                \"verbose log message with log level {:?} and values:\",\n                                p.log_level\n                            );\n                            for value in p.iter {\n                                println!(\"  {:?}\", value);\n                            }\n                        }\n                        TraceNv(p) =\u003e {\n                            println!(\n                                \"non verbose trace message 0x{:x} of type {:?} and {} bytes of payload.\",\n                                p.msg_id,\n                                p.trace_type,\n                                p.payload.len(),\n                            );\n                        }\n                        TraceV(p) =\u003e {\n                            println!(\n                                \"verbose trace message with of type {:?} and values:\",\n                                p.trace_type\n                            );\n                            for value in p.iter {\n                                println!(\"  {:?}\", value);\n                            }\n                        }\n                        NetworkNv(p) =\u003e {\n                            println!(\n                                \"non verbose network message 0x{:x} of type {:?} and {} bytes of payload.\",\n                                p.msg_id,\n                                p.net_type,\n                                p.payload.len(),\n                            );\n                        }\n                        NetworkV(p) =\u003e {\n                            println!(\n                                \"verbose network message with of type {:?} and values:\",\n                                p.net_type\n                            );\n                            for value in p.iter {\n                                println!(\"  {:?}\", value);\n                            }\n                        }\n                        ControlNv(p) =\u003e {\n                            println!(\"non verbose control message {:?} with service id: {} and {} bytes of payload.\", p.msg_type, p.service_id, p.payload.len());\n                        }\n                        ControlV(p) =\u003e {\n                            println!(\"verbose control message {:?} with values:\", p.msg_type);\n                            for value in p.iter {\n                                println!(\"  {:?}\", value);\n                            }\n                        }\n                    }\n                }\n                Err(err) =\u003e {\n                    println!(\"message with payload error received: {}\", err);\n                }\n            }\n        },\n        Err(err) =\u003e {\n            //error parsing the dlt packet\n            println!(\"ERROR: {:?}\", err);\n        }\n    }\n}\n```\n\nAn complete example which includes the parsing of the ethernet \u0026 udp headers can be found in [examples/print_messages_ids.rs](examples/print_messages_ids.rs)\n\n## References\n* [Log and Trace Protocol Specification](https://www.autosar.org/fileadmin/standards/foundation/1-3/AUTOSAR_PRS_LogAndTraceProtocol.pdf)\n\n## License\nLicensed 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.\n\n### Contribution\nUnless 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJulianSchmid%2Fdlt-parse-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJulianSchmid%2Fdlt-parse-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJulianSchmid%2Fdlt-parse-rs/lists"}