#parser #protocol #dash7 #alp

dash7_alp

Implementation of a DASH7 ALP protocol codec

9 releases (4 breaking)

new 0.5.1 Dec 7, 2022
0.5.0 Dec 7, 2022
0.4.1 Dec 4, 2022
0.3.0 Nov 26, 2022
0.1.0-ref-compat.0 May 29, 2022

#462 in Parser implementations

Download history 1/week @ 2022-08-17 5/week @ 2022-08-24 5/week @ 2022-09-07 2/week @ 2022-09-14 1/week @ 2022-09-21 1/week @ 2022-09-28 1/week @ 2022-10-19 20/week @ 2022-11-09 9/week @ 2022-11-16 52/week @ 2022-11-23 52/week @ 2022-11-30

133 downloads per month

MIT license

320KB
9K 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