forked from osmocom/wireshark
Added named data sources printing support, written by Guy Harris
svn path=/trunk/; revision=3167
This commit is contained in:
parent
2fd1bed04a
commit
45cde0fc88
43
print.c
43
print.c
|
@ -1,7 +1,7 @@
|
|||
/* print.c
|
||||
* Routines for printing packet analysis trees.
|
||||
*
|
||||
* $Id: print.c,v 1.29 2000/04/13 20:39:18 gram Exp $
|
||||
* $Id: print.c,v 1.30 2001/03/23 18:44:20 jfoster Exp $
|
||||
*
|
||||
* Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
|
@ -177,13 +177,42 @@ void proto_tree_print_node_text(GNode *node, gpointer data)
|
|||
}
|
||||
}
|
||||
|
||||
void print_hex_data(FILE *fh, gint format, register const u_char *cp,
|
||||
register u_int length, char_enc encoding)
|
||||
void print_hex_data(FILE *fh, gint format, frame_data *fd)
|
||||
{
|
||||
if (format == PR_FMT_PS)
|
||||
print_hex_data_ps(fh, cp, length, encoding);
|
||||
else
|
||||
print_hex_data_text(fh, cp, length, encoding);
|
||||
gboolean multiple_sources;
|
||||
GSList *src;
|
||||
tvbuff_t *tvb;
|
||||
char *name;
|
||||
char *line;
|
||||
const u_char *cp;
|
||||
guint length;
|
||||
|
||||
/*
|
||||
* Set "multiple_sources" iff this frame has more than one
|
||||
* data source; if it does, we need to print the name of
|
||||
* the data source before printing the data from the
|
||||
* data source.
|
||||
*/
|
||||
multiple_sources = (fd->data_src->next != NULL);
|
||||
|
||||
for (src = fd->data_src; src != NULL; src = src->next) {
|
||||
tvb = src->data;
|
||||
if (multiple_sources) {
|
||||
name = tvb_get_name(tvb);
|
||||
line = g_malloc(strlen(name) + 3); /* <name>:\n\0 */
|
||||
strcpy(line, name);
|
||||
strcat(line, ":");
|
||||
print_line(fh, format, line);
|
||||
g_free(line);
|
||||
print_line(fh, format, "\n");
|
||||
}
|
||||
length = tvb_length(tvb);
|
||||
cp = tvb_get_ptr(tvb, 0, length);
|
||||
if (format == PR_FMT_PS)
|
||||
print_hex_data_ps(fh, cp, length, fd->flags.encoding);
|
||||
else
|
||||
print_hex_data_text(fh, cp, length, fd->flags.encoding);
|
||||
}
|
||||
}
|
||||
|
||||
/* This routine was created by Dan Lasley <DLASLEY@PROMUS.com>, and
|
||||
|
|
5
print.h
5
print.h
|
@ -1,7 +1,7 @@
|
|||
/* print.h
|
||||
* Definitions for printing packet analysis trees.
|
||||
*
|
||||
* $Id: print.h,v 1.20 2000/08/11 13:34:26 deniel Exp $
|
||||
* $Id: print.h,v 1.21 2001/03/23 18:44:20 jfoster Exp $
|
||||
*
|
||||
* Gilbert Ramirez <gram@xiexie.org>
|
||||
*
|
||||
|
@ -54,8 +54,7 @@ void print_preamble(FILE *fh, gint format);
|
|||
void print_finale(FILE *fh, gint format);
|
||||
void proto_tree_print(gboolean print_one_packet, print_args_t *print_args,
|
||||
GNode *protocol_tree, const u_char *pd, frame_data *fd, FILE *fh);
|
||||
void print_hex_data(FILE *fh, gint format, register const u_char *cp,
|
||||
register u_int length, char_enc encoding);
|
||||
void print_hex_data(FILE *fh, gint format, frame_data *fd);
|
||||
void print_line(FILE *fh, gint format, char *line);
|
||||
|
||||
#endif /* print.h */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* tethereal.c
|
||||
*
|
||||
* $Id: tethereal.c,v 1.68 2001/02/18 03:38:42 guy Exp $
|
||||
* $Id: tethereal.c,v 1.69 2001/03/23 18:44:20 jfoster Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -1256,8 +1256,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, int offset,
|
|||
putchar('\n');
|
||||
}
|
||||
if (print_hex) {
|
||||
print_hex_data(stdout, print_args.format, buf,
|
||||
fdata.cap_len, fdata.flags.encoding);
|
||||
print_hex_data(stdout, print_args.format, &fdata);
|
||||
putchar('\n');
|
||||
}
|
||||
fdata.cinfo = NULL;
|
||||
|
|
Loading…
Reference in New Issue