forked from osmocom/wireshark
"wtap_pcap_encap_to_wtap_encap()" shouldn't return a file type if it
can't translate the encapsulation type, it should return an encapsulation type; we add a new one, WTAP_ENCAP_UNKNOWN. and have it return that. Have "capture()" handle "wtap_pcap_encap_to_wtap_encap()" returning that encapsulation type (if it happens, we need to add a new Wiretap encapsulation type to handle the new "libpcap" encapsulation type). svn path=/trunk/; revision=513
This commit is contained in:
parent
c1adce9762
commit
31d104a9c5
|
@ -1,7 +1,7 @@
|
|||
/* capture.c
|
||||
* Routines for packet capture windows
|
||||
*
|
||||
* $Id: capture.c,v 1.54 1999/08/18 04:41:12 guy Exp $
|
||||
* $Id: capture.c,v 1.55 1999/08/18 17:08:39 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -467,6 +467,11 @@ capture(void) {
|
|||
if (pch) {
|
||||
ld.linktype = pcap_datalink(pch);
|
||||
ld.wtap_linktype = wtap_pcap_encap_to_wtap_encap(ld.linktype);
|
||||
if (ld.wtap_linktype == WTAP_ENCAP_UNKNOWN) {
|
||||
errmsg = "The network you're capturing from is of a type"
|
||||
" that Ethereal doesn't support.";
|
||||
goto fail;
|
||||
}
|
||||
ld.pdh = wtap_dump_fdopen(cf.save_file_fd, WTAP_FILE_PCAP,
|
||||
ld.wtap_linktype, pcap_snapshot(pch), &err);
|
||||
|
||||
|
@ -496,6 +501,7 @@ capture(void) {
|
|||
errmsg = errmsg_errno;
|
||||
break;
|
||||
}
|
||||
fail:
|
||||
snprintf(err_str, PCAP_ERRBUF_SIZE, errmsg, cf.save_file);
|
||||
simple_dialog(ESD_TYPE_WARN, NULL, err_str);
|
||||
pcap_close(pch);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* libpcap.c
|
||||
*
|
||||
* $Id: libpcap.c,v 1.8 1999/08/18 04:41:19 guy Exp $
|
||||
* $Id: libpcap.c,v 1.9 1999/08/18 17:08:47 guy Exp $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
|
@ -232,7 +232,7 @@ static int libpcap_read(wtap *wth)
|
|||
int wtap_pcap_encap_to_wtap_encap(int encap)
|
||||
{
|
||||
if (encap < 0 || encap >= NUM_PCAP_ENCAPS)
|
||||
return WTAP_FILE_UNKNOWN;
|
||||
return WTAP_ENCAP_UNKNOWN;
|
||||
return pcap_encap[encap];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* wtap.h
|
||||
*
|
||||
* $Id: wtap.h,v 1.25 1999/08/18 04:41:20 guy Exp $
|
||||
* $Id: wtap.h,v 1.26 1999/08/18 17:08:47 guy Exp $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
|
@ -37,7 +37,11 @@
|
|||
* WTAP_ENCAP_PER_PACKET is a value passed to "wtap_dump_open()" or
|
||||
* "wtap_dump_fdopen()" to indicate that there is no single encapsulation
|
||||
* type for all packets in the file; this may cause those routines to
|
||||
* fail if the capture file format being written can't support that. */
|
||||
* fail if the capture file format being written can't support that.
|
||||
*
|
||||
* WTAP_ENCAP_UNKNOWN is returned by "wtap_pcap_encap_to_wtap_encap()"
|
||||
* if it's handed an unknown encapsulation. */
|
||||
#define WTAP_ENCAP_UNKNOWN -2
|
||||
#define WTAP_ENCAP_PER_PACKET -1
|
||||
#define WTAP_ENCAP_NONE 0
|
||||
#define WTAP_ENCAP_ETHERNET 1
|
||||
|
|
Loading…
Reference in New Issue