A read can return WTAP_ERR_UNSUPPORTED_ENCAP if the encapsulation type

is per-packet and the packet has an encapsulation type we don't know
about, so handle it on reads as well as errors - show an error message
noting that we had a packet with a network type we don't know about, and
show the extra info returned for that error giving details.

It shouldn't return WTAP_ERR_UNSUPPORTED, however, so just give the
"wtap_strerror()" error for that case.

svn path=/trunk/; revision=11340
This commit is contained in:
Guy Harris 2004-07-08 07:45:46 +00:00
parent 6216591bdf
commit 5f1b5daf6b
1 changed files with 10 additions and 3 deletions

13
file.c
View File

@ -1,7 +1,7 @@
/* file.c
* File I/O routines
*
* $Id: file.c,v 1.386 2004/06/30 06:58:56 guy Exp $
* $Id: file.c,v 1.387 2004/07/08 07:45:46 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -488,7 +488,10 @@ cf_read(capture_file *cf)
switch (err) {
case WTAP_ERR_UNSUPPORTED_ENCAP:
errmsg = "The capture file is for a network type that Ethereal doesn't support.";
snprintf(errmsg_errno, sizeof(errmsg_errno),
"The capture file has a packet with a network type that Ethereal doesn't support.\n(%s)",
err_info);
errmsg = errmsg_errno;
break;
case WTAP_ERR_CANT_READ:
@ -2983,8 +2986,12 @@ cf_read_error_message(int err, gchar *err_info)
switch (err) {
case WTAP_ERR_UNSUPPORTED:
case WTAP_ERR_UNSUPPORTED_ENCAP:
snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" has a packet with a network type that Ethereal doesn't support.\n(%s)",
err_info);
break;
case WTAP_ERR_BAD_RECORD:
snprintf(errmsg_errno, sizeof(errmsg_errno),
"An error occurred while reading from the file \"%%s\": %s.\n(%s)",