diff options
author | 2015-08-23 17:41:23 +0300 | |
---|---|---|
committer | 2015-08-23 17:41:23 +0300 | |
commit | 49f6b00b58c3ec734218fcd69259771a42c157bd (patch) | |
tree | ab31e2286ad6d426c4b565ce0c07e6e1eff06f1c /scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py | |
parent | 405ba254de0c62ac9f4395d04f918a3749635808 (diff) |
Added dkpt package, created basic shell for packetGen usage
Diffstat (limited to 'scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py')
-rw-r--r-- | scripts/automation/trex_control_plane/python_lib/dpkt-1.8.6.2/dpkt/pim.py | 46 |
1 files changed, 46 insertions, 0 deletions
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) |