1
2
3 """Linux libpcap "cooked" capture encapsulation."""
4 from __future__ import absolute_import
5
6 from . import arp
7 from . import dpkt
8 from . import ethernet
9
10
11 -class SLL(dpkt.Packet):
12 """Linux libpcap "cooked" capture encapsulation.
13
14 TODO: Longer class information....
15
16 Attributes:
17 __hdr__: Header fields of SLL.
18 TODO.
19 """
20
21 __hdr__ = (
22 ('type', 'H', 0),
23 ('hrd', 'H', arp.ARP_HRD_ETH),
24 ('hlen', 'H', 6),
25 ('hdr', '8s', ''),
26 ('ethtype', 'H', ethernet.ETH_TYPE_IP),
27 )
28 _typesw = ethernet.Ethernet._typesw
29
37
39 slldata = b'\x00\x00\x00\x01\x00\x06\x00\x0b\xdb\x52\x0e\x08\xf6\x7f\x08\x00\x45\x00\x00\x34\xcc\x6c\x40\x00\x40\x06\x74\x08\x82\xd9\xfa\x8e\x82\xd9\xfa\x0d'
40 slltest = SLL(slldata)
41 assert slltest.type == 0
42 assert slltest.hrd == 1
43 assert slltest.hlen == 6
44 assert slltest.hdr == b'\x00\x0b\xdb\x52\x0e\x08\xf6\x7f'
45 assert slltest.ethtype == 0x0800
46
47
48 slldata2 = b'\x00\x00\x00\x01\x00\x06\x00\x0b\xdb\x52\x0e\x08\xf6\x7f\x12\x34\x45\x00\x00\x34\xcc\x6c\x40\x00\x40\x06\x74\x08\x82\xd9\xfa\x8e\x82\xd9\xfa\x0d'
49 slltest = SLL(slldata2)
50