Compare commits

..

19 Commits

Author SHA1 Message Date
9242b8a607 Merge pull request 'prepare MIB release' (#162) from prepare-mib-release into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #162
2024-04-17 16:37:34 +02:00
8195245481 prepare MIB release
Some checks are pending
Rust/sat-rs/pipeline/head Build started...
Rust/sat-rs/pipeline/pr-main Build queued...
2024-04-17 16:17:30 +02:00
f6f7519625 Merge pull request 'small cleanup' (#161) from small-cargo-toml-cleaning into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #161
2024-04-17 16:03:03 +02:00
0f0fbc1a18 small cleanup
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-17 15:17:46 +02:00
6e55e2ac95 Merge pull request 'Prepare next releases' (#160) from prep-next-satrs-releases into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #160
2024-04-17 14:58:01 +02:00
2f96bfe992 changelog sat-rs
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-17 10:03:17 +02:00
52aafb3aab prep next releases
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-17 10:01:46 +02:00
6ce9cb5ead Merge pull request 'use released satrs-shared' (#159) from use-released-satrs-shared into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #159
2024-04-16 21:31:21 +02:00
273f79d1e6 use release satrs-shared
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-16 21:07:51 +02:00
622221835e Merge pull request 'allow sat-rs shared spacepackets range' (#158) from satrs-shared-spacepackets-range into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #158
2024-04-16 20:54:59 +02:00
e396ad2e7a small fix
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-16 19:52:32 +02:00
772927d50b allow spacepackets range
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-16 19:50:46 +02:00
be9a45e55f Merge pull request 'changelog satrs-shared v0.1.3' (#157) from changelog-satrs-shared into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #157
2024-04-16 19:48:12 +02:00
eee8a69550 changelog satrs-shared v0.1.3
Some checks are pending
Rust/sat-rs/pipeline/head Build queued...
2024-04-16 19:47:36 +02:00
f7a6d3ce47 Merge pull request 'bump spacepackets to v0.11.0' (#156) from bump-spacepackets into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #156
2024-04-16 19:46:17 +02:00
df97a3a93e small adjustment
Some checks are pending
Rust/sat-rs/pipeline/pr-main Build started...
2024-04-16 19:39:07 +02:00
42750e08c0 bump spacepackets to v0.11.0
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
2024-04-16 19:26:46 +02:00
786671bbd7 Merge pull request 're-worked TMTC modules' (#155) from rework-tmtc-modules into main
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good
Reviewed-on: #155
2024-04-16 11:10:52 +02:00
63f37f0917 Re-worked TMTC modules
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
2024-04-16 11:04:22 +02:00
12 changed files with 66 additions and 59 deletions

View File

@@ -7,7 +7,7 @@ use std::{
use log::{info, warn};
use satrs::{
encoding::ccsds::{SpacePacketValidation, SpacePacketValidator},
encoding::ccsds::{SpValidity, SpacePacketValidator},
hal::std::tcp_server::{HandledConnectionHandler, ServerConfig, TcpSpacepacketsServer},
spacepackets::{CcsdsPacket, PacketId},
tmtc::{PacketSenderRaw, PacketSource},
@@ -25,14 +25,14 @@ impl SpacePacketValidator for SimplePacketValidator {
&self,
sp_header: &satrs::spacepackets::SpHeader,
_raw_buf: &[u8],
) -> satrs::encoding::ccsds::SpacePacketValidation {
) -> satrs::encoding::ccsds::SpValidity {
if self.valid_ids.contains(&sp_header.packet_id()) {
return SpacePacketValidation::Valid;
return SpValidity::Valid;
}
log::warn!("ignoring space packet with header {:?}", sp_header);
// We could perform a CRC check.. but lets keep this simple and assume that TCP ensures
// data integrity.
SpacePacketValidation::Ignore
SpValidity::Skip
}
}

View File

@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
# [v0.1.2] 2024-04-17
Allow `satrs-shared` from `v0.1.3` to `<v0.2`.
# [v0.1.1] 2024-02-17
- Bumped `spacepackets` to v0.10.0

View File

@@ -1,6 +1,6 @@
[package]
name = "satrs-mib"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
rust-version = "1.61"
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
@@ -23,13 +23,12 @@ version = "1"
optional = true
[dependencies.satrs-shared]
path = "../satrs-shared"
version = "0.1.3"
version = ">=0.1.3, <0.2"
features = ["serde"]
[dependencies.satrs-mib-codegen]
path = "codegen"
version = "0.1.1"
version = "0.1.2"
[dependencies.serde]
version = "1"

View File

@@ -1,6 +1,6 @@
[package]
name = "satrs-mib-codegen"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
description = "satrs-mib proc macro implementation"
homepage = "https://egit.irs.uni-stuttgart.de/rust/sat-rs"
@@ -28,8 +28,7 @@ features = ["full"]
trybuild = { version = "1", features = ["diff"] }
[dev-dependencies.satrs-shared]
version = "0.1.3"
path = "../../satrs-shared"
version = ">=0.1.3, <0.2"
[dev-dependencies.satrs-mib]
path = ".."

View File

@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
# [v0.1.3] 2024-04-16
Allow `spacepackets` range starting with v0.10 and v0.11.
# [v0.1.2] 2024-02-17
- Bumped `spacepackets` to v0.10.0 for `UnsignedEnum` trait change.

View File

@@ -18,7 +18,7 @@ default-features = false
optional = true
[dependencies.spacepackets]
version = "0.11.0-rc.2"
version = ">0.9, <=0.11"
default-features = false
[features]

View File

@@ -8,7 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
- `spacepackets` v0.11.0
# [v0.2.0-rc.1] 2024-04-17
- `spacepackets` v0.11
## Added

View File

@@ -1,6 +1,6 @@
[package]
name = "satrs"
version = "0.2.0-rc.0"
version = "0.2.0-rc.1"
edition = "2021"
rust-version = "1.61"
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
@@ -19,13 +19,26 @@ smallvec = "1"
crc = "3"
[dependencies.satrs-shared]
version = "0.1.3"
path = "../satrs-shared"
version = ">=0.1.3, <0.2"
[dependencies.num_enum]
version = ">0.5, <=0.7"
default-features = false
[dependencies.spacepackets]
version = "0.11"
default-features = false
[dependencies.cobs]
git = "https://github.com/robamu/cobs.rs.git"
version = "0.2.3"
branch = "all_features"
default-features = false
[dependencies.num-traits]
version = "0.2"
default-features = false
[dependencies.dyn-clone]
version = "1"
optional = true
@@ -38,10 +51,6 @@ optional = true
version = "0.7"
optional = true
[dependencies.num-traits]
version = "0.2"
default-features = false
[dependencies.downcast-rs]
version = "1.2"
default-features = false
@@ -75,17 +84,6 @@ version = "0.8"
features = ["os-poll", "net"]
optional = true
[dependencies.spacepackets]
# git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
version = "0.11.0-rc.2"
default-features = false
[dependencies.cobs]
git = "https://github.com/robamu/cobs.rs.git"
version = "0.2.3"
branch = "all_features"
default-features = false
[dev-dependencies]
serde = "1"
zerocopy = "0.7"

View File

@@ -3,11 +3,11 @@ use spacepackets::{CcsdsPacket, SpHeader};
use crate::{tmtc::PacketSenderRaw, ComponentId};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum SpacePacketValidation {
pub enum SpValidity {
Valid,
/// The space packet can be assumed to have a valid format, but the packet should
/// be ignored.
Ignore,
/// be skipped.
Skip,
/// The space packet or space packet header has an invalid format, for example a CRC check
/// failed. In that case, the parser loses the packet synchronization and needs to check for
/// the start of a new space packet header start again. The space packet header
@@ -18,7 +18,7 @@ pub enum SpacePacketValidation {
/// Simple trait to allow user code to check the validity of a space packet.
pub trait SpacePacketValidator {
fn validate(&self, sp_header: &SpHeader, raw_buf: &[u8]) -> SpacePacketValidation;
fn validate(&self, sp_header: &SpHeader, raw_buf: &[u8]) -> SpValidity;
}
/// This function parses a given buffer for tightly packed CCSDS space packets. It uses the
@@ -30,13 +30,16 @@ pub trait SpacePacketValidator {
/// If broken tail packets are detected, they are moved to the front of the buffer, and the write
/// index for future write operations will be written to the `next_write_idx` argument.
///
/// The parser will forward all packets for which the user provided [SpacePacketValidator] returned
/// [SpacePacketValidation::Valid] to the given `packet_sender` and return the number of packets
/// found. If the [PacketSenderRaw::send_packet] calls fails, the error will be returned.
/// The parses will behave differently based on the [SpValidity] returned from the user provided
/// [SpacePacketValidator]:
///
/// If the user provided [SpacePacketValidator] returns [SpacePacketValidation::Invalid], the
/// parser assumes that the synchronization is lost and tries to find the start of a new space
/// packet header by scanning all the following bytes.
/// 1. [SpValidity::Valid]: The parser will forward all packets to the given `packet_sender` and
/// return the number of packets found.If the [PacketSenderRaw::send_packet] calls fails, the
/// error will be returned.
/// 2. [SpValidity::Invalid]: The parser assumes that the synchronization is lost and tries to
/// find the start of a new space packet header by scanning all the following bytes.
/// 3. [SpValidity::Skip]: The parser skips the packet using the packet length determined from the
/// space packet header.
pub fn parse_buffer_for_ccsds_space_packets<SendError>(
buf: &mut [u8],
packet_validator: &(impl SpacePacketValidator + ?Sized),
@@ -55,7 +58,7 @@ pub fn parse_buffer_for_ccsds_space_packets<SendError>(
let sp_header = SpHeader::from_be_bytes(&buf[current_idx..]).unwrap().0;
// let packet_id = u16::from_be_bytes(buf[current_idx..current_idx + 2].try_into().unwrap());
match packet_validator.validate(&sp_header, &buf[current_idx..]) {
SpacePacketValidation::Valid => {
SpValidity::Valid => {
let packet_size = sp_header.total_len();
if (current_idx + packet_size) <= buf_len {
packet_sender
@@ -71,11 +74,11 @@ pub fn parse_buffer_for_ccsds_space_packets<SendError>(
current_idx += packet_size;
continue;
}
SpacePacketValidation::Ignore => {
SpValidity::Skip => {
current_idx += sp_header.total_len();
}
// We might have lost sync. Try to find the start of a new space packet header.
SpacePacketValidation::Invalid => {
SpValidity::Invalid => {
current_idx += 1;
}
}
@@ -92,9 +95,7 @@ mod tests {
use crate::{encoding::tests::TcCacher, ComponentId};
use super::{
parse_buffer_for_ccsds_space_packets, SpacePacketValidation, SpacePacketValidator,
};
use super::{parse_buffer_for_ccsds_space_packets, SpValidity, SpacePacketValidator};
const PARSER_ID: ComponentId = 0x05;
const TEST_APID_0: u16 = 0x02;
@@ -116,13 +117,13 @@ mod tests {
}
impl SpacePacketValidator for SimpleVerificator {
fn validate(&self, sp_header: &SpHeader, _raw_buf: &[u8]) -> super::SpacePacketValidation {
fn validate(&self, sp_header: &SpHeader, _raw_buf: &[u8]) -> super::SpValidity {
if sp_header.packet_id() == TEST_PACKET_ID_0
|| (self.enable_second_id && sp_header.packet_id() == TEST_PACKET_ID_1)
{
return SpacePacketValidation::Valid;
return SpValidity::Valid;
}
SpacePacketValidation::Ignore
SpValidity::Skip
}
}

View File

@@ -185,7 +185,7 @@ mod tests {
};
use crate::{
encoding::ccsds::{SpacePacketValidation, SpacePacketValidator},
encoding::ccsds::{SpValidity, SpacePacketValidator},
hal::std::tcp_server::{
tests::{ConnectionFinishedHandler, SyncTmSource},
ConnectionResult, ServerConfig,
@@ -207,12 +207,12 @@ mod tests {
pub struct SimpleValidator(pub HashSet<PacketId>);
impl SpacePacketValidator for SimpleValidator {
fn validate(&self, sp_header: &SpHeader, _raw_buf: &[u8]) -> SpacePacketValidation {
fn validate(&self, sp_header: &SpHeader, _raw_buf: &[u8]) -> SpValidity {
if self.0.contains(&sp_header.packet_id()) {
return SpacePacketValidation::Valid;
return SpValidity::Valid;
}
// Simple case: Assume that the interface always contains valid space packets.
SpacePacketValidation::Ignore
SpValidity::Skip
}
}

View File

@@ -20,7 +20,6 @@ use spacepackets::{
ecss::{
tc::PusTcReader,
tm::{PusTmCreator, PusTmReader},
WritablePusPacket,
},
SpHeader,
};
@@ -226,6 +225,7 @@ pub mod std_mod {
#[cfg(feature = "crossbeam")]
use crossbeam_channel as cb;
use spacepackets::ecss::WritablePusPacket;
use thiserror::Error;
use crate::pool::PoolProvider;

View File

@@ -24,7 +24,7 @@ use std::{
use hashbrown::HashSet;
use satrs::{
encoding::{
ccsds::{SpacePacketValidation, SpacePacketValidator},
ccsds::{SpValidity, SpacePacketValidator},
cobs::encode_packet_with_cobs,
},
hal::std::tcp_server::{
@@ -205,11 +205,11 @@ impl SpacePacketValidator for SimpleVerificator {
&self,
sp_header: &SpHeader,
_raw_buf: &[u8],
) -> satrs::encoding::ccsds::SpacePacketValidation {
) -> satrs::encoding::ccsds::SpValidity {
if self.valid_ids.contains(&sp_header.packet_id()) {
return SpacePacketValidation::Valid;
return SpValidity::Valid;
}
SpacePacketValidation::Ignore
SpValidity::Skip
}
}