summaryrefslogtreecommitdiff
path: root/external/construct/protocols/layer3/igmpv2.py
diff options
context:
space:
mode:
authorLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
committerLivio Recchia <recchialivio@libero.it>2020-02-10 23:06:34 +0100
commit9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch)
tree9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /external/construct/protocols/layer3/igmpv2.py
parent11cc316b74d5f3f283413a33e7693b314741aa4a (diff)
downloadmanachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz
manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip
Initial commit
Diffstat (limited to 'external/construct/protocols/layer3/igmpv2.py')
-rw-r--r--external/construct/protocols/layer3/igmpv2.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/external/construct/protocols/layer3/igmpv2.py b/external/construct/protocols/layer3/igmpv2.py
new file mode 100644
index 0000000..41797eb
--- /dev/null
+++ b/external/construct/protocols/layer3/igmpv2.py
@@ -0,0 +1,29 @@
+"""
+What : Internet Group Management Protocol, Version 2
+ How : http://www.ietf.org/rfc/rfc2236.txt
+ Who : jesse @ housejunkie . ca
+"""
+
+from construct import Byte, Enum,Struct, UBInt16
+from construct.protocols.layer3.ipv4 import IpAddress
+from binascii import unhexlify
+import six
+
+
+igmp_type = Enum(Byte("igmp_type"),
+ MEMBERSHIP_QUERY = 0x11,
+ MEMBERSHIP_REPORT_V1 = 0x12,
+ MEMBERSHIP_REPORT_V2 = 0x16,
+ LEAVE_GROUP = 0x17,
+)
+
+igmpv2_header = Struct("igmpv2_header",
+ igmp_type,
+ Byte("max_resp_time"),
+ UBInt16("checksum"),
+ IpAddress("group_address"),
+)
+
+if __name__ == '__main__':
+ capture = unhexlify(six.b("1600FA01EFFFFFFD"))
+ print (igmpv2_header.parse(capture))