aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-10-04 02:52:10 +0100
committerEvan Huus <eapache@gmail.com>2015-10-05 02:32:31 +0000
commit5d0b3c2f2427d7545d3a49bcfe44431aba533b2a (patch)
tree96c5854d674f6a90ee89a880440066e9a7576148
parent82b225898b677e7a7e0176941ef73c824d761a98 (diff)
UDP: Make port column info similar to TCP, add length information
Change-Id: I3f7a35db53a1ecc9d543b80f143eb6082616e458 Reviewed-on: https://code.wireshark.org/review/10702 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
-rw-r--r--epan/column-utils.c9
-rw-r--r--epan/column-utils.h10
-rw-r--r--epan/dissectors/packet-tcp.c9
-rw-r--r--epan/dissectors/packet-udp.c9
4 files changed, 26 insertions, 11 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index d9e8b1bc0b..8db8521e67 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -409,6 +409,15 @@ col_append_lstr(column_info *cinfo, const gint el, const gchar *str1, ...)
}
}
+void
+col_append_str_uint(column_info *cinfo, const gint col, const gchar *sep, const gchar *abbrev, guint32 val)
+{
+ char buf[16];
+
+ guint32_to_str_buf(val, buf, sizeof(buf));
+ col_append_lstr(cinfo, col, sep ? sep : "", abbrev, "=", buf, COL_ADD_LSTR_TERMINATOR);
+}
+
static void
col_do_append_fstr(column_info *cinfo, const int el, const char *separator, const char *format, va_list ap)
{
diff --git a/epan/column-utils.h b/epan/column-utils.h
index 5da1c805bc..af4eb28c48 100644
--- a/epan/column-utils.h
+++ b/epan/column-utils.h
@@ -269,6 +269,16 @@ gboolean col_based_on_frame_data(column_info *cinfo, const gint col);
*/
WS_DLL_PUBLIC void col_append_str(column_info *cinfo, const gint col, const gchar *str);
+/** Append <abbrev>=<val> to a column element, the text will be copied.
+ *
+ * @param cinfo the current packet row
+ * @param col the column to use, e.g. COL_INFO
+ * @param sep an optional separator to prepend to abbrev
+ * @param abbrev the string to append
+ * @param val the value to append
+ */
+WS_DLL_PUBLIC void col_append_str_uint(column_info *cinfo, const gint col, const gchar *sep, const gchar *abbrev, guint32 val);
+
/* Append the given strings (terminated by COL_ADD_LSTR_TERMINATOR) to a column element,
*
* Same result as col_append_str() called for every string element.
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index af27d5917f..ef939b2c25 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -2516,13 +2516,8 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static void
tcp_info_append_uint(packet_info *pinfo, const char *abbrev, guint32 val)
{
- char buf[16];
-
- guint32_to_str_buf(val, buf, sizeof(buf));
/* fstr(" %s=%u", abbrev, val) */
- col_append_lstr(pinfo->cinfo, COL_INFO,
- " ", abbrev, "=", buf,
- COL_ADD_LSTR_TERMINATOR);
+ col_append_str_uint(pinfo->cinfo, COL_INFO, " ", abbrev, val);
}
static void
@@ -4380,7 +4375,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dst_port_str = tcp_port_to_display(wmem_packet_scope(), tcph->th_dport);
col_add_lstr(pinfo->cinfo, COL_INFO,
src_port_str,
- "\xe2\x86\x92", /* UTF8_RIGHTWARDS_ARROW */
+ " \xe2\x86\x92 ", /* UTF8_RIGHTWARDS_ARROW */
dst_port_str,
COL_ADD_LSTR_TERMINATOR);
diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c
index 27612225ea..e7d26e30ea 100644
--- a/epan/dissectors/packet-udp.c
+++ b/epan/dissectors/packet-udp.c
@@ -714,11 +714,11 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
src_port_str = udp_port_to_display(wmem_packet_scope(), udph->uh_sport);
dst_port_str = udp_port_to_display(wmem_packet_scope(), udph->uh_dport);
-
col_add_lstr(pinfo->cinfo, COL_INFO,
- "Source port: ", src_port_str, " "
- "Destination port: ", dst_port_str,
- COL_ADD_LSTR_TERMINATOR);
+ src_port_str,
+ " \xe2\x86\x92 ", /* UTF8_RIGHTWARDS_ARROW */
+ dst_port_str,
+ COL_ADD_LSTR_TERMINATOR);
if (tree) {
if (udp_summary_in_tree) {
@@ -821,6 +821,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
}
}
+ col_append_str_uint(pinfo->cinfo, COL_INFO, " ", "Len", udph->uh_ulen - 8); /* Payload length */
udph->uh_sum_cov = (udph->uh_sum_cov) ? udph->uh_sum_cov : udph->uh_ulen;
udph->uh_sum = tvb_get_ntohs(tvb, offset+6);
reported_len = tvb_reported_length(tvb);