When doing a capture, decode enough of the incoming packets to correctly
[obnox/wireshark/wip.git] / packet-raw.c
index 1f02eaed2050076e18551f04d6a5501ca8f2460f..455a72ec486a6cf496ec45af23d86a842f53fc2b 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-raw.c
  * Routines for raw packet disassembly
  *
- * $Id: packet-raw.c,v 1.2 1998/09/16 03:22:09 gerald Exp $
+ * $Id: packet-raw.c,v 1.8 1999/02/09 00:35:38 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
 # include "config.h"
 #endif
 
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
 #include <gtk/gtk.h>
 #include <stdio.h>
-#include <pcap.h>
 
-#include "packet.h"
 #include "ethereal.h"
+#include "packet.h"
+
+void
+capture_raw( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
+
+  /* So far, the only time we get raw connection types are with Linux and
+   * Irix PPP connections.  We can't tell what type of data is coming down
+   * the line, so our safest bet is IP. - GCC
+   */
+   
+  /* Currently, the Linux 2.1.xxx PPP driver passes back some of the header
+   * sometimes.  This check should be removed when 2.2 is out.
+   */
+  if (pd[0] == 0xff && pd[1] == 0x03)
+    capture_ip(pd, 4, cap_len, ld);
+  else
+    capture_ip(pd, 0, cap_len, ld);
+}
 
 void
 dissect_raw( const u_char *pd, frame_data *fd, GtkTree *tree ) {
@@ -41,18 +61,20 @@ dissect_raw( const u_char *pd, frame_data *fd, GtkTree *tree ) {
 
   /* load the top pane info. This should be overwritten by
      the next protocol in the stack */
-  if(fd->win_info[0]) {
-    strcpy(fd->win_info[1], "N/A" );
-    strcpy(fd->win_info[2], "N/A" );
-    strcpy(fd->win_info[4], "Raw packet data" );
-  }
+  if(check_col(fd, COL_RES_DL_SRC))
+    col_add_str(fd, COL_RES_DL_SRC, "N/A" );
+  if(check_col(fd, COL_RES_DL_DST))
+    col_add_str(fd, COL_RES_DL_DST, "N/A" );
+  if(check_col(fd, COL_PROTOCOL))
+    col_add_str(fd, COL_PROTOCOL, "N/A" );
+  if(check_col(fd, COL_INFO))
+    col_add_str(fd, COL_INFO, "Raw packet data" );
 
   /* populate a tree in the second pane with the status of the link
      layer (ie none) */
   if(tree) {
     ti = add_item_to_tree( GTK_WIDGET(tree), 0, 0,
-                          "Raw packet data (%d on link, %d captured)",
-                          fd->pkt_len, fd->cap_len );
+                          "Raw packet data" );
     fh_tree = gtk_tree_new();
     add_subtree(ti, fh_tree, ETT_RAW);
     add_item_to_tree(fh_tree, 0, 0, "No link information available");
@@ -71,4 +93,4 @@ dissect_raw( const u_char *pd, frame_data *fd, GtkTree *tree ) {
   else
     dissect_ip(pd, 0, fd, tree);
 }
-    
+