forked from osmocom/wireshark
Handle "I can't map this for that file format" better.
For cases where record (meta)data is something that can't be written out in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along with an err_info string. Report (and free) that err_info string in cases where WTAP_ERR_UNWRITABLE_REC_DATA is returned. Clean up some other error reporting cases, and flag with an XXX some cases where we aren't reporting errors at all, while we're at it. Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3 Reviewed-on: https://code.wireshark.org/review/5823 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
8ce0f12201
commit
51522b3372
|
@ -908,6 +908,7 @@ process_cap_file(wtap *wth, const char *filename)
|
|||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_DECOMPRESS:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
/* fallthrough */
|
||||
|
@ -1488,6 +1489,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_DECOMPRESS:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
|
|
@ -259,6 +259,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
|
36
editcap.c
36
editcap.c
|
@ -1253,6 +1253,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
@ -1638,7 +1639,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (!wtap_dump(pdh, phdr, buf, &err)) {
|
||||
if (!wtap_dump(pdh, phdr, buf, &err, &err_info)) {
|
||||
switch (err) {
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
/*
|
||||
|
@ -1648,7 +1649,7 @@ main(int argc, char *argv[])
|
|||
* and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"editcap: Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file\n.",
|
||||
"editcap: Frame %u of \"%s\" has a network type that can't be saved in a \"%s\" file.\n",
|
||||
read_count, argv[optind],
|
||||
wtap_file_type_subtype_string(out_file_type_subtype));
|
||||
break;
|
||||
|
@ -1661,11 +1662,39 @@ main(int argc, char *argv[])
|
|||
* and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"editcap: Frame %u of \"%s\" is too large for a \"%s\" file\n.",
|
||||
"editcap: Frame %u of \"%s\" is too large for a \"%s\" file.\n",
|
||||
read_count, argv[optind],
|
||||
wtap_file_type_subtype_string(out_file_type_subtype));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're
|
||||
* writing and the file type and subtype we're
|
||||
* writing; note that, and report the record number
|
||||
* and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"editcap: Record %u of \"%s\" has a record type that can't be saved in a \"%s\" file.\n",
|
||||
read_count, argv[optind],
|
||||
wtap_file_type_subtype_string(out_file_type_subtype));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular record we're
|
||||
* writing and the file type and subtype we're
|
||||
* writing; note that, and report the record number
|
||||
* and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"editcap: Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
|
||||
read_count, argv[optind],
|
||||
wtap_file_type_subtype_string(out_file_type_subtype),
|
||||
err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n",
|
||||
filename, wtap_strerror(err));
|
||||
|
@ -1691,6 +1720,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
|
|
@ -301,6 +301,7 @@ WSLUA_METHOD Dumper_dump(lua_State* L) {
|
|||
struct wtap_pkthdr pkthdr;
|
||||
double ts;
|
||||
int err;
|
||||
gchar *err_info;
|
||||
|
||||
if (!d) return 0;
|
||||
|
||||
|
@ -335,9 +336,20 @@ WSLUA_METHOD Dumper_dump(lua_State* L) {
|
|||
/* TODO: Can we get access to pinfo->pkt_comment here somehow? We
|
||||
* should be copying it to pkthdr.opt_comment if we can. */
|
||||
|
||||
if (! wtap_dump(d, &pkthdr, ba->data, &err)) {
|
||||
luaL_error(L,"error while dumping: %s",
|
||||
wtap_strerror(err));
|
||||
if (! wtap_dump(d, &pkthdr, ba->data, &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
luaL_error(L,"error while dumping: %s (%s)",
|
||||
wtap_strerror(err), err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
luaL_error(L,"error while dumping: %s",
|
||||
wtap_strerror(err));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -402,6 +414,7 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) {
|
|||
tvbuff_t* tvb;
|
||||
struct data_source *data_src;
|
||||
int err = 0;
|
||||
gchar *err_info;
|
||||
|
||||
if (!d) return 0;
|
||||
|
||||
|
@ -432,9 +445,20 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) {
|
|||
|
||||
data = (const guchar *)tvb_memdup(wmem_packet_scope(),tvb,0,pkthdr.caplen);
|
||||
|
||||
if (! wtap_dump(d, &pkthdr, data, &err)) {
|
||||
luaL_error(L,"error while dumping: %s",
|
||||
wtap_strerror(err));
|
||||
if (! wtap_dump(d, &pkthdr, data, &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
luaL_error(L,"error while dumping: %s (%s)",
|
||||
wtap_strerror(err), err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
luaL_error(L,"error while dumping: %s",
|
||||
wtap_strerror(err));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1948,7 +1948,7 @@ wslua_filehandler_can_write_encap(int encap, void* data)
|
|||
/* some declarations */
|
||||
static gboolean
|
||||
wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean
|
||||
wslua_filehandler_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
|
@ -2019,7 +2019,7 @@ wslua_filehandler_dump_open(wtap_dumper *wdh, int *err)
|
|||
*/
|
||||
static gboolean
|
||||
wslua_filehandler_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
FileHandler fh = (FileHandler)(wdh->wslua_data);
|
||||
int retval = -1;
|
||||
|
|
61
file.c
61
file.c
|
@ -1248,7 +1248,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
int out_fd;
|
||||
wtap_dumper *pdh;
|
||||
int open_err, read_err, write_err, close_err;
|
||||
gchar *err_info;
|
||||
gchar *err_info, *write_err_info;
|
||||
int err_fileno;
|
||||
int i;
|
||||
gboolean got_read_error = FALSE, got_write_error = FALSE;
|
||||
|
@ -1491,7 +1491,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
phdr->presence_flags = phdr->presence_flags | WTAP_HAS_INTERFACE_ID;
|
||||
}
|
||||
if (!wtap_dump(pdh, wtap_phdr(in_file->wth),
|
||||
wtap_buf_ptr(in_file->wth), &write_err)) {
|
||||
wtap_buf_ptr(in_file->wth), &write_err, &write_err_info)) {
|
||||
got_write_error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -1599,6 +1599,36 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
g_free(display_basename);
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing and
|
||||
* the file type and subtype we're writing; note that, and report
|
||||
* the record number and file type/subtype.
|
||||
*/
|
||||
display_basename = g_filename_display_basename(in_file ? in_file->filename : "UNKNOWN");
|
||||
simple_error_message_box(
|
||||
"Record %u of \"%s\" has a record type that can't be saved in a \"%s\" file.",
|
||||
in_file ? in_file->packet_num : 0, display_basename,
|
||||
wtap_file_type_subtype_string(file_type));
|
||||
g_free(display_basename);
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing and
|
||||
* the file type and subtype we're writing; note that, and report
|
||||
* the frame number and file type/subtype.
|
||||
*/
|
||||
display_basename = g_filename_display_basename(in_file ? in_file->filename : "UNKNOWN");
|
||||
simple_error_message_box(
|
||||
"Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)",
|
||||
in_file ? in_file->packet_num : 0, display_basename,
|
||||
wtap_file_type_subtype_string(file_type),
|
||||
write_err_info);
|
||||
g_free(write_err_info);
|
||||
g_free(display_basename);
|
||||
break;
|
||||
|
||||
default:
|
||||
display_basename = g_filename_display_basename(out_filename);
|
||||
simple_error_message_box(
|
||||
|
@ -4098,6 +4128,7 @@ save_record(capture_file *cf, frame_data *fdata,
|
|||
save_callback_args_t *args = (save_callback_args_t *)argsp;
|
||||
struct wtap_pkthdr hdr;
|
||||
int err;
|
||||
gchar *err_info;
|
||||
gchar *display_basename;
|
||||
const char *pkt_comment;
|
||||
|
||||
|
@ -4145,7 +4176,7 @@ save_record(capture_file *cf, frame_data *fdata,
|
|||
hdr.pack_flags = /* XXX - 0 for now (any value for "we don't have it"?) */
|
||||
#endif
|
||||
/* and save the packet */
|
||||
if (!wtap_dump(args->pdh, &hdr, pd, &err)) {
|
||||
if (!wtap_dump(args->pdh, &hdr, pd, &err, &err_info)) {
|
||||
if (err < 0) {
|
||||
/* Wiretap error. */
|
||||
switch (err) {
|
||||
|
@ -4172,6 +4203,30 @@ save_record(capture_file *cf, frame_data *fdata,
|
|||
fdata->num, wtap_file_type_subtype_string(args->file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing and
|
||||
* the file type and subtype we're writing; note that, and report
|
||||
* the record number and file type/subtype.
|
||||
*/
|
||||
simple_error_message_box(
|
||||
"Record %u has a record type that can't be saved in a \"%s\" file.",
|
||||
fdata->num, wtap_file_type_subtype_string(args->file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular frame we're writing and
|
||||
* the file type and subtype we're writing; note that, and report
|
||||
* the frame number and file type/subtype.
|
||||
*/
|
||||
simple_error_message_box(
|
||||
"Record %u has data that can't be saved in a \"%s\" file.\n(%s)",
|
||||
fdata->num, wtap_file_type_subtype_string(args->file_type),
|
||||
err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
display_basename = g_filename_display_basename(args->fname);
|
||||
simple_error_message_box(
|
||||
|
|
32
mergecap.c
32
mergecap.c
|
@ -254,7 +254,7 @@ main(int argc, char *argv[])
|
|||
struct wtap_pkthdr *phdr, snap_phdr;
|
||||
wtap_dumper *pdh;
|
||||
int open_err, read_err = 0, write_err, close_err;
|
||||
gchar *err_info;
|
||||
gchar *err_info, *write_err_info;
|
||||
int err_fileno;
|
||||
char *out_filename = NULL;
|
||||
gboolean got_read_error = FALSE, got_write_error = FALSE;
|
||||
|
@ -379,6 +379,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
@ -515,7 +516,7 @@ main(int argc, char *argv[])
|
|||
phdr = &snap_phdr;
|
||||
}
|
||||
|
||||
if (!wtap_dump(pdh, phdr, wtap_buf_ptr(in_file->wth), &write_err)) {
|
||||
if (!wtap_dump(pdh, phdr, wtap_buf_ptr(in_file->wth), &write_err, &write_err_info)) {
|
||||
got_write_error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -548,6 +549,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
@ -576,11 +578,35 @@ main(int argc, char *argv[])
|
|||
* the file type and subtype we're wwriting; note that, and
|
||||
* report the frame number and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr, "mergecap: Frame %u of \"%s\" is too large for a \"%s\" file\n.",
|
||||
fprintf(stderr, "mergecap: Frame %u of \"%s\" is too large for a \"%s\" file.\n",
|
||||
in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
|
||||
wtap_file_type_subtype_string(file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing and
|
||||
* the file type and subtype we're wwriting; note that, and
|
||||
* report the record number and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr, "mergecap: Record %u of \"%s\" has a record type that can't be saved in a \"%s\" file.\n",
|
||||
in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
|
||||
wtap_file_type_subtype_string(file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing and
|
||||
* the file type and subtype we're wwriting; note that, and
|
||||
* report the record number and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr, "mergecap: Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
|
||||
in_file ? in_file->packet_num : 0, in_file ? in_file->filename : "UNKNOWN",
|
||||
wtap_file_type_subtype_string(file_type),
|
||||
write_err_info);
|
||||
g_free(write_err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "mergecap: Error writing to outfile: %s\n",
|
||||
wtap_strerror(write_err));
|
||||
|
|
14
randpkt.c
14
randpkt.c
|
@ -498,6 +498,7 @@ main(int argc, char **argv)
|
|||
struct wtap_pkthdr pkthdr;
|
||||
union wtap_pseudo_header *ps_header = &pkthdr.pseudo_header;
|
||||
int i, j, len_this_pkt, len_random, err;
|
||||
gchar *err_info;
|
||||
guint8 buffer[65536];
|
||||
|
||||
int opt;
|
||||
|
@ -619,7 +620,18 @@ main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
wtap_dump(dump, &pkthdr, &buffer[0], &err);
|
||||
/* XXX - report errors! */
|
||||
if (!wtap_dump(dump, &pkthdr, &buffer[0], &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wtap_dump_close(dump, &err);
|
||||
|
|
20
reordercap.c
20
reordercap.c
|
@ -126,6 +126,7 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
@ -140,9 +141,20 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
|
|||
phdr->ts = frame->time;
|
||||
|
||||
/* Dump frame to outfile */
|
||||
if (!wtap_dump(pdh, phdr, ws_buffer_start_ptr(buf), &err)) {
|
||||
fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
|
||||
wtap_strerror(err));
|
||||
if (!wtap_dump(pdh, phdr, ws_buffer_start_ptr(buf), &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "reordercap: Error (%s) writing frame to outfile (%s)\n",
|
||||
wtap_strerror(err), err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
|
||||
wtap_strerror(err));
|
||||
break;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -288,6 +300,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
@ -345,6 +358,7 @@ main(int argc, char *argv[])
|
|||
case WTAP_ERR_UNSUPPORTED:
|
||||
case WTAP_ERR_UNWRITABLE_ENCAP:
|
||||
case WTAP_ERR_BAD_FILE:
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
fprintf(stderr, "(%s)\n", err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
|
62
tshark.c
62
tshark.c
|
@ -3238,7 +3238,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
filter, so, if we're writing to a capture file, write
|
||||
this packet out. */
|
||||
if (pdh != NULL) {
|
||||
if (!wtap_dump(pdh, &phdr, ws_buffer_start_ptr(&buf), &err)) {
|
||||
if (!wtap_dump(pdh, &phdr, ws_buffer_start_ptr(&buf), &err, &err_info)) {
|
||||
/* Error writing to a capture file */
|
||||
switch (err) {
|
||||
|
||||
|
@ -3272,6 +3272,38 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
wtap_file_type_subtype_short_string(out_file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing
|
||||
* and the file type and subtype we're writing; note that,
|
||||
* and report the record number and file type/subtype.
|
||||
*
|
||||
* XXX - framenum is not necessarily the record number in
|
||||
* the input file if there was a read filter.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"Record %u of \"%s\" has a record type that can't be saved in a \"%s\" file.\n",
|
||||
framenum, cf->filename,
|
||||
wtap_file_type_subtype_short_string(out_file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing
|
||||
* and the file type and subtype we're writing; note that,
|
||||
* and report the record number and file type/subtype.
|
||||
*
|
||||
* XXX - framenum is not necessarily the record number in
|
||||
* the input file if there was a read filter.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
|
||||
framenum, cf->filename,
|
||||
wtap_file_type_subtype_short_string(out_file_type),
|
||||
err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
show_capture_file_io_error(save_file, err, FALSE);
|
||||
break;
|
||||
|
@ -3321,7 +3353,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
filter, so, if we're writing to a capture file, write
|
||||
this packet out. */
|
||||
if (pdh != NULL) {
|
||||
if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err)) {
|
||||
if (!wtap_dump(pdh, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth), &err, &err_info)) {
|
||||
/* Error writing to a capture file */
|
||||
switch (err) {
|
||||
|
||||
|
@ -3349,6 +3381,32 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
|||
wtap_file_type_subtype_short_string(out_file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_REC_TYPE_UNSUPPORTED:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing
|
||||
* and the file type and subtype we're writing; note that,
|
||||
* and report the record number and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"Record %u of \"%s\" has a record type that can't be saved in a \"%s\" file.\n",
|
||||
framenum, cf->filename,
|
||||
wtap_file_type_subtype_short_string(out_file_type));
|
||||
break;
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
/*
|
||||
* This is a problem with the particular record we're writing
|
||||
* and the file type and subtype we're writing; note that,
|
||||
* and report the record number and file type/subtype.
|
||||
*/
|
||||
fprintf(stderr,
|
||||
"Record %u of \"%s\" has data that can't be saved in a \"%s\" file.\n(%s)\n",
|
||||
framenum, cf->filename,
|
||||
wtap_file_type_subtype_short_string(out_file_type),
|
||||
err_info);
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
show_capture_file_io_error(save_file, err, FALSE);
|
||||
break;
|
||||
|
|
|
@ -46,6 +46,7 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co
|
|||
exp_pdu_t *exp_pdu_tap_data = (exp_pdu_t *)tapdata;
|
||||
struct wtap_pkthdr pkthdr;
|
||||
int err;
|
||||
gchar *err_info;
|
||||
int buffer_len;
|
||||
guint8 *packet_buf;
|
||||
|
||||
|
@ -71,8 +72,18 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, co
|
|||
pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS|WTAP_HAS_PACK_FLAGS;
|
||||
|
||||
/* XXX: should the pkthdr.pseudo_header be set to the pinfo's pseudo-header? */
|
||||
/* XXX: report errors! */
|
||||
if (!wtap_dump(exp_pdu_tap_data->wdh, &pkthdr, packet_buf, &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
wtap_dump(exp_pdu_tap_data->wdh, &pkthdr, packet_buf, &err);
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(packet_buf);
|
||||
g_free(pkthdr.opt_comment);
|
||||
|
|
|
@ -523,6 +523,7 @@ write_current_packet (void)
|
|||
/* Write the packet */
|
||||
struct wtap_pkthdr pkthdr;
|
||||
int err;
|
||||
gchar *err_info;
|
||||
|
||||
memset(&pkthdr, 0, sizeof(struct wtap_pkthdr));
|
||||
|
||||
|
@ -535,7 +536,18 @@ write_current_packet (void)
|
|||
pkthdr.pack_flags |= direction;
|
||||
pkthdr.presence_flags = WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID|WTAP_HAS_TS|WTAP_HAS_PACK_FLAGS;
|
||||
|
||||
wtap_dump(wdh, &pkthdr, packet_buf, &err);
|
||||
/* XXX - report errors! */
|
||||
if (!wtap_dump(wdh, &pkthdr, packet_buf, &err, &err_info)) {
|
||||
switch (err) {
|
||||
|
||||
case WTAP_ERR_UNWRITABLE_REC_DATA:
|
||||
g_free(err_info);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
|
|||
static int _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
|
||||
struct wtap_pkthdr *phdr, int *err, gchar **err_info);
|
||||
|
||||
static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const guint8 *pd, int *err);
|
||||
static gboolean _5views_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean _5views_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
|
||||
|
@ -351,7 +351,7 @@ gboolean _5views_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean _5views_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
_5views_dump_t *_5views = (_5views_dump_t *)wdh->priv;
|
||||
t_5VW_TimeStamped_Header HeaderFrame;
|
||||
|
|
|
@ -281,10 +281,10 @@ static guint8 btsnoop_lookup_flags(guint8 hci_type, gboolean sent, guint8 *flags
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
|
||||
static gboolean btsnoop_format_partial_rec_hdr(
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const union wtap_pseudo_header *pseudo_header,
|
||||
const guint8 *pd, int *err,
|
||||
const guint8 *pd, int *err, gchar **err_info,
|
||||
struct btsnooprec_hdr *rec_hdr)
|
||||
{
|
||||
gint64 ts_usec;
|
||||
|
@ -292,7 +292,10 @@ static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
|
|||
guint8 flags = 0;
|
||||
|
||||
if (!btsnoop_lookup_flags(*pd, pseudo_header->p2p.sent, &flags)) {
|
||||
*err = WTAP_ERR_UNSUPPORTED;
|
||||
*err = WTAP_ERR_UNWRITABLE_REC_DATA;
|
||||
*err_info = g_strdup_printf("btsnoop: hci_type 0x%02x for %s data isn't supported",
|
||||
*pd,
|
||||
pseudo_header->p2p.sent ? "sent" : "received");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -310,7 +313,7 @@ static gboolean btsnoop_dump_partial_rec_hdr(wtap_dumper *wdh _U_,
|
|||
/* FIXME: How do we support multiple backends?*/
|
||||
static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct btsnooprec_hdr rec_hdr;
|
||||
|
@ -330,7 +333,8 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!btsnoop_dump_partial_rec_hdr(wdh, phdr, pseudo_header, pd, err, &rec_hdr))
|
||||
if (!btsnoop_format_partial_rec_hdr(phdr, pseudo_header, pd, err, err_info,
|
||||
&rec_hdr))
|
||||
return FALSE;
|
||||
|
||||
rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen-1);
|
||||
|
@ -354,7 +358,7 @@ static gboolean btsnoop_dump_h1(wtap_dumper *wdh,
|
|||
|
||||
static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct btsnooprec_hdr rec_hdr;
|
||||
|
@ -371,7 +375,8 @@ static gboolean btsnoop_dump_h4(wtap_dumper *wdh,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!btsnoop_dump_partial_rec_hdr(wdh, phdr, pseudo_header, pd, err, &rec_hdr))
|
||||
if (!btsnoop_format_partial_rec_hdr(phdr, pseudo_header, pd, err, err_info,
|
||||
&rec_hdr))
|
||||
return FALSE;
|
||||
|
||||
rec_hdr.incl_len = GUINT32_TO_BE(phdr->caplen);
|
||||
|
|
|
@ -111,7 +111,7 @@ static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
|
|||
static void catapult_dct2000_close(wtap *wth);
|
||||
|
||||
static gboolean catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
|
||||
/************************************************************/
|
||||
|
@ -586,7 +586,7 @@ catapult_dct2000_dump_can_write_encap(int encap)
|
|||
|
||||
static gboolean
|
||||
catapult_dct2000_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
guint32 n;
|
||||
|
|
|
@ -86,7 +86,7 @@ static gboolean commview_seek_read(wtap *wth, gint64 seek_off,
|
|||
static gboolean commview_read_header(commview_header_t *cv_hdr, FILE_T fh,
|
||||
int *err, gchar **err_info);
|
||||
static gboolean commview_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
wtap_open_return_val commview_open(wtap *wth, int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -314,7 +314,7 @@ gboolean commview_dump_open(wtap_dumper *wdh, int *err _U_)
|
|||
* Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean commview_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
commview_header_t cv_hdr;
|
||||
struct tm *tm;
|
||||
|
|
|
@ -592,7 +592,8 @@ static gboolean erf_dump(
|
|||
wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd,
|
||||
int *err)
|
||||
int *err,
|
||||
gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
union wtap_pseudo_header other_phdr;
|
||||
|
|
|
@ -356,7 +356,7 @@ esc_write(wtap_dumper *wdh, const guint8 *buf, int len, int *err)
|
|||
|
||||
static gboolean eyesdn_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err)
|
||||
{
|
||||
|
@ -393,7 +393,7 @@ int eyesdn_dump_can_write_encap(int encap)
|
|||
* Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean eyesdn_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
static const guint8 start_flag = 0xff;
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
|
|
|
@ -2316,9 +2316,9 @@ wtap_dump_open_finish(wtap_dumper *wdh, int file_type_subtype, gboolean compress
|
|||
|
||||
gboolean
|
||||
wtap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info)
|
||||
{
|
||||
return (wdh->subtype_write)(wdh, phdr, pd, err);
|
||||
return (wdh->subtype_write)(wdh, phdr, pd, err, err_info);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1249,7 +1249,7 @@ static void k12_dump_src_setting(gpointer k _U_, gpointer v, gpointer p) {
|
|||
}
|
||||
|
||||
static gboolean k12_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err) {
|
||||
const guint8 *pd, int *err, gchar **err_info _U_) {
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
k12_dump_t *k12 = (k12_dump_t *)wdh->priv;
|
||||
guint32 len;
|
||||
|
|
|
@ -369,7 +369,7 @@ static const struct { int e; const char* s; } encaps[] = {
|
|||
|
||||
static gboolean
|
||||
k12text_dump(wtap_dumper *wdh _U_, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err) {
|
||||
const guint8 *pd, int *err, gchar **err_info _U_) {
|
||||
#define K12BUF_SIZE 196808
|
||||
char *buf;
|
||||
size_t left = K12BUF_SIZE;
|
||||
|
|
|
@ -625,7 +625,7 @@ static void my_timersub(const struct timeval *a,
|
|||
*---------------------------------------------------*/
|
||||
static gboolean lanalyzer_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
double x;
|
||||
int i;
|
||||
|
|
|
@ -67,7 +67,7 @@ static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off,
|
|||
static gboolean libpcap_read_packet(wtap *wth, FILE_T fh,
|
||||
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
|
||||
static gboolean libpcap_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info,
|
||||
struct pcaprec_ss990915_hdr *hdr);
|
||||
|
||||
|
@ -889,7 +889,7 @@ gboolean libpcap_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean libpcap_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct pcaprec_ss990915_hdr rec_hdr;
|
||||
|
|
|
@ -312,7 +312,7 @@ int logcat_dump_can_write_encap(int encap)
|
|||
|
||||
static gboolean logcat_binary_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
int caplen;
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ int logcat_text_long_dump_can_write_encap(int encap) {
|
|||
|
||||
static gboolean logcat_text_dump_text(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info)
|
||||
{
|
||||
gchar *buf;
|
||||
gint length;
|
||||
|
@ -474,7 +474,9 @@ static gboolean logcat_text_dump_text(wtap_dumper *wdh,
|
|||
msg_pre_skip = 1 + (gint) strlen(tag) + 1;
|
||||
msg_begin = msg_payload + msg_pre_skip;
|
||||
} else {
|
||||
*err = WTAP_ERR_UNSUPPORTED;
|
||||
*err = WTAP_ERR_UNWRITABLE_REC_DATA;
|
||||
*err_info = g_strdup_printf("logcat: version %d isn't supported",
|
||||
logcat_version);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ static gboolean netmon_read_atm_pseudoheader(FILE_T fh,
|
|||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
|
||||
static void netmon_sequential_close(wtap *wth);
|
||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean netmon_dump_close(wtap_dumper *wdh, int *err);
|
||||
|
||||
wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
|
||||
|
@ -993,7 +993,7 @@ gboolean netmon_dump_open(wtap_dumper *wdh, int *err)
|
|||
/* Write a record for a packet to a dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean netmon_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
netmon_dump_t *netmon = (netmon_dump_t *)wdh->priv;
|
||||
|
|
|
@ -640,7 +640,7 @@ static gboolean nstrace_set_start_time(wtap *wth);
|
|||
static guint64 ns_hrtime2nsec(guint32 tm);
|
||||
|
||||
static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1784,7 +1784,7 @@ nstrace_add_abstime(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
|||
/* Write a record for a packet to a dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean nstrace_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
nstrace_dump_t *nstrace = (nstrace_dump_t *)wdh->priv;
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
|
|||
static gboolean nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
|
||||
Buffer *buf, int *err, gchar **err_info);
|
||||
static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
wtap_open_return_val nettl_open(wtap *wth, int *err, gchar **err_info)
|
||||
{
|
||||
|
@ -682,7 +682,7 @@ gboolean nettl_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean nettl_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct nettlrec_hdr rec_hdr;
|
||||
|
|
|
@ -108,7 +108,7 @@ static int read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_f
|
|||
static gboolean skip_to_next_packet(wtap *wth, int offset_to_next_packet,
|
||||
int current_offset_from_packet_header, int *err, char **err_info);
|
||||
static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gint observer_to_wtap_encap(int observer_encap);
|
||||
static gint wtap_to_observer_encap(int wtap_encap);
|
||||
|
||||
|
@ -668,7 +668,7 @@ gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean observer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd,
|
||||
int *err)
|
||||
int *err, gchar **err_info _U_)
|
||||
{
|
||||
observer_dump_private_state * private_state = NULL;
|
||||
packet_entry_header packet_header;
|
||||
|
|
|
@ -412,11 +412,11 @@ static void netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr,
|
|||
Buffer *buf);
|
||||
static gboolean netxray_dump_1_1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean netxray_dump_close_1_1(wtap_dumper *wdh, int *err);
|
||||
static gboolean netxray_dump_2_0(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean netxray_dump_close_2_0(wtap_dumper *wdh, int *err);
|
||||
|
||||
wtap_open_return_val
|
||||
|
@ -1728,7 +1728,7 @@ netxray_dump_open_1_1(wtap_dumper *wdh, int *err)
|
|||
static gboolean
|
||||
netxray_dump_1_1(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
|
||||
guint64 timestamp;
|
||||
|
@ -1906,7 +1906,7 @@ netxray_dump_open_2_0(wtap_dumper *wdh, int *err)
|
|||
static gboolean
|
||||
netxray_dump_2_0(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
netxray_dump_t *netxray = (netxray_dump_t *)wdh->priv;
|
||||
|
|
|
@ -528,7 +528,7 @@ static int fix_pseudo_header(int encap, Buffer *buf, int len,
|
|||
static void ngsniffer_sequential_close(wtap *wth);
|
||||
static void ngsniffer_close(wtap *wth);
|
||||
static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean ngsniffer_dump_close(wtap_dumper *wdh, int *err);
|
||||
static int SnifferDecompress( unsigned char * inbuf, size_t inlen,
|
||||
unsigned char * outbuf, size_t outlen, int *err, gchar **err_info );
|
||||
|
@ -1993,7 +1993,7 @@ ngsniffer_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean
|
||||
ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
ngsniffer_dump_t *ngsniffer = (ngsniffer_dump_t *)wdh->priv;
|
||||
|
|
|
@ -3694,7 +3694,7 @@ pcapng_write_name_resolution_block(wtap_dumper *wdh, int *err)
|
|||
|
||||
static gboolean pcapng_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
#ifdef HAVE_PLUGINS
|
||||
|
|
|
@ -96,7 +96,7 @@ static gboolean snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
|
|||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info,
|
||||
int *header_size);
|
||||
static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
|
||||
/*
|
||||
* See
|
||||
|
@ -813,7 +813,7 @@ gboolean snoop_dump_open(wtap_dumper *wdh, int *err)
|
|||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean snoop_dump(wtap_dumper *wdh,
|
||||
const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct snooprec_hdr rec_hdr;
|
||||
|
|
|
@ -165,7 +165,7 @@ static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
|
|||
static gboolean visual_read_packet(wtap *wth, FILE_T fh,
|
||||
struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
|
||||
static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err);
|
||||
const guint8 *pd, int *err, gchar **err_info);
|
||||
static gboolean visual_dump_close(wtap_dumper *wdh, int *err);
|
||||
static void visual_dump_free(wtap_dumper *wdh);
|
||||
|
||||
|
@ -642,7 +642,7 @@ gboolean visual_dump_open(wtap_dumper *wdh, int *err)
|
|||
/* Write a packet to a Visual dump file.
|
||||
Returns TRUE on success, FALSE on failure. */
|
||||
static gboolean visual_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
|
||||
const guint8 *pd, int *err)
|
||||
const guint8 *pd, int *err, gchar **err_info _U_)
|
||||
{
|
||||
const union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
|
||||
struct visual_write_info * visual = (struct visual_write_info *)wdh->priv;
|
||||
|
|
|
@ -95,7 +95,7 @@ typedef void *WFILE_T;
|
|||
|
||||
typedef gboolean (*subtype_write_func)(struct wtap_dumper*,
|
||||
const struct wtap_pkthdr*,
|
||||
const guint8*, int*);
|
||||
const guint8*, int*, gchar**);
|
||||
typedef gboolean (*subtype_close_func)(struct wtap_dumper*, int*);
|
||||
|
||||
struct wtap_dumper {
|
||||
|
|
|
@ -883,7 +883,10 @@ static const char *wtap_errlist[] = {
|
|||
NULL,
|
||||
|
||||
/* WTAP_ERR_REC_TYPE_UNSUPPORTED */
|
||||
"That record type cannot be written in that format"
|
||||
"That record type cannot be written in that format",
|
||||
|
||||
/* WTAP_ERR_UNWRITABLE_REC_DATA */
|
||||
"That record can't be written in that format"
|
||||
};
|
||||
#define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
|
||||
|
||||
|
|
|
@ -1562,7 +1562,8 @@ wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen,
|
|||
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const guint8 *, int *err);
|
||||
gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const guint8 *,
|
||||
int *err, gchar **err_info);
|
||||
WS_DLL_PUBLIC
|
||||
void wtap_dump_flush(wtap_dumper *);
|
||||
WS_DLL_PUBLIC
|
||||
|
@ -1738,6 +1739,9 @@ int wtap_register_encap_type(const char* name, const char* short_name);
|
|||
#define WTAP_ERR_REC_TYPE_UNSUPPORTED -24
|
||||
/** Specified record type can't be written to that file type */
|
||||
|
||||
#define WTAP_ERR_UNWRITABLE_REC_DATA -25
|
||||
/** Something in the record data can't be written to that file type */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
Loading…
Reference in New Issue