Ethereal-dev: [Ethereal-dev] More CCP config options added

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Sat, 12 Jan 2002 00:22:32 +0900 (JST)
Hi,

I added the following CCP config options support to the PPP dissector:

 1) BSD Compress
 2) MVRCA (Magnalink)
 3) Deflate

Please take a look and check it in. 

Regards,

=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
 +----+----+     
 |.. .|    |     Motonori Shindo
 |_~__|    |     
 | .. |~~_~|     Sr. Systems Engineer
 | .  |    |     CoSine Communications Inc.
 +----+----+     
 C o S i n e     e-mail:  mshindo@xxxxxxxxxxxxx 
Communications
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=

Index: packet-ppp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ppp.c,v
retrieving revision 1.84
diff -u -r1.84 packet-ppp.c
--- packet-ppp.c	2002/01/03 20:30:32	1.84
+++ packet-ppp.c	2002/01/11 15:16:35
@@ -82,7 +82,10 @@
 static gint ett_ccp_options = -1;
 static gint ett_ccp_stac_opt = -1;
 static gint ett_ccp_mppc_opt = -1;
+static gint ett_ccp_bsdcomp_opt = -1;
 static gint ett_ccp_lzsdcp_opt = -1;
+static gint ett_ccp_mvrca_opt = -1;
+static gint ett_ccp_deflate_opt = -1;
 
 static int proto_cbcp = -1;
 
@@ -871,9 +874,9 @@
 #define CI_CCP_HPPPC	16	/* Hewlett-Packard PPC (RFC1962) */
 #define CI_CCP_STAC	17	/* stac Electronics LZS (RFC1974) */
 #define CI_CCP_MPPC	18	/* Microsoft PPC (RFC2218/3078) */
-#define CI_CCP_GFZA	19	/* Gandalf FZA */
+#define CI_CCP_GFZA	19	/* Gandalf FZA (RFC1962) */
 #define CI_CCP_V42BIS	20	/* V.42bis compression */
-#define CI_CCP_BSDLZW	21	/* BSD LZW Compress */
+#define CI_CCP_BSDLZW	21	/* BSD LZW Compress (RFC1977) */
 #define CI_CCP_LZSDCP	23	/* LZS-DCP (RFC1967) */
 #define CI_CCP_MVRCA	24	/* MVRCA (Magnalink) (RFC1975) */
 #define CI_CCP_DEFLATE	26	/* Deflate (RFC1979) */
@@ -898,10 +901,22 @@
                         int offset, guint length, packet_info *pinfo,
 			proto_tree *tree);
 
+static void dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+                        int offset, guint length, packet_info *pinfo,
+			proto_tree *tree);
+
 static void dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
                         int offset, guint length, packet_info *pinfo,
 			proto_tree *tree);
 
+static void dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+                        int offset, guint length, packet_info *pinfo,
+			proto_tree *tree);
+
+static void dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+                        int offset, guint length, packet_info *pinfo,
+			proto_tree *tree);
+
 static const ip_tcp_opt ccp_opts[] = {
 	{
 		CI_CCP_STAC,
@@ -923,14 +938,37 @@
 		dissect_ccp_mppc_opt
 	},
 	{
+		CI_CCP_BSDLZW,
+		"BSD Compress",
+		&ett_ccp_bsdcomp_opt,
+		FIXED_LENGTH,
+		3,
+		dissect_ccp_bsdcomp_opt
+	},
+	{
 		CI_CCP_LZSDCP,
 		"LZS-DCP",
 		&ett_ccp_lzsdcp_opt,
 		FIXED_LENGTH,
 		6,
 		dissect_ccp_lzsdcp_opt
-	}
-
+	},
+	{
+		CI_CCP_MVRCA,
+		"MVRCA (Magnalink)",
+		&ett_ccp_mvrca_opt,
+		FIXED_LENGTH,
+		4,
+		dissect_ccp_mvrca_opt
+	},
+	{
+		CI_CCP_DEFLATE,
+		"Deflate",
+		&ett_ccp_deflate_opt,
+		FIXED_LENGTH,
+		4,   /* RFC1979 says the length is 3 but it's actually 4. */
+		dissect_ccp_deflate_opt
+	},
 };
 
 #define N_CCP_OPTS	(sizeof ccp_opts / sizeof ccp_opts[0])
@@ -1770,6 +1808,22 @@
 }
 
 static void
+dissect_ccp_bsdcomp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+			int offset, guint length, packet_info *pinfo,
+			proto_tree *tree)
+{
+  proto_item *tf;
+
+  tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
+
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Version: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Dict: %u bits", 
+		      tvb_get_guint8(tvb, offset + 2) & 0x1f);
+}
+
+static void
 dissect_ccp_lzsdcp_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
 			int offset, guint length, packet_info *pinfo,
 			proto_tree *tree)
@@ -1791,6 +1845,47 @@
 }
 
 static void
+dissect_ccp_mvrca_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+			int offset, guint length, packet_info *pinfo,
+			proto_tree *tree)
+{
+  proto_item *tf;
+
+  tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
+
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Features: %u", tvb_get_guint8(tvb, offset + 2) >> 5);
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Packet by Packet flag: %s", 
+		      tvb_get_guint8(tvb, offset + 2) & 0x20 ? "true" : "false");
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "History: %u", tvb_get_guint8(tvb, offset + 2) & 0x20);
+  proto_tree_add_text(tf, tvb, offset + 3, 1,
+		      "Number of contexts: %u", tvb_get_guint8(tvb, offset + 3));
+}
+
+static void
+dissect_ccp_deflate_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
+			int offset, guint length, packet_info *pinfo,
+			proto_tree *tree)
+{
+  proto_item *tf;
+  guint8 method;
+
+  tf = proto_tree_add_text(tree, tvb, offset, length, "%s", optp->name);
+
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Window: %u", hi_nibble(tvb_get_guint8(tvb, offset + 2)));
+  method = lo_nibble(tvb_get_guint8(tvb, offset + 2));
+  proto_tree_add_text(tf, tvb, offset + 2, 1,
+		      "Method: %s (0x%02x)", 
+		      method == 0x08 ?  "zlib compression" : "other", method);
+  proto_tree_add_text(tf, tvb, offset + 3, 1,
+		      "Sequence number check method: %u", 
+		      tvb_get_guint8(tvb, offset + 2) & 0x03);
+}
+
+static void
 dissect_cbcp_no_callback_opt(const ip_tcp_opt *optp, tvbuff_t *tvb,
 			int offset, guint length, packet_info *pinfo,
 			proto_tree *tree)
@@ -2929,7 +3024,10 @@
     &ett_ccp_options,
     &ett_ccp_stac_opt,
     &ett_ccp_mppc_opt,
-    &ett_ccp_lzsdcp_opt
+    &ett_ccp_bsdcomp_opt,
+    &ett_ccp_lzsdcp_opt,
+    &ett_ccp_mvrca_opt,
+    &ett_ccp_deflate_opt,
   };
 
   proto_ccp = proto_register_protocol("PPP Compression Control Protocol", 
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1010762571"):
  Replaced MIME boundary: >>--Next_Part--<<
                    with: >>MIMEStream=_0+252753_5173818931725_15781689482<<
  Writer (pos="1050"):
    Total modifications so far: 1

  Part (pos="1096"):
    SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="1730"):
    SanitizeFile (filename="more-ccp-conf-opt.diff", mimetype="Text/Plain"):
      Match (rule="default"):
        Enforced policy: accept


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.32 2001/10/11 19:27:15 bre Exp $