pub enum Peer {
Udp(PeerAddr),
Ble(u16),
Tcp(PeerAddr, u16),
}Expand description
Where a Matter message came from, or goes to, whichever transport carried it.
A Matter node speaks more than one at once: during commissioning a device may be answering BLE on one side and advertising over IPv6 on the other, and the reply to a message has to go back the way it came.
The distinction is not only routing. Core §4.12.4:
Reliable messages sent over TCP, PAFTP, or BTP SHALL utilize the underlying reliability mechanisms of those transports and SHOULD NOT set the R Flag.
So which transport a peer is on decides whether MRP runs at all, and
Messaging reads it from here rather than trusting each
caller to remember.
Variants§
Udp(PeerAddr)
A UDP peer, addressed by IPv6. MRP supplies the reliability.
Ble(u16)
A BLE peer, named by whatever handle the platform’s stack uses for the connection.
btp supplies the reliability.
Tcp(PeerAddr, u16)
A TCP peer: an address, plus the connection the stream arrived on.
The address alone does not identify it. Core §4.15.2 lets two nodes hold more than one
connection at a time, and a reply has to go back down the one the request came up, so
the platform’s own handle for the socket travels with the address.
tcp supplies the reliability.
Implementations§
Source§impl Peer
impl Peer
Sourcepub const fn is_reliable(&self) -> bool
pub const fn is_reliable(&self) -> bool
Whether the transport is reliable on its own, so §4.12.4 says not to set the R flag.
Sourcepub const fn supports_large_payloads(&self) -> bool
pub const fn supports_large_payloads(&self) -> bool
Whether the transport can carry a message larger than the 1280-octet IPv6 minimum MTU, so a Large Message command (§4.4.4) may be sent over it.
Only TCP can. §4.4.4: “The maximum size of the payload for messages sent over a TCP
connection is 1,048,576 octets”, against 1280 for everything datagram-shaped. This is
what an application passes to
InteractionContext::with_large_messages,
so the data model’s L quality is enforced against the transport that is actually
underneath rather than against a build-time guess.