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 |
|
Hardware Type |
2 |
16 |
|
Protocol Type |
4 |
32 |
|
Hardware Address Length |
5 |
40 |
|
Protocol Address Length |
6 |
48 |
|
Operation |
8 |
64 |
|
Sender Hardware Address |
14 |
112 |
|
Sender Protocol Address |
18 |
144 |
|
Target Hardware Address |
24 |
192 |
|
Target Protocol Address |
-
class
pcapkit.protocols.link.arp.ARP(file=None, length=None, **kwargs)[source]¶ Bases:
pcapkit.protocols.link.link.LinkThis class implements all protocols in ARP family.
Address Resolution Protocol (ARP) [RFC 826]
Reverse Address Resolution Protocol (RARP) [RFC 903]
Dynamic Reverse Address Resolution Protocol (DRARP) [RFC 1931]
Inverse Address Resolution Protocol (InARP) [RFC 2390]
-
_acnm: Literal[‘ARP’, ‘InARP’, ‘RARP’, ‘DRARP’]¶ Acronym of corresponding protocol.
The value is based on operation type (
oper).
-
_name: Literal[‘Dynamic Reverse Address Resolution Protocol’, ‘Inverse Address Resolution Protocol’, ‘Reverse Address Resolution Protocol’, ‘Address Resolution Protocol’]¶ Name of current protocol.
The value is based on operation type (
oper).
-
classmethod
__index__()[source]¶ Numeral registry index of the protocol.
- Returns
Numeral registry index of the protocol in IANA.
- Return type
-
_read_proto_resolve(length, ptype)[source]¶ Resolve protocol address according to protocol.
- Positional arguments:
length (int): Protocol address length. ptype (int): Protocol type.
- Returns
Protocol address. If
ptypeis0x0800, i.e. IPv4 adddress, returns anIPv4Addressobject; ifptypeis0x86dd, i.e. IPv6 address, returns anIPv6Addressobject; otherwise, returns a rawstrrepresenting the protocol address.- Return type
-
classmethod
id()[source]¶ Index ID of the protocol.
- Returns
Index ID of the protocol.
- Return type
Tuple[Literal[‘ARP’], Literal[‘InARP’]]
-
make(**kwargs)[source]¶ Make (construct) packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
-
read(length=None, **kwargs)[source]¶ Read Address Resolution Protocol [RFC 826].
- Parameters
length (Optional[int]) – Length of packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Parsed packet data.
- Return type
-
property
alias¶ Acronym of corresponding protocol.
- Return type
Literal[‘ARP’, ‘InARP’, ‘RARP’, ‘DRARP’]
-
property
dst¶ Target hardware & protocol address.
- Return type
Tuple[str, Union[ipaddress.IPv4Address, ipaddress.IPv6Address, str]]
-
property
name¶ Name of current protocol.
- Return type
Literal[‘Dynamic Reverse Address Resolution Protocol’, ‘Inverse Address Resolution Protocol’, ‘Reverse Address Resolution Protocol’, ‘Address Resolution Protocol’]
-
property
src¶ Sender hardware & protocol address.
- Return type
Tuple[str, Union[ipaddress.IPv4Address, ipaddress.IPv6Address, str]]
-
property
type¶ Hardware & protocol type.
- Return type
Tuple[pcapkit.const.arp.hardware.Hardware, pcapkit.const.reg.ethertype.EtherType]
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit module.
-
class
pcapkit.protocols.link.arp.DataType_ARP¶ - Bases
TypedDict
ARP header [RFC 826].
-
htype: pcapkit.const.arp.Headware¶ hardware type
-
ptype: Union[pcapkit.const.reg.ethertype.EtherType, str]¶ protocol type
-
oper: pcapkit.const.arp.operation.Operation¶ operation