Package dpkt :: Module arp
[hide private]
[frames] | no frames]

Source Code for Module dpkt.arp

 1  # $Id: arp.py 23 2006-11-08 15:45:33Z dugsong $ 
 2  # -*- coding: utf-8 -*- 
 3  """Address Resolution Protocol.""" 
 4  from __future__ import absolute_import 
 5   
 6  from . import dpkt 
 7   
 8  # Hardware address format 
 9  ARP_HRD_ETH = 0x0001  # ethernet hardware 
10  ARP_HRD_IEEE802 = 0x0006  # IEEE 802 hardware 
11   
12  # Protocol address format 
13  ARP_PRO_IP = 0x0800  # IP protocol 
14   
15  # ARP operation 
16  ARP_OP_REQUEST = 1  # request to resolve ha given pa 
17  ARP_OP_REPLY = 2  # response giving hardware address 
18  ARP_OP_REVREQUEST = 3  # request to resolve pa given ha 
19  ARP_OP_REVREPLY = 4  # response giving protocol address 
20   
21   
22 -class ARP(dpkt.Packet):
23 """Address Resolution Protocol. 24 25 See more about the ARP on \ 26 https://en.wikipedia.org/wiki/Address_Resolution_Protocol 27 28 Attributes: 29 __hdr__: Header fields of ARP. 30 """ 31 32 __hdr__ = ( 33 ('hrd', 'H', ARP_HRD_ETH), 34 ('pro', 'H', ARP_PRO_IP), 35 ('hln', 'B', 6), # hardware address length 36 ('pln', 'B', 4), # protocol address length 37 ('op', 'H', ARP_OP_REQUEST), 38 ('sha', '6s', ''), 39 ('spa', '4s', ''), 40 ('tha', '6s', ''), 41 ('tpa', '4s', '') 42 )
43