aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/mod.rs')
-rw-r--r--src/transport/mod.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index ad45ce9..7bc6ae0 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -254,6 +254,20 @@ pub(crate) enum ParsedMessage {
Disconnect(NeighbourAnswer),
/// Changes the sender refused, of those the recipient brought (`swarm::refusals`).
Refusals(RefusalsMessage),
+ /// What the sender's build speaks and knows, in a layout no build changes
+ /// (`wire::SPEAKS`, `swarm::speaking`).
+ Speaks(Speaks),
+}
+
+/// SPEAKS: the wire versions the sender speaks, the oldest and the newest, and the
+/// newest revision of the federation it knows, by ID, where it is built with the
+/// federation. Sent with every handshake, in a layout no build changes (`wire::SPEAKS`):
+/// a build that doesn't know it ignores it, as a message of another wire version.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub(crate) struct Speaks {
+ pub(crate) oldest: u8,
+ pub(crate) newest: u8,
+ pub(crate) revision: Option<[u8; 32]>,
}
/// REFUSALS: changes the sender refused by the swarm's rules (`access::screen`), of
@@ -417,6 +431,7 @@ pub(crate) enum MessageKind {
NeighbourReply,
Disconnect,
Refusals,
+ Speaks,
}
impl ParsedMessage {
@@ -440,6 +455,7 @@ impl ParsedMessage {
ParsedMessage::NeighbourReply(_) => MessageKind::NeighbourReply,
ParsedMessage::Disconnect(_) => MessageKind::Disconnect,
ParsedMessage::Refusals(_) => MessageKind::Refusals,
+ ParsedMessage::Speaks(_) => MessageKind::Speaks,
}
}
@@ -469,7 +485,8 @@ impl ParsedMessage {
ParsedMessage::Who(_)
| ParsedMessage::Me(_)
| ParsedMessage::Ping(_)
- | ParsedMessage::Pong { .. } => None,
+ | ParsedMessage::Pong { .. }
+ | ParsedMessage::Speaks(_) => None,
}
}
}