2001-04-01 07:32:35 +00:00
|
|
|
/* column-utils.c
|
|
|
|
* Routines for column utilities.
|
|
|
|
*
|
Instead of tweaking a "Protocol configuration options" extension header
item to look more-or-less like a PPP packet, just dissect it in place
and hand off to the appropriate subdissector using the PPP dissector's
handoff table (which we export, along with its value_string table for
protocol IDs, which we use to report the protocol ID symbolically).
This means there's no point in having a configurable option to control
whether to do that tweaking; make it an obsolete option.
Bring "col_get_writable()" back from the dead, and have the GTP
dissector save the current "writable" flag for columns, mark the columns
non-writable before calling the subdissector for the PPP configuration
protocol, and restore the state of the writable flag, rather than
putting the columns back after the PPP configuration protocol's
dissector is done.
Fix some more typos in comments.
Don't register the IP dissector in the "ppp.protocol" table in the GTP
dissector's handoff registration routine - it's already being done in
the IP dissector's handoff routine.
Fix the name for CHAP to match what RFC 1994 calls it (if the name
changed, it should be changed in all places, but, at least according to
this message, a while ago, from Bob Sutterfield, "since the RFC defines
the protocol, the RFC defines the name":
http://mail-index.netbsd.org/netbsd-help/1996/05/16/0011.html
and the RFC defines the name as "PPP Challenge Handshake Authentication
Protocol (CHAP)").
svn path=/trunk/; revision=6617
2002-11-11 19:23:14 +00:00
|
|
|
* $Id: column-utils.c,v 1.25 2002/11/11 19:23:14 guy Exp $
|
2001-04-01 07:32:35 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-12-10 00:26:21 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
2001-04-01 07:32:35 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 07:32:35 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 07:32:35 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 20:41:00 +00:00
|
|
|
*
|
2001-04-01 07:32:35 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-02 02:30:06 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
#ifdef NEED_SNPRINTF_H
|
|
|
|
# include "snprintf.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "column-utils.h"
|
|
|
|
#include "timestamp.h"
|
|
|
|
#include "sna-utils.h"
|
|
|
|
#include "atalk-utils.h"
|
|
|
|
#include "to_str.h"
|
|
|
|
#include "packet_info.h"
|
|
|
|
#include "pint.h"
|
|
|
|
#include "resolv.h"
|
2002-08-28 20:41:00 +00:00
|
|
|
#include "ipv6-utils.h"
|
2001-04-01 07:32:35 +00:00
|
|
|
#include "osi-utils.h"
|
|
|
|
|
|
|
|
/* Allocate all the data structures for constructing column data, given
|
|
|
|
the number of columns. */
|
|
|
|
void
|
|
|
|
col_init(column_info *col_info, gint num_cols)
|
|
|
|
{
|
|
|
|
col_info->num_cols = num_cols;
|
|
|
|
col_info->col_fmt = (gint *) g_malloc(sizeof(gint) * num_cols);
|
|
|
|
col_info->fmt_matx = (gboolean **) g_malloc(sizeof(gboolean *) * num_cols);
|
|
|
|
col_info->col_width = (gint *) g_malloc(sizeof(gint) * num_cols);
|
|
|
|
col_info->col_title = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
|
|
|
|
col_info->col_data = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
|
|
|
|
col_info->col_buf = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
|
2002-01-11 08:21:02 +00:00
|
|
|
col_info->col_expr = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
|
|
|
|
col_info->col_expr_val = (gchar **) g_malloc(sizeof(gchar *) * num_cols);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2001-12-10 00:26:21 +00:00
|
|
|
col_get_writable(column_info *cinfo)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2001-12-10 00:26:21 +00:00
|
|
|
return (cinfo ? cinfo->writable : FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_writable(column_info *cinfo, gboolean writable)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2001-12-10 00:26:21 +00:00
|
|
|
if (cinfo)
|
|
|
|
cinfo->writable = writable;
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Checks to see if a particular packet information element is needed for
|
|
|
|
the packet list */
|
|
|
|
gint
|
2001-12-10 00:26:21 +00:00
|
|
|
check_col(column_info *cinfo, gint el) {
|
2001-04-01 07:32:35 +00:00
|
|
|
int i;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (cinfo && cinfo->writable) {
|
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el])
|
2001-04-01 07:32:35 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Use this to clear out a column, especially if you're going to be
|
|
|
|
appending to it later; at least on some platforms, it's more
|
|
|
|
efficient than using "col_add_str()" with a null string, and
|
|
|
|
more efficient than "col_set_str()" with a null string if you
|
|
|
|
later append to it, as the later append will cause a string
|
|
|
|
copy to be done. */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_clear(column_info *cinfo, gint el) {
|
2001-04-01 07:32:35 +00:00
|
|
|
int i;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
cinfo->col_buf[i][0] = 0;
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
2002-01-11 08:21:02 +00:00
|
|
|
cinfo->col_expr[i][0] = '\0';
|
|
|
|
cinfo->col_expr_val[i][0] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use this if "str" points to something that will stay around (and thus
|
|
|
|
needn't be copied). */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_str(column_info *cinfo, gint el, gchar* str) {
|
2001-04-01 07:32:35 +00:00
|
|
|
int i;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el])
|
|
|
|
cinfo->col_data[i] = str;
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Adds a vararg list to a packet info string. */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_add_fstr(column_info *cinfo, gint el, gchar *format, ...) {
|
2001-04-01 07:32:35 +00:00
|
|
|
va_list ap;
|
|
|
|
int i;
|
|
|
|
size_t max_len;
|
|
|
|
|
|
|
|
if (el == COL_INFO)
|
|
|
|
max_len = COL_MAX_INFO_LEN;
|
|
|
|
else
|
|
|
|
max_len = COL_MAX_LEN;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
va_start(ap, format);
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
vsnprintf(cinfo->col_buf[i], max_len, format, ap);
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-29 08:44:53 +00:00
|
|
|
va_end(ap);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Appends a vararg list to a packet info string. */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_append_fstr(column_info *cinfo, gint el, gchar *format, ...) {
|
2001-04-01 07:32:35 +00:00
|
|
|
va_list ap;
|
|
|
|
int i;
|
|
|
|
size_t len, max_len;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
if (el == COL_INFO)
|
|
|
|
max_len = COL_MAX_INFO_LEN;
|
|
|
|
else
|
|
|
|
max_len = COL_MAX_LEN;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
va_start(ap, format);
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
if (cinfo->col_data[i] != cinfo->col_buf[i]) {
|
2001-04-01 07:32:35 +00:00
|
|
|
/* This was set with "col_set_str()"; copy the string they
|
|
|
|
set it to into the buffer, so we can append to it. */
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
|
|
|
|
cinfo->col_buf[i][max_len - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
len = strlen(cinfo->col_buf[i]);
|
|
|
|
vsnprintf(&cinfo->col_buf[i][len], max_len - len, format, ap);
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
2002-01-29 08:44:53 +00:00
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Prepends a vararg list to a packet info string. */
|
2002-01-31 08:03:39 +00:00
|
|
|
#define COL_BUF_MAX_LEN (((COL_MAX_INFO_LEN) > (COL_MAX_LEN)) ? \
|
|
|
|
(COL_MAX_INFO_LEN) : (COL_MAX_LEN))
|
2002-01-29 08:44:53 +00:00
|
|
|
void
|
|
|
|
col_prepend_fstr(column_info *cinfo, gint el, gchar *format, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
2002-01-31 00:51:36 +00:00
|
|
|
int i;
|
2002-01-31 08:03:39 +00:00
|
|
|
char orig_buf[COL_BUF_MAX_LEN];
|
2002-01-31 00:51:36 +00:00
|
|
|
char *orig;
|
2002-01-29 08:44:53 +00:00
|
|
|
size_t max_len;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-01-29 08:44:53 +00:00
|
|
|
if (el == COL_INFO)
|
|
|
|
max_len = COL_MAX_INFO_LEN;
|
|
|
|
else
|
|
|
|
max_len = COL_MAX_LEN;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2002-01-29 08:44:53 +00:00
|
|
|
va_start(ap, format);
|
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
if (cinfo->col_data[i] != cinfo->col_buf[i]) {
|
|
|
|
/* This was set with "col_set_str()"; which is effectively const */
|
|
|
|
orig = cinfo->col_data[i];
|
|
|
|
} else {
|
2002-01-31 00:51:36 +00:00
|
|
|
orig = orig_buf;
|
2002-01-29 08:44:53 +00:00
|
|
|
strncpy(orig, cinfo->col_buf[i], max_len);
|
|
|
|
orig[max_len - 1] = '\0';
|
|
|
|
}
|
|
|
|
vsnprintf(cinfo->col_buf[i], max_len, format, ap);
|
|
|
|
strncat(cinfo->col_buf[i], orig, max_len);
|
|
|
|
cinfo->col_buf[i][max_len - 1] = '\0';
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
va_end(ap);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Use this if "str" points to something that won't stay around (and
|
|
|
|
must thus be copied). */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_add_str(column_info *cinfo, gint el, const gchar* str) {
|
2001-04-01 07:32:35 +00:00
|
|
|
int i;
|
|
|
|
size_t max_len;
|
|
|
|
|
|
|
|
if (el == COL_INFO)
|
|
|
|
max_len = COL_MAX_INFO_LEN;
|
|
|
|
else
|
|
|
|
max_len = COL_MAX_LEN;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
strncpy(cinfo->col_buf[i], str, max_len);
|
|
|
|
cinfo->col_buf[i][max_len - 1] = 0;
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_append_str(column_info *cinfo, gint el, gchar* str) {
|
2001-04-01 07:32:35 +00:00
|
|
|
int i;
|
|
|
|
size_t len, max_len;
|
|
|
|
|
|
|
|
if (el == COL_INFO)
|
|
|
|
max_len = COL_MAX_INFO_LEN;
|
|
|
|
else
|
|
|
|
max_len = COL_MAX_LEN;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < cinfo->num_cols; i++) {
|
|
|
|
if (cinfo->fmt_matx[i][el]) {
|
|
|
|
if (cinfo->col_data[i] != cinfo->col_buf[i]) {
|
2001-04-01 07:32:35 +00:00
|
|
|
/* This was set with "col_set_str()"; copy the string they
|
|
|
|
set it to into the buffer, so we can append to it. */
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
|
|
|
|
cinfo->col_buf[i][max_len - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
len = strlen(cinfo->col_buf[i]);
|
|
|
|
strncat(cinfo->col_buf[i], str, max_len - len);
|
|
|
|
cinfo->col_buf[i][max_len - 1] = 0;
|
|
|
|
cinfo->col_data[i] = cinfo->col_buf[i];
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
|
|
|
struct tm *tmp;
|
|
|
|
time_t then;
|
|
|
|
|
|
|
|
then = fd->abs_secs;
|
|
|
|
tmp = localtime(&then);
|
2001-07-15 19:14:03 +00:00
|
|
|
if (tmp != NULL) {
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(cinfo->col_buf[col], COL_MAX_LEN,
|
2001-07-15 19:14:03 +00:00
|
|
|
"%04d-%02d-%02d %02d:%02d:%02d.%04ld",
|
|
|
|
tmp->tm_year + 1900,
|
|
|
|
tmp->tm_mon + 1,
|
|
|
|
tmp->tm_mday,
|
|
|
|
tmp->tm_hour,
|
|
|
|
tmp->tm_min,
|
|
|
|
tmp->tm_sec,
|
|
|
|
(long)fd->abs_usecs/100);
|
|
|
|
} else {
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_buf[col][0] = '\0';
|
2001-07-15 19:14:03 +00:00
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(cinfo->col_expr[col],"frame.time");
|
|
|
|
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_rel_time(frame_data *fd, column_info *cinfo, int col)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2001-12-10 00:26:21 +00:00
|
|
|
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
|
2001-09-14 07:10:13 +00:00
|
|
|
fd->rel_secs, fd->rel_usecs, USECS);
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(cinfo->col_expr[col],"frame.time_relative");
|
|
|
|
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_delta_time(frame_data *fd, column_info *cinfo, int col)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2001-12-10 00:26:21 +00:00
|
|
|
display_signed_time(cinfo->col_buf[col], COL_MAX_LEN,
|
2001-09-14 07:10:13 +00:00
|
|
|
fd->del_secs, fd->del_usecs, USECS);
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(cinfo->col_expr[col],"frame.time_delta");
|
|
|
|
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* To do: Add check_col checks to the col_add* routines */
|
|
|
|
|
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
|
|
|
struct tm *tmp;
|
|
|
|
time_t then;
|
|
|
|
|
|
|
|
then = fd->abs_secs;
|
|
|
|
tmp = localtime(&then);
|
2001-07-15 19:14:03 +00:00
|
|
|
if (tmp != NULL) {
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%04ld",
|
2001-07-15 19:14:03 +00:00
|
|
|
tmp->tm_hour,
|
|
|
|
tmp->tm_min,
|
|
|
|
tmp->tm_sec,
|
|
|
|
(long)fd->abs_usecs/100);
|
|
|
|
} else {
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_buf[col][0] = '\0';
|
2001-07-15 19:14:03 +00:00
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
cinfo->col_data[col] = cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(cinfo->col_expr[col],"frame.time");
|
|
|
|
strcpy(cinfo->col_expr_val[col],cinfo->col_buf[col]);
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add "command-line-specified" time.
|
|
|
|
XXX - this is called from "file.c" when the user changes the time
|
|
|
|
format they want for "command-line-specified" time; it's a bit ugly
|
|
|
|
that we have to export it, but if we go to a CList-like widget that
|
|
|
|
invokes callbacks to get the text for the columns rather than
|
|
|
|
requiring us to stuff the text into the widget from outside, we
|
|
|
|
might be able to clean this up. */
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_cls_time(frame_data *fd, column_info *cinfo, int col)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
|
|
|
switch (timestamp_type) {
|
|
|
|
case ABSOLUTE:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_time(fd, cinfo, col);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ABSOLUTE_WITH_DATE:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_date_time(fd, cinfo, col);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RELATIVE:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_rel_time(fd, cinfo, col);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DELTA:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_delta_time(fd, cinfo, col);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
|
|
|
|
gboolean is_src)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2001-04-02 10:38:26 +00:00
|
|
|
guint32 ipv4_addr;
|
2001-04-01 07:32:35 +00:00
|
|
|
struct e_in6_addr ipv6_addr;
|
|
|
|
struct atalk_ddp_addr ddp_addr;
|
|
|
|
struct sna_fid_type_4_addr sna_fid_type_4_addr;
|
|
|
|
|
2002-01-11 08:21:02 +00:00
|
|
|
pinfo->cinfo->col_expr[col][0] = '\0';
|
|
|
|
pinfo->cinfo->col_expr_val[col][0] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
switch (addr->type) {
|
|
|
|
|
|
|
|
case AT_ETHER:
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_ether_name(addr->data), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], ether_to_str(addr->data), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "eth.src");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "eth.dst");
|
|
|
|
strncpy(pinfo->cinfo->col_expr_val[col], ether_to_str(addr->data), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_IPv4:
|
|
|
|
memcpy(&ipv4_addr, addr->data, sizeof ipv4_addr);
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_hostname(ipv4_addr), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], ip_to_str(addr->data), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ip.src");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ip.dst");
|
|
|
|
strncpy(pinfo->cinfo->col_expr_val[col], ip_to_str(addr->data), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_IPv6:
|
|
|
|
memcpy(&ipv6_addr.s6_addr, addr->data, sizeof ipv6_addr.s6_addr);
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_hostname6(&ipv6_addr), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], ip6_to_str(&ipv6_addr), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2002-01-11 08:21:02 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ipv6.src");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ipv6.dst");
|
|
|
|
strncpy(pinfo->cinfo->col_expr_val[col], ip6_to_str(&ipv6_addr), COL_MAX_LEN);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_IPX:
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col],
|
2001-04-01 07:32:35 +00:00
|
|
|
ipx_addr_to_str(pntohl(&addr->data[0]), &addr->data[4]), COL_MAX_LEN);
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_SNA:
|
|
|
|
switch (addr->len) {
|
|
|
|
|
|
|
|
case 1:
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%04X", addr->data[0]);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%04X",
|
2001-04-01 07:32:35 +00:00
|
|
|
pntohs(&addr->data[0]));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNA_FID_TYPE_4_ADDR_LEN:
|
|
|
|
memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN);
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col],
|
2001-04-01 07:32:35 +00:00
|
|
|
sna_fid_type_4_addr_to_str(&sna_fid_type_4_addr), COL_MAX_LEN);
|
|
|
|
break;
|
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_ATALK:
|
|
|
|
memcpy(&ddp_addr, addr->data, sizeof ddp_addr);
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], atalk_addr_to_str(&ddp_addr),
|
2001-04-01 07:32:35 +00:00
|
|
|
COL_MAX_LEN);
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
2002-06-28 20:13:03 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ddp.src");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ddp.dst");
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2002-06-28 20:13:03 +00:00
|
|
|
strcpy(pinfo->cinfo->col_expr_val[col],pinfo->cinfo->col_buf[col]);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_VINES:
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], vines_addr_to_str(&addr->data[0]),
|
2001-04-01 07:32:35 +00:00
|
|
|
COL_MAX_LEN);
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AT_OSI:
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], print_nsap_net(addr->data, addr->len),
|
2001-04-01 07:32:35 +00:00
|
|
|
COL_MAX_LEN);
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
2002-10-18 21:40:13 +00:00
|
|
|
case AT_ARCNET:
|
2002-10-23 04:23:03 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%02X",
|
2002-10-18 21:40:13 +00:00
|
|
|
addr->data[0]);
|
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "arcnet.src");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "arcnet.dst");
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
|
|
|
strcpy(pinfo->cinfo->col_expr_val[col],pinfo->cinfo->col_buf[col]);
|
|
|
|
break;
|
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_port(packet_info *pinfo, int col, port_type ptype, guint32 port,
|
2002-01-11 08:21:02 +00:00
|
|
|
gboolean is_res, gboolean is_src)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
2002-01-11 08:21:02 +00:00
|
|
|
pinfo->cinfo->col_expr[col][0] = '\0';
|
|
|
|
pinfo->cinfo->col_expr_val[col][0] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
switch (ptype) {
|
|
|
|
|
|
|
|
case PT_SCTP:
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_sctp_port(port), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
2002-08-28 20:41:00 +00:00
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
case PT_TCP:
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_tcp_port(port), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
|
2002-01-11 08:21:02 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "tcp.srcport");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "tcp.dstport");
|
|
|
|
snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PT_UDP:
|
|
|
|
if (is_res)
|
2001-12-10 00:26:21 +00:00
|
|
|
strncpy(pinfo->cinfo->col_buf[col], get_udp_port(port), COL_MAX_LEN);
|
2001-04-01 07:32:35 +00:00
|
|
|
else
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
|
2002-01-11 08:21:02 +00:00
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "udp.srcport");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "udp.dstport");
|
|
|
|
snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
2002-06-28 20:13:03 +00:00
|
|
|
case PT_DDP:
|
|
|
|
if (is_src)
|
2002-06-29 21:27:39 +00:00
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ddp.src_socket");
|
2002-06-28 20:13:03 +00:00
|
|
|
else
|
2002-06-29 21:27:39 +00:00
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ddp.dst_socket");
|
2002-06-28 20:13:03 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
|
|
|
|
snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
break;
|
|
|
|
|
Add a new port type, PT_IPX, for IPX socket numbers; set "pinfo->ptype",
"pinfo->srcport", and "pinfo->destport" appropriately in the IPX
dissector. Add support for PT_IPX port types in display columns.
Have an "spx.socket" dissector table, similar to the "ipx.socket"
dissector table, and have the SPX dissector use that, with the IPX
socket numbers from "pinfo->srcport" and "pinfo->destport", so that
dissectors for protocols that run atop SPX can register with particular
socket numbers. (Think of it as similar to what would have been the
case had the IP header had 16-bit source and destination port numbers,
and had TCP and UDP used those port numbers rather than having port
numbers in their headers.) Also, have the SPX dissector dissect
subprotocols regardless of whether we're building a protocol tree or not.
Use the dissector handle for the IPX message dissector for both IPX
socket numbers; there's no need to create separate handles for both
registrations.
Have NDPS register as a subdissector of the SPX dissector, using
"spx.socket", and get rid of the duplicate SPX dissection in the NDPS
dissector.
Make the NDPS dissector set the columns regardless of whether a protocol
tree is being built, and clean up the dissector (fixing some bugs).
Get rid of unneeded includes in "packet-ndps.c".
svn path=/trunk/; revision=6424
2002-10-15 04:31:00 +00:00
|
|
|
case PT_IPX:
|
|
|
|
/* XXX - resolve IPX socket numbers */
|
|
|
|
snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
|
|
|
|
if (is_src)
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ipx.src.socket");
|
|
|
|
else
|
|
|
|
strcpy(pinfo->cinfo->col_expr[col], "ipx.dst.socket");
|
|
|
|
snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
|
|
|
|
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
break;
|
|
|
|
|
2001-04-01 07:32:35 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
|
|
|
|
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
|
2001-04-01 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-12-10 00:26:21 +00:00
|
|
|
fill_in_columns(packet_info *pinfo)
|
2001-04-01 07:32:35 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
for (i = 0; i < pinfo->cinfo->num_cols; i++) {
|
|
|
|
switch (pinfo->cinfo->col_fmt[i]) {
|
2001-04-01 07:32:35 +00:00
|
|
|
|
|
|
|
case COL_NUMBER:
|
2001-12-10 00:26:21 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
|
|
|
|
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(pinfo->cinfo->col_expr[i], "frame.number");
|
|
|
|
strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_CLS_TIME:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_ABS_TIME:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_ABS_DATE_TIME:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_REL_TIME:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DELTA_TIME:
|
2001-12-10 00:26:21 +00:00
|
|
|
col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_SRC:
|
|
|
|
case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->src, TRUE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_SRC:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->src, FALSE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_DL_SRC:
|
|
|
|
case COL_RES_DL_SRC:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dl_src, TRUE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_DL_SRC:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dl_src, FALSE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_NET_SRC:
|
|
|
|
case COL_RES_NET_SRC:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->net_src, TRUE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_NET_SRC:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->net_src, FALSE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_DST:
|
|
|
|
case COL_RES_DST: /* COL_DEF_DST is currently just like COL_RES_DST */
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dst, TRUE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_DST:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dst, FALSE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_DL_DST:
|
|
|
|
case COL_RES_DL_DST:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dl_dst, TRUE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_DL_DST:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->dl_dst, FALSE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_NET_DST:
|
|
|
|
case COL_RES_NET_DST:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->net_dst, TRUE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_NET_DST:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_addr(pinfo, i, &pinfo->net_dst, FALSE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_SRC_PORT:
|
|
|
|
case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_port(pinfo, i, pinfo->ptype, pinfo->srcport, TRUE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_SRC_PORT:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_port(pinfo, i, pinfo->ptype, pinfo->srcport, FALSE, TRUE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_DEF_DST_PORT:
|
|
|
|
case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_port(pinfo, i, pinfo->ptype, pinfo->destport, TRUE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_UNRES_DST_PORT:
|
2002-01-11 08:21:02 +00:00
|
|
|
col_set_port(pinfo, i, pinfo->ptype, pinfo->destport, FALSE, FALSE);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_PROTOCOL: /* currently done by dissectors */
|
|
|
|
case COL_INFO: /* currently done by dissectors */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COL_PACKET_LENGTH:
|
2001-12-10 02:15:54 +00:00
|
|
|
snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
|
2001-12-10 00:26:21 +00:00
|
|
|
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
|
2002-01-11 08:21:02 +00:00
|
|
|
strcpy(pinfo->cinfo->col_expr[i], "frame.pkt_len");
|
|
|
|
strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
|
2001-12-10 02:15:54 +00:00
|
|
|
g_assert_not_reached();
|
2001-04-01 07:32:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|