Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, and
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Aug 1999 02:04:38 +0000 (02:04 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Aug 1999 02:04:38 +0000 (02:04 +0000)
wiretap support for RADCOM Ltd.'s WAN/LAN analyzers (see

http://www.radcom-inc.com/

).  Note: as I remember, IEEE 802.2/ISO 8022 LLC has somewhat of an SDLC
flavor to it, just as I think LAP, LAPB, LAPD, and so on do, so we may
be able to combine some of the LLC dissection and the LAPB dissection
into common code that could, conceivably be used for other SDLC-flavored
protocols.

Make "S" a mnemonic for "Summary" in the "Tools" menu.

Move the routine, used for the "Tools/Summary" display, that turns a
wiretap file type into a descriptive string for it into the wiretap
library itself, expand on some of its descriptions, and add an entry for
files from a RADCOM analyzer.

Have "Tools/Summary" display the snapshot length for the capture.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@416 f5534014-38df-0310-8fa8-9805f1628bb7

13 files changed:
Makefile.am
file.c
file.h
menu.c
packet.c
packet.h
proto.c
summary.c
wiretap/Makefile.am
wiretap/file.c
wiretap/ngsniffer.c
wiretap/wtap.c
wiretap/wtap.h

index 4398c21e00b4ca5a13bb0b5330e9f2c538edf532..1ef0898caa5fd43cc4d7f3b569b51bbf4de929ba 100644 (file)
@@ -57,6 +57,7 @@ ethereal_SOURCES = \
        packet-ipx.c   \
        packet-ipx.h   \
        packet-isakmp.c\
+       packet-lapb.c  \
        packet-llc.c   \
        packet-lpd.c   \
        packet-nbipx.c \
@@ -89,6 +90,7 @@ ethereal_SOURCES = \
        packet-udp.c   \
        packet-vines.c \
        packet-vines.h \
+       packet-x25.c   \
        packet.c       \
        packet.h       \
        prefs.c        \
diff --git a/file.c b/file.c
index 715365cdba781ddb54992b9d88e00d99929fe495..6dc9d7d69b4b055d1879862adb3032500d368621 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
 /* file.c
  * File I/O routines
  *
- * $Id: file.c,v 1.52 1999/07/28 20:53:40 deniel Exp $
+ * $Id: file.c,v 1.53 1999/08/02 02:04:25 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -119,12 +119,13 @@ open_cap_file(char *fname, capture_file *cf) {
   cf->filename = g_strdup( fname );
 
   /* Next, find out what type of file we're dealing with */
-  cf->cd_t  = WTAP_FILE_UNKNOWN;
-  cf->count = 0;
-  cf->drops = 0;
-  cf->esec  = 0;
-  cf->eusec = 0;
-  cf->snap  = 0;
+  cf->cd_t      = WTAP_FILE_UNKNOWN;
+  cf->cd_t_desc = "unknown";
+  cf->count     = 0;
+  cf->drops     = 0;
+  cf->esec      = 0;
+  cf->eusec     = 0;
+  cf->snap      = 0;
   firstsec = 0, firstusec = 0;
   lastsec = 0, lastusec = 0;
  
@@ -139,6 +140,7 @@ open_cap_file(char *fname, capture_file *cf) {
 
   cf->fh = wtap_file(cf->wth);
   cf->cd_t = wtap_file_type(cf->wth);
+  cf->cd_t_desc = wtap_file_type_string(cf->wth);
   cf->snap = wtap_snapshot_length(cf->wth);
   return (0);
 }
@@ -468,6 +470,7 @@ wtap_dispatch_cb(u_char *user, const struct wtap_pkthdr *phdr, int offset,
   fdata->lnk_t = phdr->pkt_encap;
   fdata->abs_secs  = phdr->ts.tv_sec;
   fdata->abs_usecs = phdr->ts.tv_usec;
+  fdata->flags = phdr->flags;
   fdata->cinfo = NULL;
 
   add_packet_to_packet_list(fdata, cf, buf);
diff --git a/file.h b/file.h
index 0bd34faad2c3d8daa9e129a9c087d3018ff0d4bb..c121e44846d7f4eebfa93908d2e9dc05319a8cba 100644 (file)
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
 /* file.h
  * Definitions for file structures and routines
  *
- * $Id: file.h,v 1.23 1999/07/24 03:22:50 guy Exp $
+ * $Id: file.h,v 1.24 1999/08/02 02:04:25 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -51,6 +51,7 @@ typedef struct _capture_file {
   gchar      *filename;  /* filename */
   long        f_len;     /* File length */
   guint16     cd_t;      /* Capture data type */
+  const gchar *cd_t_desc;/* Description of that data type */
   guint32     vers;      /* Version.  For tcpdump minor is appended to major */
   guint32     count;     /* Packet count */
   guint32     drops;     /* Dropped packets */
diff --git a/menu.c b/menu.c
index 71bd097c2211e1d227ce7f9b1dfbbfb82fb51fe5..128525cf15ace3968b36ee2a54548d47604b9baa 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -1,7 +1,7 @@
 /* menu.c
  * Menu routines
  *
- * $Id: menu.c,v 1.31 1999/07/28 03:33:34 guy Exp $
+ * $Id: menu.c,v 1.32 1999/08/02 02:04:26 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -102,7 +102,7 @@ static GtkItemFactoryEntry menu_items[] =
   {"/_Tools", NULL, NULL, 0, "<Branch>" },
   {"/Tools/_Follow TCP Stream", NULL, GTK_MENU_FUNC(follow_stream_cb), 0, NULL},
 /*  {"/Tools/Graph", NULL, NULL, 0, NULL}, future use */
-  {"/Tools/Summary", NULL, GTK_MENU_FUNC(summary_prep_cb), 0, NULL},
+  {"/Tools/_Summary", NULL, GTK_MENU_FUNC(summary_prep_cb), 0, NULL},
   {"/_Help", NULL, NULL, 0, "<LastBranch>" },
   {"/Help/_About Ethereal...", NULL, GTK_MENU_FUNC(about_ethereal), 0, NULL}
 };
index ac5a6704222543d59385abc6dea5dc37db1319d8..dd0ff111349bda3d0ff75d2e5f41454d686b81ee 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -1,7 +1,7 @@
 /* packet.c
  * Routines for packet disassembly
  *
- * $Id: packet.c,v 1.33 1999/07/28 23:16:33 guy Exp $
+ * $Id: packet.c,v 1.34 1999/08/02 02:04:26 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -681,6 +681,9 @@ dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree)
                case WTAP_ENCAP_PPP :
                        dissect_ppp(pd, fd, tree);
                        break;
+               case WTAP_ENCAP_LAPB :
+                       dissect_lapb(pd, fd, tree);
+                       break;
                case WTAP_ENCAP_RAW_IP :
                        dissect_raw(pd, fd, tree);
                        break;
index 9e310a7cc2d519fc551e5af0ffded15f7533e9de..a531e36e1aa1d4376de2750146883ea3058f533c 100644 (file)
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
 /* packet.h
  * Definitions for packet disassembly structures and routines
  *
- * $Id: packet.h,v 1.77 1999/07/31 18:18:43 guy Exp $
+ * $Id: packet.h,v 1.78 1999/08/02 02:04:26 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -114,6 +114,7 @@ typedef struct _frame_data {
   column_info *cinfo;     /* Column formatting information */
   int          lnk_t;     /* Per-packet encapsulation/data-link type */
   gboolean     passed_dfilter; /* TRUE = display, FALSE = no display */
+  guint8       flags;     /* for ENCAP_LAPB : 1st bit means From DCE */
 } frame_data;
 
 typedef struct _packet_info {
@@ -294,6 +295,8 @@ enum {
        ETT_SDP,
        ETT_RADIUS,
        ETT_RADIUS_AVP,
+       ETT_LAPB,
+       ETT_X25,
        NUM_TREE_TYPES  /* last item number plus one */
 };
 
@@ -379,6 +382,7 @@ void capture_ip(const u_char *, int, guint32, packet_counts *);
 void dissect_clip(const u_char *, frame_data *, proto_tree *);
 void dissect_eth(const u_char *, frame_data *, proto_tree *);
 void dissect_fddi(const u_char *, frame_data *, proto_tree *);
+void dissect_lapb(const u_char *, frame_data *, proto_tree *);
 void dissect_null(const u_char *, frame_data *, proto_tree *);
 void dissect_ppp(const u_char *, frame_data *, proto_tree *);
 void dissect_raw(const u_char *, frame_data *, proto_tree *);
@@ -395,6 +399,7 @@ void dissect_aarp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_arp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_bootp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_cdp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_cotp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_data(const u_char *, int, frame_data *, proto_tree *);
 void dissect_ddp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_dns(const u_char *, int, frame_data *, proto_tree *);
@@ -438,6 +443,7 @@ void dissect_vines_ipc(const u_char *, int, frame_data *, proto_tree *);
 void dissect_vines_rtp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_vines_spp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_payload_ppp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_x25(const u_char *, int, frame_data *, proto_tree *);
 
 void dissect_ftp(const u_char *, int, frame_data *, proto_tree *, int);
 void dissect_ftpdata(const u_char *, int, frame_data *, proto_tree *, int);
@@ -450,6 +456,7 @@ void dissect_pptp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_gre(const u_char *, int, frame_data *, proto_tree *);
 
 void init_dissect_udp(void);
+void init_dissect_x25(void);
 
 /* These functions are in ethertype.c */
 void capture_ethertype(guint16 etype, int offset,
diff --git a/proto.c b/proto.c
index 1b7ac4b474b98140e5ecc0769044901b2aae0e86..7c06f0c68783f8f1df1116faee7e1ffd6f09d0bf 100644 (file)
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
 /* proto.c
  * Routines for protocol tree
  *
- * $Id: proto.c,v 1.7 1999/08/01 04:28:09 gram Exp $
+ * $Id: proto.c,v 1.8 1999/08/02 02:04:27 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -102,6 +102,7 @@ void proto_register_ipsec(void);
 void proto_register_ipv6(void);
 void proto_register_ipx(void);
 void proto_register_isakmp(void);
+void proto_register_lapb(void);
 void proto_register_llc(void);
 void proto_register_nbipx(void);
 void proto_register_nbt(void);
@@ -126,6 +127,7 @@ void proto_register_tcp(void);
 void proto_register_tr(void);
 void proto_register_trmac(void);
 void proto_register_udp(void);
+void proto_register_x25(void);
 
 /* special-case header field used within proto.c */
 int hf_text_only = 1;
@@ -194,6 +196,7 @@ proto_init(void)
        proto_register_ipv6();
        proto_register_ipx();
        proto_register_isakmp();
+       proto_register_lapb();
        proto_register_llc();
        proto_register_nbipx();
        proto_register_nbt();
@@ -218,6 +221,7 @@ proto_init(void)
        proto_register_tr();
        proto_register_trmac();
        proto_register_udp();
+       proto_register_x25();
 
        /* Register one special-case FT_TEXT_ONLY field for use when
                converting ethereal to new-style proto_tree. These fields
index e147d7053efeae1c44683a1997cae7eb09cf0fc7..e6d94184084ee0f06c2c1278594e4e27a6bb2d36 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -1,7 +1,7 @@
 /* summary.c
  * Routines for capture file summary window
  *
- * $Id: summary.c,v 1.6 1999/07/13 03:08:06 gram Exp $
+ * $Id: summary.c,v 1.7 1999/08/02 02:04:27 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -83,29 +83,6 @@ extern capture_file  cf;
 /* Summary filter key */
 #define E_SUM_FILT_TE_KEY "sum_filt_te"
 
-char * string_for_format(guint16 cd_t){
-  switch (cd_t) {
-  case WTAP_FILE_WTAP:
-    return "wiretap";
-  case WTAP_FILE_PCAP:
-    return "pcap";
-  case WTAP_FILE_LANALYZER:
-    return "LanAlyzer";
-  case WTAP_FILE_NGSNIFFER:
-    return "Sniffer";
-  case WTAP_FILE_SNOOP:
-    return "snoop";
-  case WTAP_FILE_IPTRACE:
-    return "iptrace";
-  case WTAP_FILE_NETMON:
-    return "Network Monitor";
-  case WTAP_FILE_NETXRAY:
-    return "NetXray/Sniffer Pro";
-  default:
-    return "unknown";
-  }
-}
-
 double
 secs_usecs( guint32 s, guint32 us) {
   return (us / 1000000.0) + (double)s;
@@ -202,8 +179,11 @@ summary_prep_cb(GtkWidget *w, gpointer d) {
   add_string_to_box(string_buff, file_box);
 
   /* format */
-  snprintf(string_buff, SUM_STR_MAX, "Format: %s", 
-string_for_format(cf.cd_t));
+  snprintf(string_buff, SUM_STR_MAX, "Format: %s", cf.cd_t_desc);
+  add_string_to_box(string_buff, file_box);
+
+  /* snapshot length */
+  snprintf(string_buff, SUM_STR_MAX, "Snapshot length: %u", cf.snap);
   add_string_to_box(string_buff, file_box);
 
   /* Data frame */
index 5a0c014bcc6db96a68fd83bef24fbc13ce309ac2..b680ed18d6b714e094ff9ac1adb4438b76c838d9 100644 (file)
@@ -23,6 +23,8 @@ libwiretap_a_SOURCES = \
        netxray.h               \
        ngsniffer.c             \
        ngsniffer.h             \
+       radcom.c                \
+       radcom.h                \
        snoop.c                 \
        snoop.h                 \
        wtap.c                  \
index 83045fe0df20a81ebe40f6a162c636db09e75a05..54734a0df5fc210af09674b8c233edb359d8440f 100644 (file)
@@ -1,6 +1,6 @@
 /* file.c
  *
- * $Id: file.c,v 1.11 1999/07/13 02:53:23 gram Exp $
+ * $Id: file.c,v 1.12 1999/08/02 02:04:37 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -30,6 +30,7 @@
 #include "buffer.h"
 #include "lanalyzer.h"
 #include "ngsniffer.h"
+#include "radcom.h"
 #include "libpcap.h"
 #include "snoop.h"
 #include "iptrace.h"
@@ -66,6 +67,10 @@ wtap* wtap_open_offline(char *filename)
        if ((wth->file_type = ngsniffer_open(wth)) != WTAP_FILE_UNKNOWN) {
                goto success;
        }
+       /* WTAP_FILE_RADCOM */
+       if ((wth->file_type = radcom_open(wth)) != WTAP_FILE_UNKNOWN) {
+               goto success;
+       }
        /* WTAP_FILE_LANALYZER */
        if ((wth->file_type = lanalyzer_open(wth)) != WTAP_FILE_UNKNOWN) {
                goto success;
index 650f54480e724e502c904c187917f437ebc25c2f..03b429a709d4a642c9d3f9686c9908a210db3837 100644 (file)
@@ -1,6 +1,6 @@
 /* ngsniffer.c
  *
- * $Id: ngsniffer.c,v 1.13 1999/07/13 02:53:25 gram Exp $
+ * $Id: ngsniffer.c,v 1.14 1999/08/02 02:04:37 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -253,7 +253,7 @@ static int sniffer_encap[] = {
                WTAP_ENCAP_NONE,        /* PC Network broadband */
                WTAP_ENCAP_NONE,        /* LocalTalk */
                WTAP_ENCAP_NONE,        /* Znet */
-               WTAP_ENCAP_NONE,        /* Internetwork analyzer */
+               WTAP_ENCAP_LAPB,        /* Internetwork analyzer */
                WTAP_ENCAP_NONE,        /* type 8 not defined in Sniffer */
                WTAP_ENCAP_FDDI,
                WTAP_ENCAP_NONE         /* ATM */
@@ -641,6 +641,8 @@ int ngsniffer_read(wtap *wth)
                        t = (double)time_low+(double)(time_med)*65536.0 +
                            (double)time_high*4294967296.0;
 
+                       wth->phdr.flags = frame2.fs & 0x80;
+
                        goto found;
 
                case REC_FRAME4:
index c05b491217d92c21a948fd45013f8956b83f2bc6..a025806c7a4e50e0034b9344dde36712a845aac8 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap.c
  *
- * $Id: wtap.c,v 1.11 1999/07/28 20:17:24 deniel Exp $
+ * $Id: wtap.c,v 1.12 1999/08/02 02:04:38 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
@@ -36,12 +36,47 @@ int wtap_file_type(wtap *wth)
        return wth->file_type;
 }
 
-
 int wtap_snapshot_length(wtap *wth)
 {
        return wth->snapshot_length;
 }
 
+const char *wtap_file_type_string(wtap *wth)
+{
+       switch (wth->file_type) {
+               case WTAP_FILE_WTAP:
+                       return "wiretap";
+
+               case WTAP_FILE_PCAP:
+                       return "pcap";
+
+               case WTAP_FILE_LANALYZER:
+                       return "Novell LANalyzer";
+
+               case WTAP_FILE_NGSNIFFER:
+                       return "Network Associates Sniffer (DOS-based)";
+
+               case WTAP_FILE_SNOOP:
+                       return "snoop";
+
+               case WTAP_FILE_IPTRACE:
+                       return "iptrace";
+
+               case WTAP_FILE_NETMON:
+                       return "Microsoft Network Monitor";
+
+               case WTAP_FILE_NETXRAY:
+                       return "Cinco Networks NetXRay/Network Associates Sniffer (Windows-based)";
+
+               case WTAP_FILE_RADCOM:
+                       return "RADCOM WAN/LAN analyzer";
+
+               default:
+                       g_error("Unknown capture file type %d", wth->file_type);
+                       return NULL;
+       }
+}
+
 void wtap_close(wtap *wth)
 {
        /* free up memory. If any capture structure ever allocates
index a65e96c1738cedaaa684e3b9d8cb3e69c7538ac4..32a6c7d9d53b7f0719964aa4bfcb692dae048d42 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap.h
  *
- * $Id: wtap.h,v 1.21 1999/07/28 23:16:42 guy Exp $
+ * $Id: wtap.h,v 1.22 1999/08/02 02:04:38 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
 #define WTAP_ENCAP_ARCNET                      7
 #define WTAP_ENCAP_ATM_RFC1483                 8
 #define WTAP_ENCAP_LINUX_ATM_CLIP              9
+#define WTAP_ENCAP_LAPB                                10
 
 /* last WTAP_ENCAP_ value + 1 */
-#define WTAP_NUM_ENCAP_TYPES                   10
+#define WTAP_NUM_ENCAP_TYPES                   11
 
 /* File types that can be read by wiretap */
 #define WTAP_FILE_UNKNOWN                      0
@@ -57,6 +58,7 @@
 #define WTAP_FILE_IPTRACE                      7
 #define WTAP_FILE_NETMON                       8
 #define WTAP_FILE_NETXRAY                      9
+#define WTAP_FILE_RADCOM                       10
 
 /* Filter types that wiretap can create. An 'offline' filter is really
  * a BPF filter, but it is treated specially because wiretap might not know
@@ -89,6 +91,10 @@ typedef struct {
        int     is_atm;
 } ngsniffer_t;
 
+typedef struct {
+       time_t  start;
+} radcom_t;
+
 typedef struct {
        guint16 pkt_len;
        guint32 totpktt;
@@ -122,6 +128,7 @@ struct wtap_pkthdr {
        guint32 caplen;
        guint32 len;
        int pkt_encap;
+       guint8  flags; /* ENCAP_LAPB : 1st bit means From DCE */
 };
 
 typedef void (*wtap_handler)(u_char*, const struct wtap_pkthdr*,
@@ -143,6 +150,7 @@ typedef struct wtap {
                libpcap_t               *pcap;
                lanalyzer_t             *lanalyzer;
                ngsniffer_t             *ngsniffer;
+               radcom_t                *radcom;
                netmon_t                *netmon;
                netxray_t               *netxray;
        } capture;
@@ -161,6 +169,7 @@ void wtap_loop(wtap *wth, int, wtap_handler, u_char*);
 FILE* wtap_file(wtap *wth);
 int wtap_snapshot_length(wtap *wth); /* per file */
 int wtap_file_type(wtap *wth);
+const char *wtap_file_type_string(wtap *wth);
 void wtap_close(wtap *wth);