executor.rs (1592B)
1 use alloc::vec::Vec; 2 use radroots_simplex_smp_crypto::prelude::RadrootsSimplexSmpCommandAuthorization; 3 use radroots_simplex_smp_proto::prelude::{ 4 RadrootsSimplexSmpBrokerTransmission, RadrootsSimplexSmpCommand, 5 RadrootsSimplexSmpCorrelationId, RadrootsSimplexSmpServerAddress, 6 }; 7 8 #[derive(Debug, Clone, PartialEq, Eq)] 9 pub struct RadrootsSimplexSmpTransportRequest { 10 pub server: RadrootsSimplexSmpServerAddress, 11 pub transport_version: u16, 12 pub correlation_id: Option<RadrootsSimplexSmpCorrelationId>, 13 pub entity_id: Vec<u8>, 14 pub command: RadrootsSimplexSmpCommand, 15 pub authorization: RadrootsSimplexSmpCommandAuthorization, 16 } 17 18 #[derive(Debug, Clone, PartialEq, Eq)] 19 pub struct RadrootsSimplexSmpTransportResponse { 20 pub server: RadrootsSimplexSmpServerAddress, 21 pub transport_version: u16, 22 pub transmission: RadrootsSimplexSmpBrokerTransmission, 23 pub transport_hash: Vec<u8>, 24 } 25 26 #[derive(Debug, Clone, PartialEq, Eq)] 27 pub struct RadrootsSimplexSmpSubscriptionReceiveRequest { 28 pub server: RadrootsSimplexSmpServerAddress, 29 } 30 31 pub trait RadrootsSimplexSmpCommandTransport { 32 type Error: core::fmt::Display; 33 34 fn execute( 35 &mut self, 36 request: RadrootsSimplexSmpTransportRequest, 37 ) -> Result<RadrootsSimplexSmpTransportResponse, Self::Error>; 38 } 39 40 pub trait RadrootsSimplexSmpSubscriptionTransport: RadrootsSimplexSmpCommandTransport { 41 fn receive_subscription( 42 &mut self, 43 request: RadrootsSimplexSmpSubscriptionReceiveRequest, 44 ) -> Result<Option<RadrootsSimplexSmpTransportResponse>, Self::Error>; 45 }