From Mark C Brown,:
[obnox/wireshark/wip.git] / wiretap / wtap.c
index 0496ca4da67626241d296844a73690812a6681d0..7bdd451dff34d769eae5e052721dafa261768f87 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap.c
  *
- * $Id: wtap.c,v 1.92 2004/03/23 01:02:41 guy Exp $
+ * $Id$
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <string.h>
-#include <errno.h>
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+
+#include <string.h>
+#include <errno.h>
+
 #include "wtap-int.h"
 #include "file_wrappers.h"
 #include "buffer.h"
@@ -128,8 +129,8 @@ static const struct encap_type_info {
        /* WTAP_ENCAP_IEEE_802_11_WITH_RADIO */
        { "IEEE 802.11 Wireless LAN with radio information", "ieee-802-11-radio" },
 
-       /* WTAP_ENCAP_IEEE_802_11_WLAN_BSD */
-       { "IEEE 802.11 plus BSD WLAN header", "ieee-802-11-bsd" },
+       /* WTAP_ENCAP_IEEE_802_11_WLAN_RADIOTAP */
+       { "IEEE 802.11 plus radiotap WLAN header", "ieee-802-11-radiotap" },
 
        /* WTAP_ENCAP_IEEE_802_11_WLAN_AVS */
        { "IEEE 802.11 plus AVS WLAN header", "ieee-802-11-avs" },
@@ -247,6 +248,58 @@ static const struct encap_type_info {
 
        /* WTAP_ENCAP_APPLE_IP_OVER_IEEE1394 */
        { "Apple IP-over-IEEE 1394", "ap1394" },
+
+       /* WTAP_ENCAP_BACNET_MS_TP */
+       { "BACnet MS/TP", "bacnet-ms-tp" },
+
+       /* WTAP_ENCAP_NETTL_RAW_ICMP */
+       { "Raw ICMP with nettl headers", "raw-icmp-nettl" },
+
+       /* WTAP_ENCAP_NETTL_RAW_ICMPV6 */
+       { "Raw ICMPv6 with nettl headers", "raw-icmpv6-nettl" },
+
+       /* WTAP_ENCAP_GPRS_LLC */
+       { "GPRS LLC", "gprs-llc" },
+
+       /* WTAP_ENCAP_JUNIPER_ATM1 */
+       { "Juniper ATM1", "juniper-atm1" },
+
+       /* WTAP_ENCAP_JUNIPER_ATM2 */
+       { "Juniper ATM2", "juniper-atm2" },
+
+       /* WTAP_ENCAP_REDBACK */
+       { "Redback SmartEdge", "redback" },
+
+       /* WTAP_ENCAP_NETTL_RAW_IP */
+       { "Raw IP with nettl headers", "rawip-nettl" },
+
+       /* WTAP_ENCAP_NETTL_ETHERNET */
+       { "Ethernet with nettl headers", "ether-nettl" },
+
+       /* WTAP_ENCAP_NETTL_TOKEN_RING */
+       { "Token Ring with nettl headers", "tr-nettl" },
+
+       /* WTAP_ENCAP_NETTL_FDDI */
+       { "FDDI with nettl headers", "fddi-nettl" },
+
+       /* WTAP_ENCAP_NETTL_UNKNOWN */
+       { "Unknown link-layer type with nettl headers", "unknown-nettl" },
+
+       /* WTAP_ENCAP_MTP2_WITH_PHDR */
+       { "MTP2 with pseudoheader", "mtp2-with-phdr" },
+
+       /* WTAP_ENCAP_JUNIPER_PPPOE */
+       { "Juniper PPPoE", "juniper-pppoe" },
+
+       /* WTAP_ENCAP_GCOM_TIE1 */
+       { "GCOM TIE1", "gcom-tie1" },
+
+       /* WTAP_ENCAP_GCOM_SERIAL */
+       { "GCOM Serial", "gcom-serial" },
+
+       /* WTAP_ENCAP_NETTL_X25 */
+       { "X25 with nettl headers", "x25-nettl" },
+
 };
 
 /* Name that should be somewhat descriptive. */
@@ -301,6 +354,7 @@ static const char *wtap_errlist[] = {
        "Uncompression error: data oddly truncated",
        "Uncompression error: data would overflow buffer",
        "Uncompression error: bad LZ77 offset",
+       "The standard input cannot be opened for random access",
 };
 #define        WTAP_ERRLIST_SIZE       (sizeof wtap_errlist / sizeof wtap_errlist[0])
 
@@ -423,29 +477,6 @@ wtap_buf_ptr(wtap *wth)
        return buffer_start_ptr(wth->frame_buffer);
 }
 
-gboolean
-wtap_loop(wtap *wth, int count, wtap_handler callback, guchar* user, int *err,
-    gchar **err_info)
-{
-       long            data_offset;
-       int             loop = 0;
-
-       /* Start by clearing error flag */
-       *err = 0;
-
-       while ( (wtap_read(wth, err, err_info, &data_offset)) ) {
-               callback(user, &wth->phdr, data_offset,
-                   &wth->pseudo_header, buffer_start_ptr(wth->frame_buffer));
-               if (count > 0 && ++loop >= count)
-                       break;
-       }
-
-       if (*err == 0)
-               return TRUE;    /* success */
-       else
-               return FALSE;   /* failure */
-}
-
 gboolean
 wtap_seek_read(wtap *wth, long seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,