forked from osmocom/wireshark
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>
This commit is contained in:
parent
82b225898b
commit
5d0b3c2f24
|
@ -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
|
static void
|
||||||
col_do_append_fstr(column_info *cinfo, const int el, const char *separator, const char *format, va_list ap)
|
col_do_append_fstr(column_info *cinfo, const int el, const char *separator, const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
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,
|
/* 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.
|
* Same result as col_append_str() called for every string element.
|
||||||
|
|
|
@ -2516,13 +2516,8 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
||||||
static void
|
static void
|
||||||
tcp_info_append_uint(packet_info *pinfo, const char *abbrev, guint32 val)
|
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) */
|
/* fstr(" %s=%u", abbrev, val) */
|
||||||
col_append_lstr(pinfo->cinfo, COL_INFO,
|
col_append_str_uint(pinfo->cinfo, COL_INFO, " ", abbrev, val);
|
||||||
" ", abbrev, "=", buf,
|
|
||||||
COL_ADD_LSTR_TERMINATOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
dst_port_str = tcp_port_to_display(wmem_packet_scope(), tcph->th_dport);
|
||||||
col_add_lstr(pinfo->cinfo, COL_INFO,
|
col_add_lstr(pinfo->cinfo, COL_INFO,
|
||||||
src_port_str,
|
src_port_str,
|
||||||
"\xe2\x86\x92", /* UTF8_RIGHTWARDS_ARROW */
|
" \xe2\x86\x92 ", /* UTF8_RIGHTWARDS_ARROW */
|
||||||
dst_port_str,
|
dst_port_str,
|
||||||
COL_ADD_LSTR_TERMINATOR);
|
COL_ADD_LSTR_TERMINATOR);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
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);
|
dst_port_str = udp_port_to_display(wmem_packet_scope(), udph->uh_dport);
|
||||||
|
|
||||||
col_add_lstr(pinfo->cinfo, COL_INFO,
|
col_add_lstr(pinfo->cinfo, COL_INFO,
|
||||||
"Source port: ", src_port_str, " "
|
src_port_str,
|
||||||
"Destination port: ", dst_port_str,
|
" \xe2\x86\x92 ", /* UTF8_RIGHTWARDS_ARROW */
|
||||||
COL_ADD_LSTR_TERMINATOR);
|
dst_port_str,
|
||||||
|
COL_ADD_LSTR_TERMINATOR);
|
||||||
|
|
||||||
if (tree) {
|
if (tree) {
|
||||||
if (udp_summary_in_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_cov = (udph->uh_sum_cov) ? udph->uh_sum_cov : udph->uh_ulen;
|
||||||
udph->uh_sum = tvb_get_ntohs(tvb, offset+6);
|
udph->uh_sum = tvb_get_ntohs(tvb, offset+6);
|
||||||
reported_len = tvb_reported_length(tvb);
|
reported_len = tvb_reported_length(tvb);
|
||||||
|
|
Loading…
Reference in New Issue