pub struct SessionAck {
pub src_coords: TreeCoordinate,
pub dest_coords: TreeCoordinate,
pub flags: u8,
pub handshake_payload: Vec<u8>,
}Expand description
Session acknowledgement.
Carried inside a SessionDatagram envelope which provides src_addr and dest_addr. The SessionAck payload contains both the acknowledger’s and initiator’s coordinates for route cache warming (ensuring return-path transit nodes can route independently of the forward path) and the Noise XK handshake response.
SessionSetup, SessionAck, and SessionMsg3 are identified by the phase field in the FSP common prefix (0x1, 0x2, 0x3), not by a message-type byte.
§Wire Format
Encoded with FSP common prefix: [ver_phase:1][flags:1][payload_len:2 LE][body],
where ver_phase = 0x02 (version 0, phase MSG2) and flags = 0 for handshake.
Body (after 4-byte FSP prefix):
| Offset | Field | Size | Description |
|---|---|---|---|
| 0 | flags | 1 byte | Reserved |
| 1 | src_coords_count | 2 bytes LE | Number of acknowledger coordinate entries |
| 3 | src_coords | 16 × n | Acknowledger’s ancestry (for cache warming) |
| … | dest_coords_count | 2 bytes LE | Number of initiator coordinate entries |
| … | dest_coords | 16 × m | Initiator’s ancestry (for return-path cache warming) |
| … | handshake_len | 2 bytes LE | Noise payload length |
| … | handshake_payload | variable | Noise XK msg2 (57 bytes — ephemeral key + encrypted epoch) |
Fields§
§src_coords: TreeCoordinateAcknowledger’s coordinates.
dest_coords: TreeCoordinateInitiator’s coordinates (for return-path cache warming).
flags: u8Reserved flags byte (for forward compatibility).
handshake_payload: Vec<u8>Noise IK handshake message 2.
Implementations§
Source§impl SessionAck
impl SessionAck
Sourcepub fn new(src_coords: TreeCoordinate, dest_coords: TreeCoordinate) -> Self
pub fn new(src_coords: TreeCoordinate, dest_coords: TreeCoordinate) -> Self
Create a new session acknowledgement.
Sourcepub fn with_handshake(self, payload: Vec<u8>) -> Self
pub fn with_handshake(self, payload: Vec<u8>) -> Self
Set the Noise handshake payload.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode as wire format (4-byte FSP prefix + flags + coords + handshake).
The 4-byte prefix: [ver_phase:1][flags:1][payload_len:2 LE]
where ver_phase = 0x02 (version 0, phase MSG2).
Sourcepub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
pub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
Decode from wire format (after 4-byte FSP prefix has been consumed).
Trait Implementations§
Source§impl Clone for SessionAck
impl Clone for SessionAck
Source§fn clone(&self) -> SessionAck
fn clone(&self) -> SessionAck
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SessionAck
impl RefUnwindSafe for SessionAck
impl Send for SessionAck
impl Sync for SessionAck
impl Unpin for SessionAck
impl UnsafeUnpin for SessionAck
impl UnwindSafe for SessionAck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more