summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--column.c23
-rw-r--r--epan/column-utils.c118
-rw-r--r--epan/column_info.h3
3 files changed, 120 insertions, 24 deletions
diff --git a/column.c b/column.c
index 4617a48eae..fe574c45cb 100644
--- a/column.c
+++ b/column.c
@@ -1,7 +1,7 @@
/* column.c
* Routines for handling column preferences
*
- * $Id: column.c,v 1.39 2002/12/10 00:12:57 guy Exp $
+ * $Id: column.c,v 1.40 2002/12/10 01:17:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -52,7 +52,7 @@ col_format_to_string(gint fmt) {
"%us","%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d",
"%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd",
"%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p",
- "%i", "%L", "%XO", "%XR", "%I" };
+ "%i", "%L", "%XO", "%XR", "%I", "%c" };
if (fmt < 0 || fmt > NUM_COL_FMTS)
return NULL;
@@ -80,7 +80,8 @@ col_format_desc(gint fmt) {
"Src port (unresolved)", "Destination port",
"Dest port (resolved)", "Dest port (unresolved)",
"Protocol", "Information", "Packet length (bytes)" ,
- "OXID", "RXID", "FW-1 monitor if/direction" };
+ "OXID", "RXID", "FW-1 monitor if/direction",
+ "Circuit ID" };
return(dlist[fmt]);
}
@@ -147,6 +148,9 @@ get_column_format_matches(gboolean *fmt_list, gint format) {
case COL_IF_DIR:
fmt_list[COL_IF_DIR] = TRUE;
break;
+ case COL_CIRCUIT_ID:
+ fmt_list[COL_CIRCUIT_ID] = TRUE;
+ break;
default:
break;
}
@@ -230,6 +234,9 @@ get_column_longest_string(gint format)
case COL_IF_DIR:
return "i 00000000 I";
break;
+ case COL_CIRCUIT_ID:
+ return "000000";
+ break;
default: /* COL_INFO */
return "Source port: kerberos-master Destination port: kerberos-master";
break;
@@ -262,6 +269,7 @@ get_column_resize_type(gint format) {
case COL_PROTOCOL:
case COL_PACKET_LENGTH:
case COL_IF_DIR:
+ case COL_CIRCUIT_ID:
/* We don't want these to resize during a live capture, as that
gets in the way of trying to look at the data while it's being
captured. */
@@ -391,15 +399,18 @@ get_column_format_from_str(gchar *str) {
case 'L':
return COL_PACKET_LENGTH;
break;
- case 'I':
- return COL_IF_DIR;
- break;
case 'X':
prev_code = COL_OXID;
break;
case 'O':
return COL_OXID;
break;
+ case 'I':
+ return COL_IF_DIR;
+ break;
+ case 'c':
+ return COL_CIRCUIT_ID;
+ break;
}
cptr++;
}
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 7a01166dfb..e35d19b319 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1,7 +1,7 @@
/* column-utils.c
* Routines for column utilities.
*
- * $Id: column-utils.c,v 1.29 2002/12/10 00:12:59 guy Exp $
+ * $Id: column-utils.c,v 1.30 2002/12/10 01:17:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -43,6 +43,7 @@
#include "resolv.h"
#include "ipv6-utils.h"
#include "osi-utils.h"
+#include "value_string.h"
/* Allocate all the data structures for constructing column data, given
the number of columns. */
@@ -501,12 +502,17 @@ col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
}
static void
-col_set_port(packet_info *pinfo, int col, port_type ptype, guint32 port,
- gboolean is_res, gboolean is_src)
+col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
{
+ guint32 port;
+
+ if (is_src)
+ port = pinfo->srcport;
+ else
+ port = pinfo->destport;
pinfo->cinfo->col_expr[col][0] = '\0';
pinfo->cinfo->col_expr_val[col][0] = '\0';
- switch (ptype) {
+ switch (pinfo->ptype) {
case PT_SCTP:
if (is_res)
@@ -569,6 +575,78 @@ col_set_port(packet_info *pinfo, int col, port_type ptype, guint32 port,
pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
}
+/*
+ * XXX - this should be in some common code in the epan directory, shared
+ * by this code and packet-isdn.c.
+ */
+static const value_string channel_vals[] = {
+ { 0, "D" },
+ { 1, "B1" },
+ { 2, "B2" },
+ { 3, "B3" },
+ { 4, "B4" },
+ { 5, "B5" },
+ { 6, "B6" },
+ { 7, "B7" },
+ { 8, "B8" },
+ { 9, "B9" },
+ { 10, "B10" },
+ { 11, "B11" },
+ { 12, "B12" },
+ { 13, "B13" },
+ { 14, "B14" },
+ { 15, "B15" },
+ { 16, "B16" },
+ { 17, "B17" },
+ { 18, "B19" },
+ { 19, "B19" },
+ { 20, "B20" },
+ { 21, "B21" },
+ { 22, "B22" },
+ { 23, "B23" },
+ { 24, "B24" },
+ { 25, "B25" },
+ { 26, "B26" },
+ { 27, "B27" },
+ { 28, "B29" },
+ { 29, "B29" },
+ { 30, "B30" },
+ { 0, NULL }
+};
+
+static void
+col_set_circuit_id(packet_info *pinfo, int col)
+{
+ pinfo->cinfo->col_expr[col][0] = '\0';
+ pinfo->cinfo->col_expr_val[col][0] = '\0';
+ switch (pinfo->ctype) {
+
+ case CT_DLCI:
+ snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ strcpy(pinfo->cinfo->col_expr[col], "fr.dlci");
+ snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
+ break;
+
+ case CT_ISDN:
+ snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
+ val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
+ strcpy(pinfo->cinfo->col_expr[col], "isdn.channel");
+ snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
+ break;
+
+ case CT_X25:
+ snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ break;
+
+ default:
+ break;
+ }
+ pinfo->cinfo->col_buf[col][COL_MAX_LEN - 1] = '\0';
+ pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
+}
+
void
fill_in_columns(packet_info *pinfo)
{
@@ -660,25 +738,24 @@ fill_in_columns(packet_info *pinfo)
case COL_DEF_SRC_PORT:
case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
- col_set_port(pinfo, i, pinfo->ptype, pinfo->srcport, TRUE, TRUE);
+ col_set_port(pinfo, i, TRUE, TRUE);
break;
case COL_UNRES_SRC_PORT:
- col_set_port(pinfo, i, pinfo->ptype, pinfo->srcport, FALSE, TRUE);
+ col_set_port(pinfo, i, FALSE, TRUE);
break;
case COL_DEF_DST_PORT:
case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
- col_set_port(pinfo, i, pinfo->ptype, pinfo->destport, TRUE, FALSE);
+ col_set_port(pinfo, i, TRUE, FALSE);
break;
case COL_UNRES_DST_PORT:
- col_set_port(pinfo, i, pinfo->ptype, pinfo->destport, FALSE, FALSE);
+ col_set_port(pinfo, i, FALSE, FALSE);
break;
case COL_PROTOCOL: /* currently done by dissectors */
case COL_INFO: /* currently done by dissectors */
- case COL_IF_DIR: /* currently done by dissectors */
break;
case COL_PACKET_LENGTH:
@@ -689,16 +766,23 @@ fill_in_columns(packet_info *pinfo)
break;
case COL_OXID:
- snprintf (pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
- pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
- pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
- break;
+ snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
+ pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
+ pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
+ break;
case COL_RXID:
- snprintf (pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
- pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
- pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
- break;
+ snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
+ pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
+ pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
+ break;
+
+ case COL_IF_DIR: /* currently done by dissectors */
+ break;
+
+ case COL_CIRCUIT_ID:
+ col_set_circuit_id(pinfo, i);
+ break;
case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
g_assert_not_reached();
diff --git a/epan/column_info.h b/epan/column_info.h
index f88b82f637..be4a064cfb 100644
--- a/epan/column_info.h
+++ b/epan/column_info.h
@@ -1,7 +1,7 @@
/* column.h
* Definitions for column structures and routines
*
- * $Id: column_info.h,v 1.5 2002/12/10 00:12:59 guy Exp $
+ * $Id: column_info.h,v 1.6 2002/12/10 01:17:21 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -88,6 +88,7 @@ enum {
COL_OXID, /* Fibre Channel OXID */
COL_RXID, /* Fibre Channel RXID */
COL_IF_DIR, /* FW-1 monitor interface/direction */
+ COL_CIRCUIT_ID, /* Circuit ID */
NUM_COL_FMTS /* Should always be last */
};