netpkt/arp.rs#
Source: lib/netpkt/arp.rs
arp -- the Address Resolution Protocol for IPv4 over Ethernet (RFC 826, 5227)
ArpView::parse(b) only htype 1 / ptype 0x0800 / hlen 6 / plen 4 is accepted
Arp { op, sha, spa, tha, tpa } request / reply / probe / announce, write, push_onto
A gratuitous ARP has spa == tpa; an ARP probe (RFC 5227) has spa 0.0.0.0.
ARP_LEN: usize = 28
OP_REQUEST: u16 = 1
OP_REPLY: u16 = 2
struct ArpView<'a>a received ARP packet for IPv4 over Ethernet
impl<'a> ArpView<'a>
fn parse(b: &'a [u8]) -> Option<ArpView<'a>>fn op(&self) -> u16fn sha(&self) -> Macfn spa(&self) -> Ipv4fn tha(&self) -> Macfn tpa(&self) -> Ipv4struct Arpan ARP packet to writeop: u16sha: Macspa: Ipv4tha: Mactpa: Ipv4
impl Arp
const LEN: usize = ARP_LENfn read(v: &ArpView) -> Arpfn request(sha: Mac, spa: Ipv4, tpa: Ipv4) -> Arp"who has tpa? tell spa"fn reply_to(req: &Arp, mac: Mac, ip: Ipv4) -> Arpthe answer to a request:machasipfn probe(sha: Mac, tpa: Ipv4) -> Arpan RFC 5227 probe: sender address 0.0.0.0fn announce(sha: Mac, ip: Ipv4) -> Arpa gratuitous announcement of the own addressfn is_gratuitous(&self) -> boolfn is_probe(&self) -> boolfn write(&self, out: &mut [u8])fn push_onto(&self, p: &mut Pkt)