pub struct MulticastUdpFace { /* private fields */ }Expand description
NDN face over IPv4 link-local multicast.
Interests sent on this face reach all NDN-capable nodes on the local link
without requiring prior knowledge of their addresses. Data is returned via
unicast UdpFace to the specific responder.
§Typical usage
- Start
MulticastUdpFaceat boot for neighbor discovery and prefix announcements. - On receiving a multicast Interest, create a unicast
UdpFaceback to the responder’s source address and register it in the FIB. - Subsequent traffic uses the unicast face; the multicast face handles only discovery and control traffic.
Implementations§
Source§impl MulticastUdpFace
impl MulticastUdpFace
Sourcepub async fn new(
iface: Ipv4Addr,
port: u16,
group: Ipv4Addr,
id: FaceId,
) -> Result<Self>
pub async fn new( iface: Ipv4Addr, port: u16, group: Ipv4Addr, id: FaceId, ) -> Result<Self>
Bind to port, join group on interface iface.
Use NDN_MULTICAST_V4 and NDN_PORT for standard NDN.
Sourcepub async fn ndn_default(iface: Ipv4Addr, id: FaceId) -> Result<Self>
pub async fn ndn_default(iface: Ipv4Addr, id: FaceId) -> Result<Self>
Standard NDN multicast (224.0.23.170:6363) on iface.
Sourcepub fn with_socket(id: FaceId, socket: UdpSocket, dest: SocketAddr) -> Self
pub fn with_socket(id: FaceId, socket: UdpSocket, dest: SocketAddr) -> Self
Wrap a pre-configured socket. The caller is responsible for binding and
joining the multicast group. Useful when SO_REUSEADDR is needed.
pub fn dest(&self) -> SocketAddr
Source§impl MulticastUdpFace
impl MulticastUdpFace
Sourcepub async fn recv_with_source(&self) -> Result<(Bytes, SocketAddr), FaceError>
pub async fn recv_with_source(&self) -> Result<(Bytes, SocketAddr), FaceError>
Receive the next NDN packet along with the UDP source address.
Used by the discovery layer to learn the sender’s address and create a unicast reply face — without requiring the sender to embed their address in the Interest payload.
Trait Implementations§
Source§impl Face for MulticastUdpFace
impl Face for MulticastUdpFace
Source§async fn recv(&self) -> Result<Bytes, FaceError>
async fn recv(&self) -> Result<Bytes, FaceError>
Receive the next NDN packet from any sender on the multicast group.
Source§async fn recv_with_addr(&self) -> Result<(Bytes, Option<FaceAddr>), FaceError>
async fn recv_with_addr(&self) -> Result<(Bytes, Option<FaceAddr>), FaceError>
Receive packet and expose the UDP source address to the discovery layer.
Source§async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
Broadcast an NDN packet to the multicast group.
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
Source§fn remote_uri(&self) -> Option<String>
fn remote_uri(&self) -> Option<String>
udp4://192.168.1.1:6363). Returns None for face
types that don’t have a meaningful remote endpoint.