pinfo->cinfo->col_data[col] = pinfo->cinfo->col_buf[col];
}
+#if 0
+/* ------------- */
+static gchar *
+set_circuit_id(packet_info *pinfo)
+{
+ char *ret = "";
+ switch (pinfo->ctype) {
+
+ case CT_DLCI:
+ case CT_X25:
+ case CT_ISUP:
+ ret = se_strdup_printf("%u", pinfo->circuit_id);
+ break;
+
+ case CT_ISDN:
+ ret = se_strdup_printf("%s", val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
+ break;
+
+ default:
+ break;
+ }
+ return ret;
+}
+#endif
+
gboolean
col_based_on_frame_data(column_info *cinfo, gint col)
{
}
}
}
+#if 0
+XXX this needs more rework?
+/* --------------------------- */
+
+static gchar *
+set_addr(address *addr, gboolean is_res)
+{
+ if (addr->type == AT_NONE)
+ return ""; /* no address, nothing to do */
+
+ if (is_res) {
+ return se_get_addr_name(addr /*, COL_MAX_LEN*/);
+ }
+ return se_address_to_str(addr);
+}
+
+/* Fills col_text in the frame data structure */
+void
+col_fill_fdata(packet_info *pinfo)
+{
+ int i;
+ frame_data *fdata;
+ gboolean res;
+
+ if (!pinfo->cinfo)
+ return;
+
+ fdata = pinfo->fd;
+
+ res =FALSE;
+
+ for (i = 0; i < pinfo->cinfo->num_cols; i++) {
+
+ switch (pinfo->cinfo->col_fmt[i]) {
+ case COL_NUMBER: /* frame number */
+ case COL_PACKET_LENGTH: /* fd->pkt_len */
+ case COL_CUMULATIVE_BYTES: /* fd->cum_bytes */
+ case COL_CLS_TIME:
+ case COL_ABS_TIME:
+ case COL_ABS_DATE_TIME: /* from fd structures */
+ case COL_REL_TIME:
+ case COL_DELTA_TIME:
+ case COL_DELTA_TIME_DIS:
+ break;
+
+ case COL_DEF_SRC:
+ case COL_RES_SRC: /* COL_DEF_SRC is currently just like COL_RES_SRC */
+ res = TRUE;
+ case COL_UNRES_SRC:
+ fdata->col_text[i] = set_addr(&pinfo->src, res);
+ break;
+
+ case COL_DEF_DL_SRC:
+ case COL_RES_DL_SRC:
+ res = TRUE;
+ case COL_UNRES_DL_SRC:
+ fdata->col_text[i] = set_addr (&pinfo->dl_src, res);
+ break;
+
+ case COL_DEF_NET_SRC:
+ case COL_RES_NET_SRC:
+ res = TRUE;
+ case COL_UNRES_NET_SRC:
+ fdata->col_text[i] = set_addr (&pinfo->net_src, res);
+ break;
+
+ case COL_DEF_DST:
+ case COL_RES_DST: /* COL_DEF_DST is currently just like COL_RES_DST */
+ res = TRUE;
+ case COL_UNRES_DST:
+ fdata->col_text[i] = set_addr (&pinfo->dst, res);
+ break;
+
+ case COL_DEF_DL_DST:
+ case COL_RES_DL_DST:
+ res = TRUE;
+ case COL_UNRES_DL_DST:
+ fdata->col_text[i] = set_addr (&pinfo->dl_dst, res);
+ break;
+
+ case COL_DEF_NET_DST:
+ case COL_RES_NET_DST:
+ res = TRUE;
+ case COL_UNRES_NET_DST:
+ fdata->col_text[i] = set_addr (&pinfo->net_dst, res);
+ break;
+
+ case COL_DEF_SRC_PORT:
+ case COL_RES_SRC_PORT: /* COL_DEF_SRC_PORT is currently just like COL_RES_SRC_PORT */
+ fdata->col_text[i] = set_port(pinfo, TRUE, pinfo->srcport);
+ break;
+ case COL_UNRES_SRC_PORT:
+ fdata->col_text[i] = set_port(pinfo, FALSE, pinfo->srcport);
+ break;
+
+ case COL_DEF_DST_PORT:
+ case COL_RES_DST_PORT: /* COL_DEF_DST_PORT is currently just like COL_RES_DST_PORT */
+ fdata->col_text[i] = set_port(pinfo, TRUE, pinfo->destport);
+ break;
+
+ case COL_UNRES_DST_PORT:
+ fdata->col_text[i] = set_port(pinfo, FALSE, pinfo->destport);
+ break;
+
+ case COL_IF_DIR: /* currently done by dissectors */
+ case COL_PROTOCOL:
+ case COL_INFO:
+ case COL_HPUX_SUBSYS:
+ case COL_HPUX_DEVID:
+ case COL_DCE_CALL:
+ case COL_8021Q_VLAN_ID:
+ case COL_DSCP_VALUE:
+ case COL_COS_VALUE:
+ case COL_FR_DLCI:
+ case COL_BSSGP_TLLI:
+ case COL_EXPERT:
+ case COL_CUSTOM:
+ case COL_FREQ_CHAN:
+ if (pinfo->cinfo->col_data[i] != pinfo->cinfo->col_buf[i]) {
+ /* XXX assume it's a constant */
+ fdata->col_text[i] = (gchar *)pinfo->cinfo->col_data[i];
+ }
+ else {
+ /* copy */
+ fdata->col_text[i] = se_strdup(pinfo->cinfo->col_data[i]);
+ }
+ break;
+ case COL_OXID:
+ fdata->col_text[i] = (gchar *)(GUINT_TO_POINTER((guint)pinfo->oxid));
+ break;
+ case COL_RXID:
+ fdata->col_text[i] = (gchar *)(GUINT_TO_POINTER((guint)pinfo->rxid));
+ break;
+ case COL_CIRCUIT_ID:
+ set_circuit_id(pinfo);
+ break;
+ case COL_SRCIDX:
+ fdata->col_text[i] = (gchar *)(GUINT_TO_POINTER((guint)pinfo->src_idx));
+ break;
+ case COL_DSTIDX:
+ fdata->col_text[i] = (gchar *)(GUINT_TO_POINTER((guint)pinfo->dst_idx));
+ break;
+ case COL_VSAN:
+ fdata->col_text[i] = (gchar *)(GUINT_TO_POINTER((guint)pinfo->vsan));
+ break;
+
+ case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
+ g_assert_not_reached();
+ break;
+ }
+ }
+}
+
+/* XXX Gets/creates the text fro col_text in frame data */
+/* --------------------- */
+gchar *
+col_get_text(frame_data *fd, column_info *cinfo, gint col)
+{
+static gchar fmtbuf[3][COL_MAX_LEN];
+static int idx;
+gchar *buf;
+gchar *ptr;
+
+ idx = (idx + 1) % 3;
+ buf = fmtbuf[idx];
+ *buf = 0;
+ ptr = buf;
+
+ switch (cinfo->col_fmt[col]) {
+ case COL_NUMBER: /* frame number */
+ g_snprintf(buf, COL_MAX_LEN, "%u", fd->num);
+ break;
+
+ case COL_CLS_TIME:
+ set_cls_time(fd, buf);
+ break;
+ case COL_ABS_TIME:
+ set_abs_time(fd, buf);
+ break;
+ case COL_ABS_DATE_TIME:
+ set_abs_date_time(fd, buf);
+ break;
+ case COL_REL_TIME:
+ set_rel_time(fd, buf);
+ break;
+ case COL_DELTA_TIME:
+ set_delta_time(fd, buf);
+ break;
+ case COL_DELTA_TIME_DIS:
+ set_delta_time_dis(fd, buf);
+ break;
+
+ case COL_PACKET_LENGTH: /* fd->pkt_len */
+ g_snprintf(buf, COL_MAX_LEN, "%u", fd->pkt_len);
+ break;
+
+ case COL_CUMULATIVE_BYTES: /* fd->cum_bytes */
+ g_snprintf(buf, COL_MAX_LEN, "%u", fd->cum_bytes);
+ break;
+
+ case COL_DEF_SRC:
+ case COL_RES_SRC: /* network address */
+ case COL_UNRES_SRC:
+ case COL_DEF_DL_SRC:
+ case COL_RES_DL_SRC:
+ case COL_UNRES_DL_SRC:
+ case COL_DEF_NET_SRC:
+ case COL_RES_NET_SRC:
+ case COL_UNRES_NET_SRC:
+ case COL_DEF_DST:
+ case COL_RES_DST:
+ case COL_UNRES_DST:
+ case COL_DEF_DL_DST:
+ case COL_RES_DL_DST:
+ case COL_UNRES_DL_DST:
+ case COL_DEF_NET_DST:
+ case COL_RES_NET_DST:
+ case COL_UNRES_NET_DST:
+
+ case COL_IF_DIR:
+ case COL_CIRCUIT_ID:
+ case COL_PROTOCOL:
+ case COL_INFO:
+ case COL_HPUX_SUBSYS:
+ case COL_HPUX_DEVID:
+ case COL_DCE_CALL:
+ case COL_8021Q_VLAN_ID:
+ case COL_DSCP_VALUE:
+ case COL_COS_VALUE:
+ case COL_FR_DLCI:
+ case COL_BSSGP_TLLI:
+ case COL_EXPERT:
+ case COL_CUSTOM:
+ case COL_FREQ_CHAN:
+ ptr = fd->col_text[col];
+ break;
+ case COL_DEF_SRC_PORT:
+ case COL_RES_SRC_PORT:
+ case COL_UNRES_SRC_PORT:
+ case COL_DEF_DST_PORT:
+ case COL_RES_DST_PORT:
+ case COL_UNRES_DST_PORT:
+ /* hack */
+ if (GPOINTER_TO_UINT(fd->col_text[col]) <= 65536)
+ g_snprintf(buf, COL_MAX_LEN, "%u", GPOINTER_TO_UINT(fd->col_text[col]));
+ else
+ ptr = fd->col_text[col];
+ break;
+
+ case COL_OXID:
+ case COL_RXID:
+ case COL_SRCIDX:
+ case COL_DSTIDX:
+ g_snprintf(buf, COL_MAX_LEN, "0x%x", GPOINTER_TO_UINT(fd->col_text[col]));
+ break;
+
+ case COL_VSAN:
+ g_snprintf(buf, COL_MAX_LEN, "%u", GPOINTER_TO_UINT(fd->col_text[col]));
+ break;
+
+ case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
+ g_assert_not_reached();
+ break;
+ }
+ return ptr;
+}
+#endif
col_clear
col_custom_prime_edt
col_custom_set_fstr
+col_fill_in
col_fill_in_frame_data
col_format_desc
col_format_to_string
#ifdef NEW_PACKET_LIST
if (add_to_packet_list) {
- if (cinfo)
- epan_dissect_fill_in_columns(&edt, FALSE);
+ /* We fill the needed columns from new_packet_list */
row = new_packet_list_append(cinfo, fdata, &edt.pi);
}
#endif
- if( (fdata->flags.passed_dfilter) || (edt.pi.fd->flags.ref_time) )
+ if( (fdata->flags.passed_dfilter) || (fdata->flags.ref_time) )
{
/* This frame either passed the display filter list or is marked as
a time reference frame. All time reference frames are displayed
even if they dont pass the display filter */
- if(edt.pi.fd->flags.ref_time){
+ if(fdata->flags.ref_time){
/* if this was a TIME REF frame we should reset the cul bytes field */
cum_bytes = fdata->pkt_len;
fdata->cum_bytes = cum_bytes;
fdata->flags.marked = 0;
fdata->flags.ref_time = 0;
fdata->color_filter = NULL;
+ fdata->col_text = NULL;
fdata->abs_ts.secs = phdr->ts.secs;
fdata->abs_ts.nsecs = phdr->ts.nsecs;
if (cinfo) {
/* Allocate the array holding column text, the size is the current number of columns */
- row_data.col_text = se_alloc(sizeof(row_data.col_text)*packetlist->n_columns);
+ fdata->col_text = se_alloc(sizeof(fdata->col_text)*packetlist->n_columns);
g_assert(packetlist->n_columns == cinfo->num_cols);
+ col_fill_in(pinfo, FALSE);
for(i = 0; i < cinfo->num_cols; i++) {
switch (cinfo->col_fmt[i]){
/* We already store the value in frame_data, so don't duplicate this. */
case COL_PACKET_LENGTH: /* 47) Packet length in bytes */
case COL_REL_TIME: /* 49) Relative time */
case COL_CLS_TIME: /* 58) Command line-specified time (default relative) */
- row_data.col_text[i] = NULL;
+ fdata->col_text[i] = NULL;
break;
/* We handle custom columns lazily */
case COL_CUSTOM: /* 8) Custom column (any filter name's contents) */
- row_data.col_text[i] = NULL;
+ fdata->col_text[i] = NULL;
break;
/* String in pinfo */
case COL_OXID: /* 22) Fibre Channel OXID */
case COL_SRCIDX: /* 5) Src port idx - Cisco MDS-specific */
case COL_DSTIDX: /* 4) Dst port idx - Cisco MDS-specific */
case COL_VSAN: /* 6) VSAN - Cisco MDS-specific */
- row_data.col_text[i] = se_strdup(pinfo->cinfo->col_buf[i]);
+ fdata->col_text[i] = se_strdup(pinfo->cinfo->col_buf[i]);
break;
/* Columns based on (binary)data in pinfo */
case COL_CIRCUIT_ID: /* 3) Circuit ID */
case COL_RES_SRC_PORT: /* 55) Resolved source port */
case COL_UNRES_SRC_PORT: /* 56) Unresolved source port */
/* pinfo->srcport */
- row_data.col_text[i] = se_strdup(cinfo->col_data[i]);
+ fdata->col_text[i] = se_strdup(cinfo->col_data[i]);
break;
/* currently done by dissectors XXX change to custom col instead??*/
case COL_IF_DIR: /* 21) FW-1 monitor interface/direction */
/* Will be set by various dissectors */
case COL_DELTA_CONV_TIME: /* 12) Delta time to last frame in conversation */
case COL_REL_CONV_TIME: /* 50) Relative time to beginning of conversation */
- row_data.col_text[i] = se_strdup(cinfo->col_data[i]);
+ fdata->col_text[i] = se_strdup(cinfo->col_data[i]);
break;
default:
/* We should have a case statement for all columns */
}
}
}
- else
- row_data.col_text = NULL;
row_data.fdata = fdata;
col_fill_in_frame_data(fdata, &cfile.cinfo, col_num);
cell_text = cfile.cinfo.col_data[col_num];
}else
- cell_text = record->col_text[col_num];
+ cell_text = fdata->col_text[col_num];
if((fdata->color_filter)||(fdata->flags.marked)){
gboolean color_on = enable_color;
col_fill_in_frame_data(record->fdata, &cfile.cinfo, col_num);
*cell_text = g_strdup(cfile.cinfo.col_data[col_num]);
}else
- *cell_text = g_strdup(record->col_text[col_num]);
+ *cell_text = g_strdup(record->fdata->col_text[col_num]);
return TRUE;
}
g_value_set_pointer(value, iter->user_data);
break;
case G_TYPE_STRING:
- g_value_set_string(value, record->col_text[column]);
+ g_value_set_string(value, record->fdata->col_text[column]);
break;
default:
g_warning ("%s: Unsupported type (%s) retrieved.", G_STRLOC, g_type_name (value->g_type));
newrecord = se_alloc(sizeof(PacketListRecord));
newrecord->dissected = FALSE;
- newrecord->col_text = row_data->col_text;
newrecord->fdata = row_data->fdata;
newrecord->pos = pos;
g_assert(row < PACKET_LIST_RECORD_COUNT(packet_list->rows));
record = PACKET_LIST_RECORD_GET(packet_list->rows, row);
g_assert(record->pos == row);
- g_assert(!record->col_text || (record->col_text[col] == NULL));
- if (!record->col_text)
- record->col_text = se_alloc0(sizeof(record->col_text)*packet_list->n_columns);
+ g_assert(!record->fdata->col_text || (record->fdata->col_text[col] == NULL));
+ if (!record->fdata->col_text)
+ record->fdata->col_text = se_alloc0(sizeof(record->fdata->col_text)*packet_list->n_columns);
- record->col_text[col] = se_strdup(cinfo->col_data[col]);
+ record->fdata->col_text[col] = se_strdup(cinfo->col_data[col]);
}
static gboolean
if (col_based_on_frame_data(&cfile.cinfo, sort_id))
return frame_data_compare(a->fdata, b->fdata, cfile.cinfo.col_fmt[sort_id]);
- if((a->col_text[sort_id]) && (b->col_text[sort_id]))
- return strcmp(a->col_text[sort_id], b->col_text[sort_id]);
+ if((a->fdata->col_text[sort_id]) && (b->fdata->col_text[sort_id]))
+ return strcmp(a->fdata->col_text[sort_id], b->fdata->col_text[sort_id]);
- if(a->col_text[sort_id] == b->col_text[sort_id])
+ if(a->fdata->col_text[sort_id] == b->fdata->col_text[sort_id])
return 0; /* both are NULL */
else
- return (a->col_text[sort_id] == NULL) ? -1 : 1;
+ return (a->fdata->col_text[sort_id] == NULL) ? -1 : 1;
g_return_val_if_reached(0);
}
#define PACKETLIST_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PACKETLIST_TYPE_LIST, PacketListClass))
typedef struct {
- gchar **col_text;
frame_data *fdata;
} row_data_t;