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>
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
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
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
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
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
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
* 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);
}
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)
/* 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 */
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;
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)
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)
}
}
-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);
}
}
* @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.
*
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);
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);
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:
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);
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);
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
#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);
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);
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));
"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);
"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);
"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);
"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);
"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:
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);
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 */
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, " "
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;
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;
/* 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"
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 ",
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 {
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));
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,
-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);
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;
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;
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);
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]) &&
/* 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);
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;
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);
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);
}
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;
#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,
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]);
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;
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_;
}
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);
}
}
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);
}
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;
}
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;
}
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);
}
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;
}
}
}
+ wmem_free(NULL, port0);
+ wmem_free(NULL, port1);
+
/* Both Stream Directions */
switch (follow_type_)
{