changelog shortlog tags manifest raw

changeset: Added protocols CHDLC and SLARP

changeset 800: 9d22705577d3
parent 799:85fc0047753e
child 801:48e628564995
author: Jochen Bartl <lobo@c3a.de>
date: Sun Feb 17 02:07:56 2008 +0100 (9 months ago)
files: scapy.py
description: Added protocols CHDLC and SLARP

CHDLC - Cisco High-Level Data Link Control
SLARP - Serial Line Address Resolution Protocol
--- a/scapy.py	Tue Feb 12 13:03:15 2008 +0100
+++ b/scapy.py	Sun Feb 17 02:07:56 2008 +0100
@@ -8755,6 +8755,29 @@ class TFTP_OACK(Packet):
         return isinstance(other, TFTP_WRQ) or isinstance(other, TFTP_RRQ)
 
 
+class CHDLC(Packet):
+    name = "Cisco HDLC"
+    fields_desc = [ ByteEnumField("address", 0x0f, {0x0f : "unicast", 0x8f :"multicast"}),
+                    ByteField("control", 0),
+                    XShortField("proto", 0x0800) ]
+
+class SLARP(Packet):
+    name = "SLARP"
+    fields_desc = [ IntEnumField("type", 2, {0 : "request", 1 : "reply", 2 :"line keepalive"}),
+                    ConditionalField(IPField("address", "192.168.0.1"),
+                                                lambda pkt : pkt.type == 0 or pkt.type == 1),
+                    ConditionalField(IPField("mask", "255.255.255.0"),
+                                                lambda pkt : pkt.type == 0 or pkt.type == 1),
+                    ConditionalField(XShortField("unused", 0),
+                                                lambda pkt : pkt.type == 0 or pkt.type == 1),
+                    ConditionalField(IntField("mysequence", 0),
+                                                lambda pkt : pkt.type == 2),
+                    ConditionalField(IntField("yoursequence", 0),
+                                                lambda pkt : pkt.type == 2),
+                    ConditionalField(XShortField("reliability", 0xffff),
+                                                lambda pkt : pkt.type == 2)]
+
+
 ##########
 ## SNMP ##
 ##########
@@ -9040,6 +9063,8 @@ bind_layers( Dot11,         LLC,        
 bind_layers( Dot11,         LLC,           type=2)
 bind_layers( Dot11QoS,      LLC,           )
 bind_layers( PPP,           IP,            proto=33)
+bind_layers( CHDLC,         IP,            proto=2048)
+bind_layers( CHDLC,         SLARP,         proto=32821)
 bind_layers( Ether,         LLC,           type=122)
 bind_layers( Ether,         Dot1Q,         type=33024)
 bind_layers( Ether,         Ether,         type=1)
@@ -9184,7 +9209,6 @@ bind_layers(TFTP_WRQ, TFTP_Options)
 bind_layers(TFTP_WRQ, TFTP_Options)
 bind_layers(TFTP_OACK, TFTP_Options)
 
-
 ###################
 ## Fragmentation ##
 ###################
@@ -9386,6 +9410,7 @@ LLTypes = { ARPHDR_ETHER : Ether_Dot3_Di
             ARPHDR_LOOPBACK : Ether_Dot3_Dispatcher,
             12 : IP,
             101 : IP,
+            104 : CHDLC,
             801 : Dot11,
             802 : PrismHeader,
             803 : RadioTap,
@@ -9408,7 +9433,8 @@ LLNumTypes = { Ether : ARPHDR_ETHER,
                Dot11 : 105,
                CookedLinux : 113,
                CookedLinux : 144,
-               IrLAPHead : 783
+               IrLAPHead : 783,
+               CHDLC : 104
             }
 
 L3Types = { ETH_P_IP : IP,