summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2023-01-05 10:30:16 +0100
committerMatthias Beyer <mail@beyermatthias.de>2023-01-11 08:57:01 +0100
commit8517254709665649b52d066c70f4d008749aa646 (patch)
tree0d80db87e5da3291b31fa4b46099fe0f9a9ec510
parent99a58d4e98f21a7966ae7aa358260bbed6c61422 (diff)
Add PacketInvariant interface
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--mqtt-tester/src/main.rs1
-rw-r--r--mqtt-tester/src/packet_invariant.rs13
2 files changed, 14 insertions, 0 deletions
diff --git a/mqtt-tester/src/main.rs b/mqtt-tester/src/main.rs
index 69051ad..94fc812 100644
--- a/mqtt-tester/src/main.rs
+++ b/mqtt-tester/src/main.rs
@@ -8,6 +8,7 @@ mod client_report;
mod command;
mod executable;
mod flow;
+mod packet_invariant;
mod report;
use std::{path::PathBuf, process::exit};
diff --git a/mqtt-tester/src/packet_invariant.rs b/mqtt-tester/src/packet_invariant.rs
new file mode 100644
index 0000000..ad2a3bc
--- /dev/null
+++ b/mqtt-tester/src/packet_invariant.rs
@@ -0,0 +1,13 @@
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+
+use mqtt_format::v3::packet::MPacket;
+
+use crate::report::Report;
+
+pub trait PacketInvariant {
+ fn test_invariant(&self, packet: &MPacket<'_>) -> miette::Result<Report>;
+}