Wireshark-dev: [Wireshark-dev] patch to support DLT_JUNIPER_VP
From: Hannes Gredler <[email protected]>
Date: Wed, 16 Aug 2006 14:35:27 +0200
hi wireshark developers,

attached a patch that adds support for dissection of
libpcap DLT_JUNIPER_VP frames. In addition i have fixed
also the indent for DLT_JUNIPER_GGSN.

asking for inclusion.

kind rgds,

/hannes
Index: epan/dissectors/packet-juniper.c
===================================================================
--- epan/dissectors/packet-juniper.c	(revision 18926)
+++ epan/dissectors/packet-juniper.c	(working copy)
@@ -1217,6 +1217,37 @@
 
 }
 
+static void dissect_juniper_vp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
+
+  proto_item *ti;
+  guint      offset = 0;
+  int        bytes_processed;
+  guint8     flags;
+
+  if (check_col(pinfo->cinfo, COL_PROTOCOL))
+      col_set_str(pinfo->cinfo, COL_PROTOCOL, "Juniper Voice PIC");
+  if (check_col(pinfo->cinfo, COL_INFO))
+      col_clear(pinfo->cinfo, COL_INFO);
+    
+  ti = proto_tree_add_text (tree, tvb, offset, 4, "Juniper Voice PIC");
+
+  /* parse header, match mgc, extract flags and build first tree */
+  bytes_processed = dissect_juniper_header(tvb, pinfo, tree, ti, &flags);
+
+  if(bytes_processed == -1)
+      return;
+  else
+      offset+=bytes_processed;
+
+  /*
+   * Right know IPv4 is the only protocol we may encounter.
+   * For the future there should be sufficient space in the 18-byte
+   * empty header before payload starts.
+   */
+  dissect_juniper_payload_proto(tvb, pinfo, tree, ti, PROTO_IP, offset+18);
+}
+
+
 /* list of Juniper supported PPP proto IDs */
 static gboolean
 ppp_heuristic_guess(guint16 proto) {
@@ -1450,6 +1481,7 @@
   dissector_handle_t juniper_frelay_handle;
   dissector_handle_t juniper_chdlc_handle;
   dissector_handle_t juniper_ggsn_handle;
+  dissector_handle_t juniper_vp_handle;
 
   osinl_subdissector_table = find_dissector_table("osinl");
   osinl_excl_subdissector_table = find_dissector_table("osinl.excl");
@@ -1474,6 +1506,7 @@
   juniper_frelay_handle = create_dissector_handle(dissect_juniper_frelay, proto_juniper);
   juniper_chdlc_handle = create_dissector_handle(dissect_juniper_chdlc, proto_juniper);
   juniper_ggsn_handle = create_dissector_handle(dissect_juniper_ggsn, proto_juniper);
+  juniper_vp_handle = create_dissector_handle(dissect_juniper_vp, proto_juniper);
     
   dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_ATM2, juniper_atm2_handle);
   dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_ATM1, juniper_atm1_handle);
@@ -1485,6 +1518,7 @@
   dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_FRELAY, juniper_frelay_handle);
   dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_CHDLC, juniper_chdlc_handle);
   dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_GGSN, juniper_ggsn_handle);
+  dissector_add("wtap_encap", WTAP_ENCAP_JUNIPER_VP, juniper_vp_handle);
 
 }
 
Index: wiretap/wtap.c
===================================================================
--- wiretap/wtap.c	(revision 18926)
+++ wiretap/wtap.c	(working copy)
@@ -360,6 +360,9 @@
 
 	/* WTAP_ENCAP_BER */
 	{ "ASN.1 Basic Encoding Rules", "ber" },
+
+	/* WTAP_ENCAP_JUNIPER_VP */
+	{ "Juniper Voice PIC", "juniper-vp" },
 };
 
 /* Name that should be somewhat descriptive. */
Index: wiretap/wtap.h
===================================================================
--- wiretap/wtap.h	(revision 18926)
+++ wiretap/wtap.h	(working copy)
@@ -181,9 +181,10 @@
 #define WTAP_ENCAP_LINUX_LAPD			88
 #define WTAP_ENCAP_CATAPULT_DCT2000             89
 #define WTAP_ENCAP_BER                          90
+#define WTAP_ENCAP_JUNIPER_VP                   91
 
 /* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES			91
+#define WTAP_NUM_ENCAP_TYPES			92
 
 /* File types that can be read by wiretap.
    We support writing some many of these file types, too, so we
Index: wiretap/libpcap.c
===================================================================
--- wiretap/libpcap.c	(revision 18926)
+++ wiretap/libpcap.c	(working copy)
@@ -328,7 +328,7 @@
 	{ 129,		WTAP_ENCAP_ARCNET_LINUX },
         { 130,          WTAP_ENCAP_JUNIPER_MLPPP }, /* Juniper MLPPP on ML-, LS-, AS- PICs */
         { 131,          WTAP_ENCAP_JUNIPER_MLFR }, /* Juniper MLFR (FRF.15) on ML-, LS-, AS- PICs */
-    {133, WTAP_ENCAP_JUNIPER_GGSN},
+        { 133,          WTAP_ENCAP_JUNIPER_GGSN},
 	/*
 	 * Values 132-134, 136 not listed here are reserved for use
 	 * in Juniper hardware.
@@ -408,6 +408,8 @@
         { 180,          WTAP_ENCAP_JUNIPER_FRELAY },
         /* C-HDLC frames prepended with meta-information */
         { 181,          WTAP_ENCAP_JUNIPER_CHDLC },
+        /* VOIP Frames prepended with meta-information */
+        { 183,          WTAP_ENCAP_JUNIPER_VP },
 
 
 	/*