1
2
3 """Dynamic Trunking Protocol."""
4 from __future__ import absolute_import
5
6 import struct
7
8 from . import dpkt
9
10
11 -class DTP(dpkt.Packet):
12 """Dynamic Trunking Protocol.
13
14 TODO: Longer class information....
15
16 Attributes:
17 __hdr__: Header fields of DTP.
18 TODO.
19 """
20
21 __hdr__ = (
22 ('v', 'B', 0),
23 )
24
26 dpkt.Packet.unpack(self, buf)
27 buf = self.data
28 tvs = []
29 while buf:
30 t, l = struct.unpack('>HH', buf[:4])
31 v, buf = buf[4:4 + l], buf[4 + l:]
32 tvs.append((t, v))
33 self.data = tvs
34
35
36 TRUNK_NAME = 0x01
37 MAC_ADDR = 0x04
38