aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <a.broman58@gmail.com>2023-08-18 10:20:58 +0200
committerAndersBroman <a.broman58@gmail.com>2023-08-18 08:57:12 +0000
commitc5452afb8d99665af4b740d3e671375bcf9b35cf (patch)
tree321a35913b48517bd804af7810289844930bdc84
parente5e004e064374813462eb53a2a7e9b30fcf7081c (diff)
Exported PDU: Add new tag EXP_PDU_TAG_COL_PROT_TEXT
Add a new tag to write to the info column.
-rw-r--r--epan/dissectors/packet-exported_pdu.c29
-rw-r--r--wsutil/exported_pdu_tlvs.h2
2 files changed, 31 insertions, 0 deletions
diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c
index b1a163c6a7..dd6336ab5d 100644
--- a/epan/dissectors/packet-exported_pdu.c
+++ b/epan/dissectors/packet-exported_pdu.c
@@ -62,6 +62,7 @@ static int hf_exported_pdu_dvbci_evt = -1;
static int hf_exported_pdu_exported_pdu = -1;
static int hf_exported_pdu_dis_table_val = -1;
static int hf_exported_pdu_col_proto_str = -1;
+static int hf_exported_pdu_col_info_str = -1;
/* Initialize the subtree pointers */
static gint ett_exported_pdu = -1;
@@ -107,6 +108,7 @@ static const value_string exported_pdu_tag_vals[] = {
{ EXP_PDU_TAG_COL_PROT_TEXT, "Column Protocol String" },
{ EXP_PDU_TAG_TCP_INFO_DATA, "TCP Dissector Data" },
{ EXP_PDU_TAG_P2P_DIRECTION, "P2P direction" },
+ { EXP_PDU_TAG_COL_INFO_TEXT, "Column Information String" },
{ 0, NULL }
};
@@ -196,6 +198,7 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
const guint8 *proto_name = NULL;
const guint8 *dissector_table = NULL;
const guint8 *col_proto_str = NULL;
+ const guint8* col_info_str = NULL;
dissector_handle_t proto_handle;
mtp3_addr_pc_t *mtp3_addr;
guint8 dvb_ci_dir;
@@ -350,6 +353,9 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
pinfo->p2p_dir = tvb_get_ntohl(tvb, offset);
proto_tree_add_item(tag_tree, hf_exported_pdu_p2p_dir, tvb, offset, 4, ENC_NA);
break;
+ case EXP_PDU_TAG_COL_INFO_TEXT:
+ proto_tree_add_item_ret_string(tag_tree, hf_exported_pdu_col_info_str, tvb, offset, tag_len, ENC_UTF_8 | ENC_NA, pinfo->pool, &col_info_str);
+ break;
case EXP_PDU_TAG_END_OF_OPT:
break;
default:
@@ -377,6 +383,12 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
} else {
col_clear(pinfo->cinfo, COL_PROTOCOL);
}
+ if (col_info_str) {
+ col_add_str(pinfo->cinfo, COL_INFO, col_info_str);
+ }
+ else {
+ col_clear(pinfo->cinfo, COL_INFO);
+ }
call_dissector_with_data(proto_handle, payload_tvb, pinfo, tree, dissector_data);
}
break;
@@ -389,6 +401,12 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
} else {
col_clear(pinfo->cinfo, COL_PROTOCOL);
}
+ if (col_info_str) {
+ col_add_str(pinfo->cinfo, COL_INFO, col_info_str);
+ }
+ else {
+ col_clear(pinfo->cinfo, COL_INFO);
+ }
call_heur_dissector_direct(heur_diss, payload_tvb, pinfo, tree, dissector_data);
}
break;
@@ -402,6 +420,12 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
} else {
col_clear(pinfo->cinfo, COL_PROTOCOL);
}
+ if (col_info_str) {
+ col_add_str(pinfo->cinfo, COL_INFO, col_info_str);
+ }
+ else {
+ col_clear(pinfo->cinfo, COL_INFO);
+ }
dissector_try_uint_new(dis_tbl, dissector_table_val, payload_tvb, pinfo, tree, FALSE, dissector_data);
}
}
@@ -566,6 +590,11 @@ proto_register_exported_pdu(void)
FT_STRINGZPAD, BASE_NONE, NULL, 0,
NULL, HFILL }
},
+ { &hf_exported_pdu_col_info_str,
+ { "Column information string", "exported_pdu.col_info_str",
+ FT_STRINGZPAD, BASE_NONE, NULL, 0,
+ NULL, HFILL }
+ },
};
/* Setup protocol subtree array */
diff --git a/wsutil/exported_pdu_tlvs.h b/wsutil/exported_pdu_tlvs.h
index c193eac83d..8083eb1fa3 100644
--- a/wsutil/exported_pdu_tlvs.h
+++ b/wsutil/exported_pdu_tlvs.h
@@ -162,6 +162,8 @@
#define EXP_PDU_TAG_P2P_DIRECTION 35 /**< The packet direction (P2P_DIR_SENT, P2P_DIR_RECV). */
+#define EXP_PDU_TAG_COL_INFO_TEXT 36 /**< UTF-8 text string to put in COL_INFO, useful when puting meta data into the packet list.
+ */
#define EXP_PDU_TAG_IPV4_LEN 4
#define EXP_PDU_TAG_IPV6_LEN 16