41 static_assert(
sizeof(
arphdr) == 28,
"arphdr size is not 28 bytes");
75 : senderMacAddr(senderMacAddress), senderIpAddr(senderIPAddress), targetIpAddr(targetIPAddress) {};
97 : senderMacAddr(senderMacAddress), senderIpAddr(senderIPAddress), targetMacAddr(targetMacAddress),
98 targetIpAddr(targetIPAddress) {};
120 : senderMacAddr(senderMacAddress), senderIpAddr(senderIPAddress) {};
138 : senderMacAddr(senderMacAddress), senderIpAddr(senderIPAddress) {};
152 :
Layer(data, dataLen, prevLayer, packet,
ARP)
154 m_DataLen =
sizeof(
arphdr);
176 PCPP_DEPRECATED(
"This constructor has been deprecated. Please use one of the other overloads.")
203 return reinterpret_cast<arphdr*
>(m_Data);
Definition: ArpLayer.h:144
ArpOpcode getOpcode() const
ArpMessageType getMessageType() const
Attempts to determine the ARP message type based on the header signature.
arphdr * getArpHeader() const
Definition: ArpLayer.h:201
IPv4Address getTargetIpAddr() const
Definition: ArpLayer.h:234
void parseNextLayer() override
Does nothing for this layer (ArpLayer is always last)
Definition: ArpLayer.h:242
bool isReply() const
Is this packet an ARP reply?
size_t getHeaderLen() const override
Definition: ArpLayer.h:246
MacAddress getTargetMacAddress() const
Definition: ArpLayer.h:220
void computeCalculateFields() override
bool isRequest() const
Is this packet an ARP request?
ArpLayer(ArpOpcode opCode, const MacAddress &senderMacAddr, const IPv4Address &senderIpAddr, const MacAddress &targetMacAddr, const IPv4Address &targetIpAddr)
A constructor that creates an ARP header.
IPv4Address getSenderIpAddr() const
Definition: ArpLayer.h:227
std::string toString() const override
ArpLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: ArpLayer.h:151
OsiModelLayer getOsiModelLayer() const override
Definition: ArpLayer.h:270
MacAddress getSenderMacAddress() const
Definition: ArpLayer.h:213
Definition: IpAddress.h:28
Definition: MacAddress.h:21
The main namespace for the PcapPlusPlus lib.
ArpOpcode
An enum for ARP message type.
Definition: ArpLayer.h:45
@ ARP_REQUEST
ARP request.
Definition: ArpLayer.h:46
@ ARP_REPLY
ARP reply (response)
Definition: ArpLayer.h:47
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:225
@ OsiModelNetworkLayer
Network layer (layer 3)
Definition: ProtocolType.h:231
const ProtocolType ARP
ARP protocol.
Definition: ProtocolType.h:50
ArpMessageType
An enum representing the ARP message type.
Definition: ArpLayer.h:52
@ GratuitousRequest
Gratuitous ARP request.
@ GratuitousReply
Gratuitous ARP reply.
@ Unknown
Unknown ARP message type.
A struct representing the build data for an ARP reply.
Definition: ArpLayer.h:83
ArpReply(MacAddress const &senderMacAddress, IPv4Address const &senderIPAddress, MacAddress const &targetMacAddress, IPv4Address const &targetIPAddress)
Construct a new Arp Reply object.
Definition: ArpLayer.h:95
A struct representing the build data for an ARP request.
Definition: ArpLayer.h:64
ArpRequest(MacAddress const &senderMacAddress, IPv4Address const &senderIPAddress, IPv4Address const &targetIPAddress)
Construct a new Arp Request object.
Definition: ArpLayer.h:73
A struct representing the build data a gratuitous ARP reply.
Definition: ArpLayer.h:128
GratuitousArpReply(MacAddress const &senderMacAddress, IPv4Address const &senderIPAddress)
Construct a new Gratuitous Arp Reply object.
Definition: ArpLayer.h:137
A struct representing the build data for a gratuitous ARP request.
Definition: ArpLayer.h:110
GratuitousArpRequest(MacAddress const &senderMacAddress, IPv4Address const &senderIPAddress)
Construct a new Gratuitous Arp Request object.
Definition: ArpLayer.h:119
Definition: ArpLayer.h:18
uint32_t targetIpAddr
Target protocol address (TPA)
Definition: ArpLayer.h:38
uint8_t protocolSize
Definition: ArpLayer.h:27
uint16_t opcode
Definition: ArpLayer.h:30
uint16_t hardwareType
Hardware type (HTYPE)
Definition: ArpLayer.h:20
uint8_t targetMacAddr[6]
Target hardware address (THA)
Definition: ArpLayer.h:36
uint32_t senderIpAddr
Sender protocol address (SPA)
Definition: ArpLayer.h:34
uint8_t hardwareSize
Hardware address length (HLEN). For IPv4, this has the value 0x0800.
Definition: ArpLayer.h:24
uint8_t senderMacAddr[6]
Sender hardware address (SHA)
Definition: ArpLayer.h:32
uint16_t protocolType
Protocol type (PTYPE). The permitted PTYPE values share a numbering space with those for EtherType.
Definition: ArpLayer.h:22