forked from osmocom/wireshark
More infrastructure changes for Ethereal - make
"wtap_file_type_string()" take, as its argument, a file type, rather than a "wtap *". Fix some range checks of file types to check against WTAP_NUM_FILE_TYPES rather than WTAP_NUM_ENCAP_TYPES. svn path=/trunk/; revision=1201
This commit is contained in:
parent
3b93574402
commit
3af8d95645
4
file.c
4
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.131 1999/12/04 06:27:03 guy Exp $
|
||||
* $Id: file.c,v 1.132 1999/12/04 08:51:41 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -163,7 +163,7 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
|
|||
cf->user_saved = !is_tempfile;
|
||||
|
||||
cf->cd_t = wtap_file_type(cf->wth);
|
||||
cf->cd_t_desc = wtap_file_type_string(cf->wth);
|
||||
cf->cd_t_desc = wtap_file_type_string(cf->cd_t);
|
||||
cf->first_packet = TRUE;
|
||||
cf->count = 0;
|
||||
cf->drops = 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* file.c
|
||||
*
|
||||
* $Id: file.c,v 1.33 1999/12/04 08:32:11 guy Exp $
|
||||
* $Id: file.c,v 1.34 1999/12/04 08:51:52 guy Exp $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
|
@ -250,18 +250,18 @@ const static struct file_type_info {
|
|||
NULL, NULL }
|
||||
};
|
||||
|
||||
const char *wtap_file_type_string(wtap *wth)
|
||||
const char *wtap_file_type_string(int filetype)
|
||||
{
|
||||
if (wth->file_type < 0 || wth->file_type >= WTAP_NUM_ENCAP_TYPES) {
|
||||
g_error("Unknown capture file type %d", wth->file_type);
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES) {
|
||||
g_error("Unknown capture file type %d", filetype);
|
||||
return NULL;
|
||||
} else
|
||||
return dump_open_table[wth->file_type].name;
|
||||
return dump_open_table[filetype].name;
|
||||
}
|
||||
|
||||
gboolean wtap_can_open(int filetype)
|
||||
{
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES
|
||||
|| dump_open_table[filetype].dump_open == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -270,7 +270,7 @@ gboolean wtap_can_open(int filetype)
|
|||
|
||||
gboolean wtap_can_dump_encap(int filetype, int encap)
|
||||
{
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES
|
||||
|| dump_open_table[filetype].can_dump_encap == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -320,7 +320,7 @@ static wtap_dumper* wtap_dump_open_common(FILE *fh, int filetype, int encap,
|
|||
{
|
||||
wtap_dumper *wdh;
|
||||
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_ENCAP_TYPES
|
||||
if (filetype < 0 || filetype >= WTAP_NUM_FILE_TYPES
|
||||
|| dump_open_table[filetype].dump_open == NULL) {
|
||||
/* Invalid type, or type we don't know how to write. */
|
||||
*err = WTAP_ERR_UNSUPPORTED_FILE_TYPE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* wtap.h
|
||||
*
|
||||
* $Id: wtap.h,v 1.52 1999/12/04 08:32:14 guy Exp $
|
||||
* $Id: wtap.h,v 1.53 1999/12/04 08:51:51 guy Exp $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu>
|
||||
|
@ -382,7 +382,7 @@ int wtap_fd(wtap *wth);
|
|||
int wtap_snapshot_length(wtap *wth); /* per file */
|
||||
int wtap_file_type(wtap *wth);
|
||||
int wtap_file_encap(wtap *wth);
|
||||
const char *wtap_file_type_string(wtap *wth);
|
||||
const char *wtap_file_type_string(int filetype);
|
||||
const char *wtap_strerror(int err);
|
||||
void wtap_close(wtap *wth);
|
||||
int wtap_seek_read (int file_type, FILE *fh, int seek_off, guint8 *pd, int len);
|
||||
|
|
Loading…
Reference in New Issue