From 49f6b00b58c3ec734218fcd69259771a42c157bd Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Sun, 23 Aug 2015 17:41:23 +0300 Subject: Added dkpt package, created basic shell for packetGen usage --- .../python_lib/dpkt-1.8.6.2/dpkt/pim.py | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py (limited to 'scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py') diff --git a/scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py b/scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py new file mode 100644 index 00000000..6cd16a42 --- /dev/null +++ b/scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py @@ -0,0 +1,46 @@ +# $Id: pim.py 23 2006-11-08 15:45:33Z dugsong $ +# -*- coding: utf-8 -*- +"""Protocol Independent Multicast.""" + +import dpkt +from decorators import deprecated + + +class PIM(dpkt.Packet): + __hdr__ = ( + ('v_type', 'B', 0x20), + ('rsvd', 'B', 0), + ('sum', 'H', 0) + ) + + @property + def v(self): return self.v_type >> 4 + + @v.setter + def v(self, v): self.v_type = (v << 4) | (self.v_type & 0xf) + + @property + def type(self): return self.v_type & 0xf + + @type.setter + def type(self, type): self.v_type = (self.v_type & 0xf0) | type + + # Deprecated methods, will be removed in the future + # ================================================= + @deprecated + def _get_v(self): return self.v + + @deprecated + def _set_v(self, v): self.v = v + + @deprecated + def _get_type(self): return self.type + + @deprecated + def _set_type(self, type): self.type = type + # ================================================= + + def __str__(self): + if not self.sum: + self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) + return dpkt.Packet.__str__(self) -- cgit