From a33b53c4136885b8ca7e88e101bc710fffa5db61 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Sun, 9 Jun 2024 11:26:53 -0400 Subject: [PATCH] Add messaging layer types --- .../src/messaging_layer.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 citadel-internal-service-types/src/messaging_layer.rs diff --git a/citadel-internal-service-types/src/messaging_layer.rs b/citadel-internal-service-types/src/messaging_layer.rs new file mode 100644 index 0000000..0c5a1b6 --- /dev/null +++ b/citadel-internal-service-types/src/messaging_layer.rs @@ -0,0 +1,30 @@ +use serde::{Deserialize, Serialize}; +use crate::InternalServiceResponse; + + +pub enum MessengerUpdate { + Message { message: CWMessage }, + Other { response: InternalServiceResponse }, +} + +#[derive(Serialize, Deserialize)] +pub enum CWProtocolMessage { + Message { message: CWMessage }, + MessageAck { id: u64 }, + Poll { ids: Vec }, + PollResponse { messages: Vec }, +} + +pub struct OutgoingCWMessage { + pub cid: u64, + pub peer_cid: Option, + pub contents: Vec, +} + +#[derive(Serialize, Deserialize)] +pub struct CWMessage { + pub id: u64, + pub cid: u64, + pub peer_cid: Option, + pub contents: Vec, +} \ No newline at end of file