#parser #packet-parser #packet-header #header-parser #ccsds #byte #byte-stream

ccsds_primary_header

Implementation of the CCSDS Primary Header for space applications

22 releases (14 breaking)

Uses old Rust 2015

0.15.0 Apr 6, 2020
0.13.0 Apr 6, 2020
0.12.0 Jul 28, 2019
0.10.2 Feb 17, 2019
0.2.0 Sep 5, 2018

#2166 in Parser implementations

MIT license

35KB
417 lines

ccsds_primary_header

This crate contains an implementation of the CCSDS standard called Space Packet Protocol, which defines a packet header called the CCSDS Primary Header.

CCSDS is a packet definition used in many space systems, such as the International Space Station and many satellites and cubesats. It is very simple, and expects the user to extend it with additional information in most applications.

This crate provides a simple implementation of the primary header. It is intended to be used as a building block for larger definitions or packet processing tools. There is also a mechanism to parse CCSDS packets from a byte stream, allowing for a variety of checks that can be configured for a particular project's expectations.

The PrimaryHeader struct provided by the crate has the advantage that its in-memory representation matches the CCSDS standard. It can be cast to a from a byte array, sent over a wire, or used to serialize or deserialize CCSDS packets.

Usage

Primary Header

To use this crate, add the following to your Cargo.toml

[dependancies]
ccsds_primary_header="0.15.0"

Next add this to you crate:

extern crate ccsds_primary_header;
use ccsds_primary_header::primary_header::*;

Primary Header Parser

This crate also contains a mechanism for parsing CCSDS packets. This is exposed in the parser module, which provides the CcsdsParser struct. This struct can be given bytes of data, such as from a packet stream, and will find valid CCSDS packets within this stream.

Include the parser with the following 'use' statement:

extern crate ccsds_primary_header;
use ccsds_primary_header::parser::*;

The parser can be configured to only allow certain APIDs, to expect a secondary header flag, to use a maximum length for packets, and to use a custom validation function that might be project-specific during parsing. There are also options for a sync of any number of bytes which must preceed a packet, and optionally a header and/or footer of any length. The header, footer, and sync can also be kept in the packet, or removed when packets are retrieved from the parser.

Notes

There is a comprehensive set of unit tests, and I have tested it with CCSDS packets when developing the CCSDS Router tool. However, I have not used it in a production environment yet.

License

This project is licensed under either MIT or APACHE2, whichever you prefer.

Dependencies

~395KB