Phil Techau's patch to add "col_append_str()".
svn path=/trunk/; revision=845
This commit is contained in:
parent
c36e5fd163
commit
6f56cbf07e
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.22 1999/10/14 01:28:48 guy Exp $
|
||||
* $Id: main.c,v 1.23 1999/10/15 20:33:06 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -662,7 +662,10 @@ main(int argc, char *argv[])
|
|||
cf.cinfo.fmt_matx[i] = (gboolean *) g_malloc0(sizeof(gboolean) *
|
||||
NUM_COL_FMTS);
|
||||
get_column_format_matches(cf.cinfo.fmt_matx[i], cf.cinfo.col_fmt[i]);
|
||||
cf.cinfo.col_data[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
|
||||
if (cf.cinfo.col_fmt[i] == COL_INFO)
|
||||
cf.cinfo.col_data[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_INFO_LEN);
|
||||
else
|
||||
cf.cinfo.col_data[i] = (gchar *) g_malloc(sizeof(gchar) * COL_MAX_LEN);
|
||||
}
|
||||
|
||||
if (cf.snap < 1)
|
||||
|
|
32
packet.c
32
packet.c
|
@ -1,7 +1,7 @@
|
|||
/* packet.c
|
||||
* Routines for packet disassembly
|
||||
*
|
||||
* $Id: packet.c,v 1.49 1999/10/14 07:39:44 guy Exp $
|
||||
* $Id: packet.c,v 1.50 1999/10/15 20:32:57 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -650,15 +650,39 @@ col_add_fstr(frame_data *fd, gint el, gchar *format, ...) {
|
|||
void
|
||||
col_add_str(frame_data *fd, gint el, const gchar* str) {
|
||||
int i;
|
||||
|
||||
size_t max_len;
|
||||
|
||||
for (i = 0; i < fd->cinfo->num_cols; i++) {
|
||||
if (fd->cinfo->fmt_matx[i][el]) {
|
||||
strncpy(fd->cinfo->col_data[i], str, COL_MAX_LEN);
|
||||
fd->cinfo->col_data[i][COL_MAX_LEN - 1] = 0;
|
||||
if (el == COL_INFO)
|
||||
max_len = COL_MAX_INFO_LEN;
|
||||
else
|
||||
max_len = COL_MAX_LEN;
|
||||
strncpy(fd->cinfo->col_data[i], str, max_len);
|
||||
fd->cinfo->col_data[i][max_len - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
col_append_str(frame_data *fd, gint el, gchar* str) {
|
||||
int i;
|
||||
size_t len, max_len;
|
||||
|
||||
for (i = 0; i < fd->cinfo->num_cols; i++) {
|
||||
if (fd->cinfo->fmt_matx[i][el]) {
|
||||
len = strlen(fd->cinfo->col_data[i]);
|
||||
if (el == COL_INFO)
|
||||
max_len = COL_MAX_LEN;
|
||||
else
|
||||
max_len = COL_MAX_INFO_LEN;
|
||||
strncat(fd->cinfo->col_data[i], str, max_len - len);
|
||||
fd->cinfo->col_data[i][max_len - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* this routine checks the frame type from the cf structure */
|
||||
void
|
||||
dissect_packet(const u_char *pd, frame_data *fd, proto_tree *tree)
|
||||
|
|
3
packet.h
3
packet.h
|
@ -1,7 +1,7 @@
|
|||
/* packet.h
|
||||
* Definitions for packet disassembly structures and routines
|
||||
*
|
||||
* $Id: packet.h,v 1.112 1999/10/15 17:00:47 itojun Exp $
|
||||
* $Id: packet.h,v 1.113 1999/10/15 20:32:57 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -93,6 +93,7 @@ typedef struct _column_info {
|
|||
} column_info;
|
||||
|
||||
#define COL_MAX_LEN 256
|
||||
#define COL_MAX_INFO_LEN 4096
|
||||
|
||||
typedef struct _packet_counts {
|
||||
gint tcp;
|
||||
|
|
Loading…
Reference in New Issue