#protocols #dash7 #alp #parser

dash7_alp

Implementation of a DASH7 ALP protocol codec

14 releases

0.6.3 Mar 29, 2024
0.6.2 Nov 15, 2023
0.6.1 Apr 21, 2023
0.6.0 Mar 31, 2023
0.1.0-ref-compat.0 May 29, 2022

#604 in Parser implementations

Download history 1/week @ 2024-05-31 1/week @ 2024-06-07 1/week @ 2024-06-14 41/week @ 2024-06-28 3/week @ 2024-07-19 23/week @ 2024-07-26

523 downloads per month

MIT license

405KB
11K SLoC

Crates.io MIT licensed Documentation

Implementation of a Dash7 ALP protocol codec from its public specification.

This library is currently intended for desktop grade usage. It liberally uses Vec and Box, thus making allocations on its own (when decoding).

Status

The current specification is fully implemented.

This library was not used in any project yet, so there are probably a few bugs lying around.


lib.rs:

Implementation of a Dash7 ALP protocol parser from its public specification.

The protocol

The protocol specifies ALP Commands that can be sent to another system to communicate. Each command is an aggregation of ALP Actions.

The protocol is based on the fact that each communicating party hold a Dash7 filesystem. Each request toward an other device is then composed as an array of simple filesystem operation (ALP actions).

About this library

The goal of this library is to implement a specification with an emphasis on correctness, then on usability. Performance and memory usage are currently considered a secondary objective.

Quickstart

use dash7_alp::spec::v1_2::{Command, Action, action};
use hex_literal::hex;

let cmd = Command {
    actions: vec![
        Action::RequestTag(action::RequestTag { id: 66, eop: true }),
        Action::ReadFileData(action::ReadFileData {
            resp: true,
            group: false,
            file_id: 0,
            offset: 0,
            size: 8,
        }),
        Action::ReadFileData(action::ReadFileData {
            resp: false,
            group: true,
            file_id: 4,
            offset: 2,
            size: 3,
        }),
        Action::Nop(action::Nop {
            resp: true,
            group: true,
        }),
    ],
};
let data = &hex!("B4 42   41 00 00 08   81 04 02 03  C0") as &[u8];

assert_eq!(&cmd.encode()[..], data);
let parsed_cmd = Command::decode(data).expect("should be parsed without error");
assert_eq!(parsed_cmd, cmd);

Dependencies