Sequence (flow) analysis: fill timestamp when creating item.

Change-Id: Ie1b82d016b632162a91e2ed54a964662bc25e9d5
Reviewed-on: https://code.wireshark.org/review/23620
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Jakub Zawadzki 2017-09-19 18:51:36 +02:00 committed by Michael Mann
parent 4930772178
commit 0d869dae1e
4 changed files with 9 additions and 22 deletions

View File

@ -110,6 +110,7 @@ void sequence_analysis_table_iterate_tables(wmem_foreach_func func, gpointer use
seq_analysis_item_t* sequence_analysis_create_sai_with_addresses(packet_info *pinfo, seq_analysis_info_t *sainfo)
{
seq_analysis_item_t *sai = NULL;
char time_str[COL_MAX_LEN];
if (sainfo->any_addr) {
if (pinfo->net_src.type!=AT_NONE && pinfo->net_dst.type!=AT_NONE) {
@ -126,6 +127,12 @@ seq_analysis_item_t* sequence_analysis_create_sai_with_addresses(packet_info *pi
}
}
if (sai) {
/* Fill in the timestamps */
set_fd_time(pinfo->epan, pinfo->fd, time_str);
sai->time_str = g_strdup(time_str);
}
return sai;
}

View File

@ -128,7 +128,7 @@ WS_DLL_PUBLIC tap_packet_cb sequence_analysis_get_packet_func(register_analysis_
WS_DLL_PUBLIC guint sequence_analysis_get_tap_flags(register_analysis_t* analysis);
/** Helper function to create a sequence analysis item with address fields populated
* Allocate a seq_analysis_item_t to return and populate the src_addr and dst_addr
* Allocate a seq_analysis_item_t to return and populate the time_str and src_addr and dst_addr
* members based on seq_analysis_info_t any_addr member
*
* @param pinfo packet info

View File

@ -1011,7 +1011,6 @@ sharkd_session_free_tap_expert_cb(void *tapdata)
* (m) t - frame time string
* (m) n - array of two numbers with source node index and destination node index
* (m) pn - array of two numbers with source and destination port
* (o) p - protocol
* (o) c - comment
*/
static void
@ -1021,7 +1020,6 @@ sharkd_session_process_tap_flow_cb(void *tapdata)
GList *flow_list;
guint i;
char time_str[COL_MAX_LEN];
const char *sepa = "";
sequence_analysis_get_nodes(graph_analysis);
@ -1048,7 +1046,6 @@ sharkd_session_process_tap_flow_cb(void *tapdata)
while (flow_list)
{
seq_analysis_item_t *sai = (seq_analysis_item_t *) flow_list->data;
frame_data *fdata;
flow_list = g_list_next(flow_list);
@ -1057,12 +1054,7 @@ sharkd_session_process_tap_flow_cb(void *tapdata)
printf("%s{", sepa);
fdata = frame_data_sequence_find(cfile.frames, sai->frame_number);
/* XXX, sequence_analysis_item_set_timestamp not called, do it manually */
set_fd_time(cfile.epan, fdata, time_str);
printf("\"t\":\"%s\"", time_str);
printf("\"t\":\"%s\"", sai->time_str);
printf(",\"n\":[%u,%u]", sai->src_node, sai->dst_node);
printf(",\"pn\":[%u,%u]", sai->port_src, sai->port_dst);

View File

@ -44,16 +44,6 @@
#define CONV_TIME_HEADER_LENGTH 16
#define TIME_HEADER_LENGTH 10
static void sequence_analysis_item_set_timestamp(gpointer data, gpointer user_data)
{
gchar time_str[COL_MAX_LEN];
seq_analysis_item_t *seq_item = (seq_analysis_item_t *)data;
const capture_file *cf = (const capture_file *)user_data;
frame_data *fd = frame_data_sequence_find(cf->frames, seq_item->frame_number);
set_fd_time(cf->epan, fd, time_str);
seq_item->time_str = g_strdup(time_str);
}
void
sequence_analysis_list_get(capture_file *cf, seq_analysis_info_t *sainfo)
{
@ -73,8 +63,6 @@ sequence_analysis_list_get(capture_file *cf, seq_analysis_info_t *sainfo)
remove_tap_listener(sainfo);
/* SEQ_ANALYSIS_DEBUG("%d items", g_queue_get_length(sainfo->items)); */
/* Fill in the timestamps */
g_queue_foreach(sainfo->items, sequence_analysis_item_set_timestamp, cf);
}
/****************************************************************************/