/// Look up the hardware address for a network protocol address.
Look up the hardware address for a network protocol address.
Look up the hardware address for a network protocol address .
pub(crate) fn lookup<D: EventDispatcher, P: PType + Eq + Hash, AD: ArpDevice<P>>(
    ctx: &mut Context<D>,
    device_id: u64,
    local_addr: AD::HardwareAddr,
    lookup_addr: P,
) -> Option<AD::HardwareAddr> {
    // TODO(joshlf): Figure out what to do if a frame can't be sent right now
    // because it needs to wait for an ARP reply. Where do we put those frames?
    // How do we associate them with the right ARP reply? How do we retreive
    // them when we get that ARP reply? How do we time out so we don't hold onto
    // a stale frame forever?
    let result = AD::get_arp_state(ctx, device_id).table.lookup(lookup_addr).cloned();
    // Send an ARP Request if the address is not in our cache
    if result.is_none() {
        send_arp_request::<D, P, AD>(ctx, device_id, lookup_addr);
    }
    result
}
pub ( crate ) fn lookup < D : EventDispatcher , P : PType + Eq + Hash , AD : ArpDevice < P > > ( ctx : & mut Context < D > , device_id : u64 , local_addr : AD :: HardwareAddr , lookup_addr : P , ) -> Option < AD :: HardwareAddr > { // TODO(joshlf): Figure out what to do if a frame can't be sent right now // because it needs to wait for an ARP reply. Where do we put those frames? // How do we associate them with the right ARP reply? How do we retreive // them when we get that ARP reply? How do we time out so we don't hold onto // a stale frame forever? let result = AD :: get_arp_state ( ctx , device_id ) . table . lookup ( lookup_addr ) . cloned ( ) ; // Send an ARP Request if the address is not in our cache if result . is_none ( ) { send_arp_request :: < D , P , AD > ( ctx , device_id , lookup_addr ) ; } result }
Look up the hardware address for a network protocol address.
Look up the hardware address for a network protocol address .
ctx
&mut Context<D>
device_id
u64
local_addr
AD::HardwareAddr
lookup_addr
P