ARP/InARP - (Inverse) Address Resolution Protocol

pcapkit.protocols.link.arp contains ARP only, which implements extractor for (Inverse) Address Resolution Protocol (ARP/InARP) *, whose structure is described as below:

Octets

Bits

Name

Description

0

0

arp.htype

Hardware Type

2

16

arp.ptype

Protocol Type

4

32

arp.hlen

Hardware Address Length

5

40

arp.plen

Protocol Address Length

6

48

arp.oper

Operation

8

64

arp.sha

Sender Hardware Address

14

112

arp.spa

Sender Protocol Address

18

144

arp.tha

Target Hardware Address

24

192

arp.tpa

Target Protocol Address


class pcapkit.protocols.link.arp.ARP(file=None, length=None, **kwargs)[source]

Bases: Link[ARP]

This class implements all protocols in ARP family.

Parameters
  • *args (Any) – Arbitrary positional arguments.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type

Protocol[PT]

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type

EtherType

Returns

Numeral registry index of the protocol in IANA.

property name: Literal['Dynamic Reverse Address Resolution Protocol', 'Inverse Address Resolution Protocol', 'Reverse Address Resolution Protocol', 'Address Resolution Protocol']

Name of current protocol.

Return type

Literal[‘Dynamic Reverse Address Resolution Protocol’, ‘Inverse Address Resolution Protocol’, ‘Reverse Address Resolution Protocol’, ‘Address Resolution Protocol’]

property alias: Literal['ARP', 'InARP', 'RARP', 'DRARP']

Acronym of corresponding protocol.

Return type

Literal[‘ARP’, ‘InARP’, ‘RARP’, ‘DRARP’]

property length: int

Header length of current protocol.

Return type

int

property src: Address

Sender hardware & protocol address.

property dst: Address

Target hardware & protocol address.

property type: Type

Hardware & protocol type.

classmethod id()[source]

Index ID of the protocol.

Return type

tuple[Literal[“ARP”], Literal[“InARP”]]

read(length=None, **kwargs)[source]

Read Address Resolution Protocol.

Data structure of ARP Request header [RFC 826]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Hdr Type             |         Proto Type            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Hdr Len    |   Proto Len   |          Operation            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                       Sender Hdr Addr                         \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                      Sender Proto Addr                        \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                       Target Hdr Addr                         \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                      Target Proto Addr                        \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters
  • length (Optional[int]) – Length of packet data.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type

ARP

Returns

Parsed packet data.

make(**kwargs)[source]

Make (construct) packet data.

Parameters

**kwargs (Any) – Arbitrary keyword arguments.

Return type

NoReturn

Returns

Constructed packet data.

class pcapkit.protocols.link.InARP

Alias of pcapkit.protocols.link.arp.ARP.

Data Structures

class pcapkit.protocols.data.link.arp.ARP(htype, ptype, hlen, plen, oper, sha, spa, tha, tpa, len)[source]

Bases: Info

Data model for ARP packet.

Parameters
  • *args (VT) – Arbitrary positional arguments.

  • **kwargs (VT) – Arbitrary keyword arguments.

Return type

Info

htype: Hardware

Hardware type.

ptype: EtherType | str

Protocol type.

hlen: int

Hardware address length.

plen: int

Protocol address length.

oper: Operation

Operation code.

sha: str

Sender hardware address.

spa: str | IPv4Address | IPv6Address

Sender protocol address.

tha: str

Target hardware address.

tpa: str | IPv4Address | IPv6Address

Target protocol address.

len: int

Header length.

class pcapkit.protocols.data.link.arp.Address(hardware, protocol)[source]

Bases: Info

Data model for ARP addresses.

Parameters
  • *args (VT) – Arbitrary positional arguments.

  • **kwargs (VT) – Arbitrary keyword arguments.

Return type

Info

hardware: str

Hardware address.

protocol: str | IPv4Address | IPv6Address

Protocol address.

class pcapkit.protocols.data.link.arp.Type(hardware, protocol)[source]

Bases: Info

Data model for ARP type.

Parameters
  • *args (VT) – Arbitrary positional arguments.

  • **kwargs (VT) – Arbitrary keyword arguments.

Return type

Info

hardware: Hardware

Hardware type.

protocol: EtherType | str

Protocol type.


*

http://en.wikipedia.org/wiki/Address_Resolution_Protocol