ep_<protocol>_port_to_display -> <protocol>_port_to_display

Adjust any other ep_ related APIs related to the transition.

Change-Id: I961b371c2c4bda557e0f1817705c27eef0dae66c
Reviewed-on: https://code.wireshark.org/review/6388
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2015-01-07 16:24:17 -05:00 committed by Anders Broman
parent 907d145f86
commit 2209678149
26 changed files with 153 additions and 115 deletions

View File

@ -75,7 +75,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
build_follow_index_filter@Base 1.12.0~rc1
byte_array_dup@Base 1.9.1
byte_array_equal@Base 1.9.1
bytes_to_ep_str@Base 1.12.0~rc1
bytes_to_str@Base 1.99.2
bytestring_to_str@Base 1.9.1
call_ber_oid_callback@Base 1.9.1
@ -443,7 +442,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
ep_alloc0@Base 1.9.1
ep_alloc@Base 1.9.1
ep_memdup@Base 1.9.1
ep_sctp_port_to_display@Base 1.12.0~rc1
ep_strbuf_append_printf@Base 1.9.1
ep_strbuf_new@Base 1.9.1
ep_strbuf_printf@Base 1.9.1
@ -453,8 +451,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
ep_strdup_vprintf@Base 1.9.1
ep_strndup@Base 1.9.1
ep_strsplit@Base 1.9.1
ep_tcp_port_to_display@Base 1.12.0~rc1
ep_udp_port_to_display@Base 1.12.0~rc1
epan_cleanup@Base 1.9.1
epan_dissect_cleanup@Base 1.9.1
epan_dissect_fake_protocols@Base 1.9.1
@ -1128,6 +1124,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
scsi_sbc_vals_ext@Base 1.12.0~rc1
scsi_smc_vals_ext@Base 1.12.0~rc1
scsi_ssc_vals_ext@Base 1.12.0~rc1
sctp_port_to_display@Base 1.99.2
se_alloc0@Base 1.9.1
se_alloc@Base 1.9.1
set_actual_length@Base 1.9.1
@ -1211,6 +1208,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
tap_listeners_require_dissection@Base 1.9.1
tap_queue_packet@Base 1.9.1
tcp_dissect_pdus@Base 1.9.1
tcp_port_to_display@Base 1.99.2
tfs_accept_reject@Base 1.9.1
tfs_accepted_not_accepted@Base 1.9.1
tfs_ack_nack@Base 1.9.1
@ -1435,6 +1433,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
uat_remove_record_idx@Base 1.9.1
uat_save@Base 1.9.1
uat_swap@Base 1.9.1
udp_port_to_display@Base 1.99.2
union_of_tap_listener_flags@Base 1.9.1
update_crc10_by_bytes_tvb@Base 1.99.0
uri_str_to_bytes@Base 1.9.1

View File

@ -601,9 +601,9 @@ parse_services_file(const char * path)
* unsigned integer to ascii
*/
static gchar *
ep_utoa(guint port)
wmem_utoa(wmem_allocator_t *allocator, guint port)
{
gchar *bp = (gchar *)ep_alloc(MAXNAMELEN);
gchar *bp = (gchar *)wmem_alloc(allocator, MAXNAMELEN);
/* XXX, guint32_to_str() ? */
guint32_to_str_buf(port, bp, MAXNAMELEN);
@ -2834,52 +2834,52 @@ manually_resolve_cleanup(void)
}
gchar *
ep_udp_port_to_display(guint port)
udp_port_to_display(wmem_allocator_t *allocator, guint port)
{
if (!gbl_resolv_flags.transport_name) {
return ep_utoa(port);
return wmem_utoa(allocator, port);
}
return serv_name_lookup(port, PT_UDP);
} /* ep_udp_port_to_display */
} /* udp_port_to_display */
gchar *
ep_dccp_port_to_display(guint port)
dccp_port_to_display(wmem_allocator_t *allocator, guint port)
{
if (!gbl_resolv_flags.transport_name) {
return ep_utoa(port);
return wmem_utoa(allocator, port);
}
return serv_name_lookup(port, PT_DCCP);
} /* ep_dccp_port_to_display */
} /* dccp_port_to_display */
gchar *
ep_tcp_port_to_display(guint port)
tcp_port_to_display(wmem_allocator_t *allocator, guint port)
{
if (!gbl_resolv_flags.transport_name) {
return ep_utoa(port);
return wmem_utoa(allocator, port);
}
return serv_name_lookup(port, PT_TCP);
} /* ep_tcp_port_to_display */
} /* tcp_port_to_display */
gchar *
ep_sctp_port_to_display(guint port)
sctp_port_to_display(wmem_allocator_t *allocator, guint port)
{
if (!gbl_resolv_flags.transport_name) {
return ep_utoa(port);
return wmem_utoa(allocator, port);
}
return serv_name_lookup(port, PT_SCTP);
} /* ep_sctp_port_to_display */
} /* sctp_port_to_display */
const gchar *
address_to_display(wmem_allocator_t *allocator, const address *addr)

View File

@ -109,28 +109,28 @@ extern gchar *g_pipxnets_path;
/* Functions in addr_resolv.c */
/*
* ep_udp_port_to_display() returns the port name corresponding to that UDP port,
* udp_port_to_display() returns the port name corresponding to that UDP port,
* or the port number as a string if not found.
*/
WS_DLL_PUBLIC gchar *ep_udp_port_to_display(guint port);
WS_DLL_PUBLIC gchar *udp_port_to_display(wmem_allocator_t *allocator, guint port);
/*
* ep_tcp_port_to_display() returns the port name corresponding to that TCP port,
* tcp_port_to_display() returns the port name corresponding to that TCP port,
* or the port number as a string if not found.
*/
WS_DLL_PUBLIC gchar *ep_tcp_port_to_display(guint port);
WS_DLL_PUBLIC gchar *tcp_port_to_display(wmem_allocator_t *allocator, guint port);
/*
* ep_dccp_port_to_display() returns the port name corresponding to that DCCP port,
* dccp_port_to_display() returns the port name corresponding to that DCCP port,
* or the port number as a string if not found.
*/
extern gchar *ep_dccp_port_to_display(guint port);
extern gchar *dccp_port_to_display(wmem_allocator_t *allocator, guint port);
/*
* ep_sctp_port_to_display() returns the port name corresponding to that SCTP port,
* sctp_port_to_display() returns the port name corresponding to that SCTP port,
* or the port number as a string if not found.
*/
WS_DLL_PUBLIC gchar *ep_sctp_port_to_display(guint port);
WS_DLL_PUBLIC gchar *sctp_port_to_display(wmem_allocator_t *allocator, guint port);
/*
* address_to_display takes as input an "address", as defined in address.h */

View File

@ -1946,7 +1946,7 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
switch (pinfo->ptype) {
case PT_SCTP:
if (is_res)
g_strlcpy(pinfo->cinfo->col_buf[col], ep_sctp_port_to_display(port), COL_MAX_LEN);
g_strlcpy(pinfo->cinfo->col_buf[col], sctp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
guint32_to_str_buf(port, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
break;
@ -1954,7 +1954,7 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
case PT_TCP:
guint32_to_str_buf(port, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_res)
g_strlcpy(pinfo->cinfo->col_buf[col], ep_tcp_port_to_display(port), COL_MAX_LEN);
g_strlcpy(pinfo->cinfo->col_buf[col], tcp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
g_strlcpy(pinfo->cinfo->col_buf[col], pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_src)
@ -1966,7 +1966,7 @@ col_set_port(packet_info *pinfo, const int col, const gboolean is_res, const gbo
case PT_UDP:
guint32_to_str_buf(port, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_res)
g_strlcpy(pinfo->cinfo->col_buf[col], ep_udp_port_to_display(port), COL_MAX_LEN);
g_strlcpy(pinfo->cinfo->col_buf[col], udp_port_to_display(pinfo->pool, port), COL_MAX_LEN);
else
g_strlcpy(pinfo->cinfo->col_buf[col], pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
if (is_src)

View File

@ -341,20 +341,20 @@ const char *get_conversation_address(wmem_allocator_t *allocator, address *addr,
}
}
const char *get_conversation_port(guint32 port, port_type ptype, gboolean resolve_names)
const char *get_conversation_port(wmem_allocator_t *allocator, guint32 port, port_type ptype, gboolean resolve_names)
{
if(!resolve_names) ptype = PT_NONE;
switch(ptype) {
case(PT_TCP):
return ep_tcp_port_to_display(port);
return tcp_port_to_display(allocator, port);
case(PT_UDP):
return ep_udp_port_to_display(port);
return udp_port_to_display(allocator, port);
case(PT_SCTP):
return ep_sctp_port_to_display(port);
return sctp_port_to_display(allocator, port);
default:
return ep_strdup_printf("%d", port);
return wmem_strdup_printf(allocator, "%d", port);
}
}

View File

@ -266,7 +266,7 @@ WS_DLL_PUBLIC const char *get_conversation_address(wmem_allocator_t *allocator,
* @param resolve_names Enable name resolution.
* @return An ep_allocated string representing the port.
*/
WS_DLL_PUBLIC const char *get_conversation_port(guint32 port, port_type ptype, gboolean resolve_names);
WS_DLL_PUBLIC const char *get_conversation_port(wmem_allocator_t *allocator, guint32 port, port_type ptype, gboolean resolve_names);
/** Get a display filter for the given conversation and direction.
*

View File

@ -650,14 +650,14 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
proto_tree_add_uint_format_value(dccp_tree, hf_dccp_srcport, tvb,
offset, 2, dccph->sport,
"%s (%u)",
ep_dccp_port_to_display(dccph->sport),
dccp_port_to_display(wmem_packet_scope(), dccph->sport),
dccph->sport);
if (dccp_summary_in_tree) {
proto_item_append_text(dccp_item, ", Src Port: %s (%u)",
ep_dccp_port_to_display(dccph->sport), dccph->sport);
dccp_port_to_display(wmem_packet_scope(), dccph->sport), dccph->sport);
}
col_add_fstr(pinfo->cinfo, COL_INFO,
"%s ", ep_dccp_port_to_display(dccph->sport));
"%s ", dccp_port_to_display(wmem_packet_scope(), dccph->sport));
hidden_item =
proto_tree_add_uint(dccp_tree, hf_dccp_port, tvb, offset, 2,
dccph->sport);
@ -668,14 +668,14 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
proto_tree_add_uint_format_value(dccp_tree, hf_dccp_dstport, tvb,
offset, 2, dccph->dport,
"%s (%u)",
ep_dccp_port_to_display(dccph->dport),
dccp_port_to_display(wmem_packet_scope(), dccph->dport),
dccph->dport);
if (dccp_summary_in_tree) {
proto_item_append_text(dccp_item, ", Dst Port: %s (%u)",
ep_dccp_port_to_display(dccph->dport), dccph->dport);
dccp_port_to_display(wmem_packet_scope(), dccph->dport), dccph->dport);
}
col_append_fstr(pinfo->cinfo, COL_INFO, " > %s",
ep_dccp_port_to_display(dccph->dport));
dccp_port_to_display(wmem_packet_scope(), dccph->dport));
hidden_item =
proto_tree_add_uint(dccp_tree, hf_dccp_port, tvb, offset, 2,
dccph->dport);

View File

@ -2008,11 +2008,11 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
switch (protocol) {
case IP_PROTO_TCP:
wmem_strbuf_append(bitnames, ep_tcp_port_to_display(port_num));
wmem_strbuf_append(bitnames, tcp_port_to_display(wmem_packet_scope(), port_num));
break;
case IP_PROTO_UDP:
wmem_strbuf_append(bitnames, ep_udp_port_to_display(port_num));
wmem_strbuf_append(bitnames, udp_port_to_display(wmem_packet_scope(), port_num));
break;
default:

View File

@ -1888,13 +1888,13 @@ dissect_conn_desc(tvbuff_t *tvb, gint offset, circuit_t *circuit,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset ++;
if (port_item) {
if (ip_proto==LSC_TCP && ep_tcp_port_to_display(port)) {
if (ip_proto==LSC_TCP && tcp_port_to_display(wmem_packet_scope(), port)) {
proto_item_append_text(port_item, " (%s)",
ep_tcp_port_to_display(port));
tcp_port_to_display(wmem_packet_scope(), port));
}
else if (ip_proto==LSC_UDP && ep_udp_port_to_display(port)) {
else if (ip_proto==LSC_UDP && udp_port_to_display(wmem_packet_scope(), port)) {
proto_item_append_text(port_item, " (%s)",
ep_udp_port_to_display(port));
udp_port_to_display(wmem_packet_scope(), port));
}
}
store_lsc_msg_dissector(circuit, ip_proto, port);
@ -1915,13 +1915,13 @@ dissect_conn_desc(tvbuff_t *tvb, gint offset, circuit_t *circuit,
hf_dvbci_lsc_dst_port, tvb, offset, 2, ENC_BIG_ENDIAN);
offset +=2;
if (port_item) {
if (ip_proto==LSC_TCP && ep_tcp_port_to_display(port)) {
if (ip_proto==LSC_TCP && tcp_port_to_display(wmem_packet_scope(), port)) {
proto_item_append_text(port_item, " (%s)",
ep_tcp_port_to_display(port));
tcp_port_to_display(wmem_packet_scope(), port));
}
else if (ip_proto==LSC_UDP && ep_udp_port_to_display(port)) {
else if (ip_proto==LSC_UDP && udp_port_to_display(wmem_packet_scope(), port)) {
proto_item_append_text(port_item, " (%s)",
ep_udp_port_to_display(port));
udp_port_to_display(wmem_packet_scope(), port));
}
}
store_lsc_msg_dissector(circuit, ip_proto, port);

View File

@ -1277,7 +1277,7 @@ ipmi_fmt_channel(gchar *s, guint32 v)
void
ipmi_fmt_udpport(gchar *s, guint32 v)
{
g_snprintf(s, ITEM_LABEL_LENGTH, "%s (%d)", ep_udp_port_to_display(v), v);
g_snprintf(s, ITEM_LABEL_LENGTH, "%s (%d)", udp_port_to_display(wmem_packet_scope(), v), v);
}
void

View File

@ -25,7 +25,7 @@
#include <epan/packet.h>
#include <epan/addr_resolv.h> /* this is for get_hostname and ep_udp_port_to_display */
#include <epan/addr_resolv.h> /* this is for get_hostname and udp_port_to_display */
void proto_register_tpcp(void);
void proto_reg_handoff_tpcp(void);
@ -141,7 +141,7 @@ dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
cport = tvb_get_ntohs(tvb, 6);
proto_tree_add_uint_format_value(tpcp_tree, hf_tpcp_cport, tvb, 6, 2, cport,
"%s", ep_udp_port_to_display(cport));
"%s", udp_port_to_display(wmem_packet_scope(), cport));
proto_tree_add_item(tpcp_tree, hf_tpcp_caddr, tvb, 8, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tpcp_tree, hf_tpcp_saddr, tvb, 12, 4, ENC_BIG_ENDIAN);
@ -155,7 +155,7 @@ dissect_tpcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
col_add_fstr(pinfo->cinfo, COL_INFO,"%s id %d CPort %s CIP %s SIP %s",
val_to_str_const(type, type_vals, "Unknown"),
id,
ep_udp_port_to_display(cport),
udp_port_to_display(wmem_packet_scope(), cport),
tvb_ip_to_str(tvb, 8),
tvb_ip_to_str(tvb, 12));

View File

@ -203,8 +203,8 @@ dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
ep_udp_port_to_display(pinfo->srcport),
ep_udp_port_to_display(pinfo->destport)
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
item = proto_tree_add_item(parent_tree, hf_rx_response, tvb, offset, -1, ENC_NA);
@ -255,8 +255,8 @@ dissect_rx_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
ep_udp_port_to_display(pinfo->srcport),
ep_udp_port_to_display(pinfo->destport)
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
item = proto_tree_add_item(parent_tree, hf_rx_abort, tvb, offset, -1, ENC_NA);
@ -287,8 +287,8 @@ dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
ep_udp_port_to_display(pinfo->srcport),
ep_udp_port_to_display(pinfo->destport)
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, -1, ENC_NA);
@ -327,8 +327,8 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
ep_udp_port_to_display(pinfo->srcport),
ep_udp_port_to_display(pinfo->destport)
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
item = proto_tree_add_item(parent_tree, hf_rx_ack, tvb, offset, -1, ENC_NA);
@ -539,8 +539,8 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *dat
"Destination Port: %s ",
(unsigned long)seq,
(unsigned long)callnumber,
ep_udp_port_to_display(pinfo->srcport),
ep_udp_port_to_display(pinfo->destport)
udp_port_to_display(wmem_packet_scope(), pinfo->srcport),
udp_port_to_display(wmem_packet_scope(), pinfo->destport)
);
break;
case RX_PACKET_TYPE_CHALLENGE:

View File

@ -4501,8 +4501,8 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
if (show_port_numbers)
sctp_item = proto_tree_add_protocol_format(tree, proto_sctp, tvb, 0, -1,
"Stream Control Transmission Protocol, Src Port: %s (%u), Dst Port: %s (%u)",
ep_sctp_port_to_display(source_port), source_port,
ep_sctp_port_to_display(destination_port), destination_port);
sctp_port_to_display(wmem_packet_scope(), source_port), source_port,
sctp_port_to_display(wmem_packet_scope(), destination_port), destination_port);
else
sctp_item = proto_tree_add_item(tree, proto_sctp, tvb, 0, -1, ENC_NA);

View File

@ -4355,8 +4355,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tcph->th_sport = tvb_get_ntohs(tvb, offset);
tcph->th_dport = tvb_get_ntohs(tvb, offset + 2);
src_port_str = ep_tcp_port_to_display(tcph->th_sport);
dst_port_str = ep_tcp_port_to_display(tcph->th_dport);
src_port_str = tcp_port_to_display(wmem_packet_scope(), tcph->th_sport);
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 */

View File

@ -581,8 +581,8 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto)
udph->uh_sport=tvb_get_ntohs(tvb, offset);
udph->uh_dport=tvb_get_ntohs(tvb, offset+2);
src_port_str = ep_udp_port_to_display(udph->uh_sport);
dst_port_str = ep_udp_port_to_display(udph->uh_dport);
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, " "

View File

@ -404,19 +404,19 @@ add_xmcp_port_name (void)
switch(xmcp_service_protocol) {
case IP_PROTO_TCP:
proto_item_append_text(xmcp_it_service_port, " (TCP: %s)",
ep_tcp_port_to_display(xmcp_service_port));
tcp_port_to_display(wmem_packet_scope(), xmcp_service_port));
break;
case IP_PROTO_UDP:
proto_item_append_text(xmcp_it_service_port, " (UDP: %s)",
ep_udp_port_to_display(xmcp_service_port));
udp_port_to_display(wmem_packet_scope(), xmcp_service_port));
break;
case IP_PROTO_DCCP:
proto_item_append_text(xmcp_it_service_port, " (DCCP: %s)",
ep_dccp_port_to_display(xmcp_service_port));
dccp_port_to_display(wmem_packet_scope(), xmcp_service_port));
break;
case IP_PROTO_SCTP:
proto_item_append_text(xmcp_it_service_port, " (SCTP: %s)",
ep_sctp_port_to_display(xmcp_service_port));
sctp_port_to_display(wmem_packet_scope(), xmcp_service_port));
break;
default:
break;

View File

@ -71,7 +71,7 @@ endpoints_draw(void *arg)
for (i=0; (iu->hash.conv_array && i < iu->hash.conv_array->len); i++) {
guint64 tot_frames;
gchar* conversation_str;
gchar *conversation_str, *port_str;
host = &g_array_index(iu->hash.conv_array, hostlist_talker_t, i);
tot_frames = host->rx_frames + host->tx_frames;
@ -80,15 +80,17 @@ endpoints_draw(void *arg)
/* XXX - TODO: make name resolution configurable (through gbl_resolv_flags?) */
conversation_str = (char*)get_conversation_address(NULL, &host->myaddress, TRUE);
if (display_port) {
/* XXX - TODO: make port resolution configurable (through gbl_resolv_flags?) */
port_str = (char*)get_conversation_port(NULL, host->port, host->ptype, TRUE);
printf("%-20s %5s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER
"u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6"
G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u \n",
conversation_str,
/* XXX - TODO: make port resolution configurable (through gbl_resolv_flags?) */
get_conversation_port(host->port, host->ptype, TRUE),
port_str,
host->tx_frames+host->rx_frames, host->tx_bytes+host->rx_bytes,
host->tx_frames, host->tx_bytes,
host->rx_frames, host->rx_bytes);
wmem_free(NULL, port_str);
} else {
printf("%-20s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER
"u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6"

View File

@ -104,11 +104,11 @@ iousers_draw(void *arg)
src_addr = (char*)get_conversation_address(NULL, &iui->src_address, TRUE);
dst_addr = (char*)get_conversation_address(NULL, &iui->dst_address, TRUE);
if (display_ports) {
char *src, *dst;
src = wmem_strconcat(NULL, src_addr,
":", get_conversation_port(iui->src_port, iui->ptype, TRUE), NULL);
dst = wmem_strconcat(NULL, dst_addr,
":", get_conversation_port(iui->dst_port, iui->ptype, TRUE), NULL);
char *src, *dst, *src_port, *dst_port;
src_port = (char*)get_conversation_port(NULL, iui->src_port, iui->ptype, TRUE);
dst_port = (char*)get_conversation_port(NULL, iui->dst_port, iui->ptype, TRUE);
src = wmem_strconcat(NULL, src_addr, ":", src_port, NULL);
dst = wmem_strconcat(NULL, dst_addr, ":", dst_port, NULL);
printf("%-26s <-> %-26s %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER
"u %6" G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u %6"
G_GINT64_MODIFIER "u %9" G_GINT64_MODIFIER "u ",
@ -118,6 +118,8 @@ iousers_draw(void *arg)
iui->tx_frames+iui->rx_frames,
iui->tx_bytes+iui->rx_bytes
);
wmem_free(NULL, src_port);
wmem_free(NULL, dst_port);
wmem_free(NULL, src);
wmem_free(NULL, dst);
} else {

View File

@ -1593,21 +1593,25 @@ draw_ct_table_addresses(conversations_table *ct)
while (iter_valid) {
conv_item_t *conv_item;
char *src_addr, *dst_addr;
char *src_addr, *dst_addr, *src_port, *dst_port;
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, CONV_INDEX_COLUMN, &idx, -1);
conv_item = &g_array_index(ct->hash.conv_array, conv_item_t, idx);
src_addr = (char*)get_conversation_address(NULL, &conv_item->src_address, ct->resolve_names);
dst_addr = (char*)get_conversation_address(NULL, &conv_item->dst_address, ct->resolve_names);
src_port = (char*)get_conversation_port(NULL, conv_item->src_port, conv_item->ptype, ct->resolve_names);
dst_port = (char*)get_conversation_port(NULL, conv_item->dst_port, conv_item->ptype, ct->resolve_names);
gtk_list_store_set (store, &iter,
CONV_COLUMN_SRC_ADDR, src_addr,
CONV_COLUMN_SRC_PORT, get_conversation_port(conv_item->src_port, conv_item->ptype, ct->resolve_names),
CONV_COLUMN_SRC_PORT, src_port,
CONV_COLUMN_DST_ADDR, dst_addr,
CONV_COLUMN_DST_PORT, get_conversation_port(conv_item->dst_port, conv_item->ptype, ct->resolve_names),
CONV_COLUMN_DST_PORT, dst_port,
-1);
iter_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
wmem_free(NULL, src_addr);
wmem_free(NULL, dst_addr);
wmem_free(NULL, src_port);
wmem_free(NULL, dst_port);
}
gtk_tree_view_set_model(GTK_TREE_VIEW(ct->table), GTK_TREE_MODEL(store));
@ -1712,16 +1716,18 @@ draw_ct_table_data(conversations_table *ct)
CONV_COLUMN_BPS_BA, rx_ptr,
-1);
} else {
char *src_addr, *dst_addr;
char *src_addr, *dst_addr, *src_port, *dst_port;
src_addr = (char*)get_conversation_address(NULL, &conv_item->src_address, ct->resolve_names);
dst_addr = (char*)get_conversation_address(NULL, &conv_item->dst_address, ct->resolve_names);
src_port = (char*)get_conversation_port(NULL, conv_item->src_port, conv_item->ptype, ct->resolve_names);
dst_port = (char*)get_conversation_port(NULL, conv_item->dst_port, conv_item->ptype, ct->resolve_names);
/* New row. All entries, including fixed ones */
gtk_list_store_insert_with_values(store, &iter, G_MAXINT,
CONV_COLUMN_SRC_ADDR, src_addr,
CONV_COLUMN_SRC_PORT, get_conversation_port(conv_item->src_port, conv_item->ptype, ct->resolve_names),
CONV_COLUMN_SRC_PORT, src_port,
CONV_COLUMN_DST_ADDR, dst_addr,
CONV_COLUMN_DST_PORT, get_conversation_port(conv_item->dst_port, conv_item->ptype, ct->resolve_names),
CONV_COLUMN_DST_PORT, dst_port,
CONV_COLUMN_PACKETS, conv_item->tx_frames+conv_item->rx_frames,
CONV_COLUMN_BYTES, conv_item->tx_bytes+conv_item->rx_bytes,
CONV_COLUMN_PKT_AB, conv_item->tx_frames,
@ -1736,6 +1742,8 @@ draw_ct_table_data(conversations_table *ct)
-1);
wmem_free(NULL, src_addr);
wmem_free(NULL, dst_addr);
wmem_free(NULL, src_port);
wmem_free(NULL, dst_port);
}
iter_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);

View File

@ -133,8 +133,7 @@ follow_ssl_stream_cb(GtkWidget * w _U_, gpointer data _U_)
int previous_filter_len;
const char * hostname0;
const char * hostname1;
const char * port0;
const char * port1;
char *port0, *port1;
const char * client_hostname;
const char * server_hostname;
const char * client_port;
@ -237,8 +236,8 @@ follow_ssl_stream_cb(GtkWidget * w _U_, gpointer data _U_)
hostname1 = get_hostname(ipaddr);
}
port0 = ep_tcp_port_to_display(stats.port[0]);
port1 = ep_tcp_port_to_display(stats.port[1]);
port0 = (char*)tcp_port_to_display(NULL, stats.port[0]);
port1 = (char*)tcp_port_to_display(NULL, stats.port[1]);
follow_info->is_ipv6 = stats.is_ipv6;
@ -275,6 +274,8 @@ follow_ssl_stream_cb(GtkWidget * w _U_, gpointer data _U_)
follow_stream("Follow SSL Stream", follow_info, both_directions_string,
server_to_client_string, client_to_server_string);
wmem_free(NULL, port0);
wmem_free(NULL, port1);
g_free(both_directions_string);
g_free(server_to_client_string);
g_free(client_to_server_string);

View File

@ -257,8 +257,8 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
follow_info->is_ipv6 = stats.is_ipv6;
port0 = ep_tcp_port_to_display(stats.port[0]);
port1 = ep_tcp_port_to_display(stats.port[1]);
port0 = (char*)tcp_port_to_display(NULL, stats.port[0]);
port1 = (char*)tcp_port_to_display(NULL, stats.port[1]);
/* Host 0 --> Host 1 */
if ((sc.src_port == stats.port[0]) &&
@ -304,6 +304,8 @@ follow_tcp_stream_cb(GtkWidget * w _U_, gpointer data _U_)
/* Free the filter string, as we're done with it. */
g_free(follow_filter);
wmem_free(NULL, port0);
wmem_free(NULL, port1);
g_free(both_directions_string);
g_free(server_to_client_string);
g_free(client_to_server_string);

View File

@ -183,8 +183,8 @@ follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
hostname1 = get_hostname(ipaddr);
}
port0 = ep_udp_port_to_display(stats.port[0]);
port1 = ep_udp_port_to_display(stats.port[1]);
port0 = udp_port_to_display(NULL, stats.port[0]);
port1 = udp_port_to_display(NULL, stats.port[1]);
follow_info->is_ipv6 = stats.is_ipv6;
@ -222,6 +222,8 @@ follow_udp_stream_cb(GtkWidget *w _U_, gpointer data _U_)
follow_stream("Follow UDP Stream", follow_info, both_directions_string,
server_to_client_string, client_to_server_string);
wmem_free(NULL, port0);
wmem_free(NULL, port1);
g_free(both_directions_string);
g_free(server_to_client_string);
g_free(client_to_server_string);

View File

@ -476,19 +476,21 @@ draw_hostlist_table_addresses(hostlist_table *hl)
while (iter_valid) {
hostlist_talker_t *host;
char* addr_str;
char *addr_str, *port_str;
gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, ENDP_INDEX_COLUMN, &idx, -1);
host = &g_array_index(hl->hash.conv_array, hostlist_talker_t, idx);
addr_str = (char*)get_conversation_address(NULL, &host->myaddress, hl->resolve_names);
port_str = (char*)get_conversation_port(NULL, host->port, host->ptype, hl->resolve_names);
gtk_list_store_set (store, &iter,
ENDP_COLUMN_ADDR, addr_str,
ENDP_COLUMN_PORT, get_conversation_port(host->port, host->ptype, hl->resolve_names),
ENDP_COLUMN_PORT, port_str,
-1);
iter_valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
wmem_free(NULL, addr_str);
wmem_free(NULL, port_str);
}
gtk_tree_view_set_model(GTK_TREE_VIEW(hl->table), GTK_TREE_MODEL(store));
g_object_unref(store);
@ -554,7 +556,7 @@ draw_hostlist_table_data(hostlist_table *hl)
}
host->modified = FALSE;
if (!iter_valid) {
char* addr_str;
char *addr_str, *port_str;
#ifdef HAVE_GEOIP
char *geoip[ENDP_NUM_GEOIP_COLUMNS];
guint j;
@ -598,9 +600,10 @@ draw_hostlist_table_data(hostlist_table *hl)
#endif /* HAVE_GEOIP */
addr_str = (char*)get_conversation_address(NULL, &host->myaddress, hl->resolve_names);
port_str = (char*)get_conversation_port(NULL, host->port, host->ptype, hl->resolve_names);
gtk_list_store_insert_with_values( store, &iter, G_MAXINT,
ENDP_COLUMN_ADDR, addr_str,
ENDP_COLUMN_PORT, get_conversation_port(host->port, host->ptype, hl->resolve_names),
ENDP_COLUMN_PORT, port_str,
ENDP_COLUMN_PACKETS, host->tx_frames+host->rx_frames,
ENDP_COLUMN_BYTES, host->tx_bytes+host->rx_bytes,
ENDP_COLUMN_PKT_AB, host->tx_frames,
@ -625,6 +628,7 @@ draw_hostlist_table_data(hostlist_table *hl)
ENDP_INDEX_COLUMN, idx,
-1);
wmem_free(NULL, addr_str);
wmem_free(NULL, port_str);
#ifdef HAVE_GEOIP
for (j = 0; j < ENDP_NUM_GEOIP_COLUMNS; j++)
g_free(geoip[j]);

View File

@ -339,7 +339,7 @@ public:
conv_item_t *conv_item = data(ci_col_, Qt::UserRole).value<conv_item_t *>();
bool ok;
quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
char *src_addr, *dst_addr;
char *src_addr, *dst_addr, *src_port, *dst_port;
if (!conv_item) {
return;
@ -352,12 +352,16 @@ public:
src_addr = (char*)get_conversation_address(NULL, &conv_item->src_address, resolve_names);
dst_addr = (char*)get_conversation_address(NULL, &conv_item->dst_address, resolve_names);
src_port = (char*)get_conversation_port(NULL, conv_item->src_port, conv_item->ptype, resolve_names);
dst_port = (char*)get_conversation_port(NULL, conv_item->dst_port, conv_item->ptype, resolve_names);
setText(CONV_COLUMN_SRC_ADDR, src_addr);
setText(CONV_COLUMN_SRC_PORT, get_conversation_port(conv_item->src_port, conv_item->ptype, resolve_names));
setText(CONV_COLUMN_SRC_PORT, src_port);
setText(CONV_COLUMN_DST_ADDR, dst_addr);
setText(CONV_COLUMN_DST_PORT, get_conversation_port(conv_item->dst_port, conv_item->ptype, resolve_names));
setText(CONV_COLUMN_DST_PORT, dst_port);
wmem_free(NULL, src_addr);
wmem_free(NULL, dst_addr);
wmem_free(NULL, src_port);
wmem_free(NULL, dst_port);
double duration = nstime_to_sec(&conv_item->stop_time) - nstime_to_sec(&conv_item->start_time);
QString col_str, bps_ab = bps_na_, bps_ba = bps_na_;
@ -410,7 +414,10 @@ public:
}
case CONV_COLUMN_SRC_PORT:
if (resolve_names) {
return get_conversation_port(conv_item->src_port, conv_item->ptype, resolve_names);
char* port_str = (char*)get_conversation_port(NULL, conv_item->src_port, conv_item->ptype, resolve_names);
QString q_port_str(port_str);
wmem_free(NULL, port_str);
return q_port_str;
} else {
return quint32(conv_item->src_port);
}
@ -423,7 +430,10 @@ public:
}
case CONV_COLUMN_DST_PORT:
if (resolve_names) {
return get_conversation_port(conv_item->dst_port, conv_item->ptype, resolve_names);
char* port_str = (char*)get_conversation_port(NULL, conv_item->dst_port, conv_item->ptype, resolve_names);
QString q_port_str(port_str);
wmem_free(NULL, port_str);
return q_port_str;
} else {
return quint32(conv_item->dst_port);
}

View File

@ -228,7 +228,7 @@ public:
hostlist_talker_t *endp_item = data(ei_col_, Qt::UserRole).value<hostlist_talker_t *>();
bool ok;
quint64 cur_packets = data(pkts_col_, Qt::UserRole).toULongLong(&ok);
char* addr_str;
char *addr_str, *port_str;
if (!endp_item) {
return;
@ -240,9 +240,11 @@ public:
}
addr_str = (char*)get_conversation_address(NULL, &endp_item->myaddress, resolve_names);
port_str = (char*)get_conversation_port(NULL, endp_item->port, endp_item->ptype, resolve_names);
setText(ENDP_COLUMN_ADDR, addr_str);
setText(ENDP_COLUMN_PORT, get_conversation_port(endp_item->port, endp_item->ptype, resolve_names));
setText(ENDP_COLUMN_PORT, port_str);
wmem_free(NULL, addr_str);
wmem_free(NULL, port_str);
QString col_str;
@ -301,7 +303,10 @@ public:
}
case ENDP_COLUMN_PORT:
if (resolve_names) {
return get_conversation_port(endp_item->port, endp_item->ptype, resolve_names);
char* port_str = (char*)get_conversation_port(NULL, endp_item->port, endp_item->ptype, resolve_names);
QString q_port_str(port_str);
wmem_free(NULL, port_str);
return q_port_str;
} else {
return quint32(endp_item->port);
}

View File

@ -1088,16 +1088,16 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_stream_index)
switch (follow_type_)
{
case FOLLOW_TCP:
port0 = ep_tcp_port_to_display(stats.port[0]);
port1 = ep_tcp_port_to_display(stats.port[1]);
port0 = tcp_port_to_display(NULL, stats.port[0]);
port1 = tcp_port_to_display(NULL, stats.port[1]);
break;
case FOLLOW_UDP:
port0 = ep_udp_port_to_display(stats.port[0]);
port1 = ep_udp_port_to_display(stats.port[1]);
port0 = udp_port_to_display(NULL, stats.port[0]);
port1 = udp_port_to_display(NULL, stats.port[1]);
break;
case FOLLOW_SSL:
port0 = ep_tcp_port_to_display(stats.port[0]);
port1 = ep_tcp_port_to_display(stats.port[1]);
port0 = tcp_port_to_display(NULL, stats.port[0]);
port1 = tcp_port_to_display(NULL, stats.port[1]);
break;
}
@ -1195,6 +1195,9 @@ bool FollowStreamDialog::follow(QString previous_filter, bool use_stream_index)
}
}
wmem_free(NULL, port0);
wmem_free(NULL, port1);
/* Both Stream Directions */
switch (follow_type_)
{