File: | epan/frame_data.c |
Warning: | line 50, column 19 Value stored to 'prev_abs_ts' during its initialization is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* frame_data.c |
2 | * Routines for packet disassembly |
3 | * |
4 | * Wireshark - Network traffic analyzer |
5 | * By Gerald Combs <[email protected]> |
6 | * Copyright 1998 Gerald Combs |
7 | * |
8 | * |
9 | * SPDX-License-Identifier: GPL-2.0-or-later |
10 | */ |
11 | |
12 | #include "config.h" |
13 | |
14 | #include <glib.h> |
15 | |
16 | #include <epan/epan.h> |
17 | #include <epan/frame_data.h> |
18 | #include <epan/column-utils.h> |
19 | #include <epan/timestamp.h> |
20 | #include <wiretap/wtap.h> |
21 | #include <wsutil/ws_assert.h> |
22 | |
23 | #define COMPARE_FRAME_NUM()((fdata1->num < fdata2->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0) ((fdata1->num < fdata2->num) ? -1 : \ |
24 | (fdata1->num > fdata2->num) ? 1 : \ |
25 | 0) |
26 | |
27 | #define COMPARE_NUM(f)((fdata1->f < fdata2->f) ? -1 : (fdata1->f > fdata2 ->f) ? 1 : ((fdata1->num < fdata2->num) ? -1 : (fdata1 ->num > fdata2->num) ? 1 : 0)) ((fdata1->f < fdata2->f) ? -1 : \ |
28 | (fdata1->f > fdata2->f) ? 1 : \ |
29 | COMPARE_FRAME_NUM()((fdata1->num < fdata2->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0)) |
30 | |
31 | /* Compare time stamps. |
32 | A packet whose time is a reference time is considered to have |
33 | a lower time stamp than any frame with a non-reference time; |
34 | if both packets' times are reference times, we compare the |
35 | times of the packets. */ |
36 | #define COMPARE_TS_REAL(time1, time2)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (time1).secs < (time2).secs) ? -1 : ((time1).secs > (time2 ).secs) ? 1 : ((time1).nsecs < (time2).nsecs) ? -1 : ((time1 ).nsecs > (time2).nsecs) ? 1 : ((fdata1->num < fdata2 ->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0 )) \ |
37 | ((fdata1->ref_time && !fdata2->ref_time) ? -1 : \ |
38 | (!fdata1->ref_time && fdata2->ref_time) ? 1 : \ |
39 | ((time1).secs < (time2).secs) ? -1 : \ |
40 | ((time1).secs > (time2).secs) ? 1 : \ |
41 | ((time1).nsecs < (time2).nsecs) ? -1 :\ |
42 | ((time1).nsecs > (time2).nsecs) ? 1 : \ |
43 | COMPARE_FRAME_NUM()((fdata1->num < fdata2->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0)) |
44 | |
45 | #define COMPARE_TS(ts)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (fdata1->ts).secs < (fdata2->ts).secs) ? -1 : ((fdata1 ->ts).secs > (fdata2->ts).secs) ? 1 : ((fdata1->ts ).nsecs < (fdata2->ts).nsecs) ? -1 : ((fdata1->ts).nsecs > (fdata2->ts).nsecs) ? 1 : ((fdata1->num < fdata2 ->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0 )) COMPARE_TS_REAL(fdata1->ts, fdata2->ts)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (fdata1->ts).secs < (fdata2->ts).secs) ? -1 : ((fdata1 ->ts).secs > (fdata2->ts).secs) ? 1 : ((fdata1->ts ).nsecs < (fdata2->ts).nsecs) ? -1 : ((fdata1->ts).nsecs > (fdata2->ts).nsecs) ? 1 : ((fdata1->num < fdata2 ->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0 )) |
46 | |
47 | static bool_Bool |
48 | frame_delta_abs_time(const struct epan_session *epan, const frame_data *fdata, uint32_t prev_num, nstime_t *delta) |
49 | { |
50 | const nstime_t *prev_abs_ts = (prev_num) ? epan_get_frame_ts(epan, prev_num) : NULL((void*)0); |
Value stored to 'prev_abs_ts' during its initialization is never read | |
51 | |
52 | if (!fdata->has_ts) { |
53 | /* We don't have a time stamp for this packet. Set the delta time |
54 | to zero, and return false. */ |
55 | nstime_set_zero(delta); |
56 | return false0; |
57 | } |
58 | |
59 | if (prev_num == 0) { |
60 | /* The previous frame doesn't exist. Set the delta time to zero, |
61 | and return false. */ |
62 | nstime_set_zero(delta); |
63 | return false0; |
64 | } |
65 | |
66 | /* Ge the previous frame's time stamp, if it has one. */ |
67 | prev_abs_ts = epan_get_frame_ts(epan, prev_num); |
68 | if (prev_abs_ts == NULL((void*)0)) { |
69 | /* The previous frame doesn't have a time stamp. Set the delta |
70 | time to zero, and return false. */ |
71 | nstime_set_zero(delta); |
72 | return false0; |
73 | } |
74 | |
75 | /* This frame has a time stamp, the previous frame exists and has a |
76 | time stamp; compute the delta between this frame's time stamp and |
77 | the previous frame's time stamp, and return true. */ |
78 | nstime_delta(delta, &fdata->abs_ts, prev_abs_ts); |
79 | return true1; |
80 | } |
81 | |
82 | static int |
83 | frame_compare_time_deltas(const frame_data *fdata1, bool_Bool have_ts1, const nstime_t *ts1, |
84 | const frame_data *fdata2, bool_Bool have_ts2, const nstime_t *ts2) |
85 | { |
86 | if (!have_ts1) { |
87 | if (!have_ts2) { |
88 | /* We don't have either delta time; sort them the same. */ |
89 | return 0; |
90 | } |
91 | |
92 | /* |
93 | * We don't have ts1 but do have ts2; treat the first |
94 | * as sorting lower than the second. |
95 | */ |
96 | return -1; |
97 | } |
98 | if (!have_ts2) { |
99 | /* |
100 | * We have ts1 but don't have ts2; treat the first as |
101 | * sorting greater than the second. |
102 | */ |
103 | return 1; |
104 | } |
105 | |
106 | /* |
107 | * We have ts1 and ts2; compare them. |
108 | */ |
109 | return COMPARE_TS_REAL(*ts1, *ts2)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (*ts1).secs < (*ts2).secs) ? -1 : ((*ts1).secs > (*ts2) .secs) ? 1 : ((*ts1).nsecs < (*ts2).nsecs) ? -1 : ((*ts1). nsecs > (*ts2).nsecs) ? 1 : ((fdata1->num < fdata2-> num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0)); |
110 | } |
111 | |
112 | bool_Bool |
113 | frame_rel_first_frame_time(const struct epan_session *epan, |
114 | const frame_data *fdata, nstime_t *delta) |
115 | { |
116 | /* |
117 | * Time relative to the first frame in the capture. |
118 | */ |
119 | return frame_delta_abs_time(epan, fdata, 1, delta); |
120 | } |
121 | |
122 | bool_Bool |
123 | frame_rel_time(const struct epan_session *epan, const frame_data *fdata, |
124 | nstime_t *delta) |
125 | { |
126 | /* |
127 | * Time relative to the previous reference frame or, if there is no |
128 | * previous reference frame, the first frame in the capture. |
129 | */ |
130 | return frame_delta_abs_time(epan, fdata, |
131 | fdata->frame_ref_num == 0 ? 1 : fdata->frame_ref_num, |
132 | delta); |
133 | } |
134 | |
135 | static int |
136 | frame_compare_rel_times(const struct epan_session *epan, |
137 | const frame_data *fdata1, const frame_data *fdata2) |
138 | { |
139 | nstime_t del_rel_ts1, del_rel_ts2; |
140 | bool_Bool have_del_rel_ts1, have_del_rel_ts2; |
141 | |
142 | have_del_rel_ts1 = frame_rel_time(epan, fdata1, &del_rel_ts1); |
143 | have_del_rel_ts2 = frame_rel_time(epan, fdata2, &del_rel_ts2); |
144 | |
145 | return frame_compare_time_deltas(fdata1, have_del_rel_ts1, &del_rel_ts1, |
146 | fdata2, have_del_rel_ts2, &del_rel_ts2); |
147 | } |
148 | |
149 | bool_Bool |
150 | frame_delta_time_prev_captured(const struct epan_session *epan, |
151 | const frame_data *fdata, nstime_t *delta) |
152 | { |
153 | return frame_delta_abs_time(epan, fdata, fdata->num - 1, delta); |
154 | } |
155 | |
156 | static int |
157 | frame_compare_delta_times_prev_captured(const struct epan_session *epan, |
158 | const frame_data *fdata1, |
159 | const frame_data *fdata2) |
160 | { |
161 | nstime_t del_cap_ts1, del_cap_ts2; |
162 | bool_Bool have_del_cap_ts1, have_del_cap_ts2; |
163 | |
164 | have_del_cap_ts1 = frame_delta_time_prev_captured(epan, fdata1, &del_cap_ts1); |
165 | have_del_cap_ts2 = frame_delta_time_prev_captured(epan, fdata2, &del_cap_ts2); |
166 | |
167 | return frame_compare_time_deltas(fdata1, have_del_cap_ts1, &del_cap_ts1, |
168 | fdata2, have_del_cap_ts2, &del_cap_ts2); |
169 | } |
170 | |
171 | bool_Bool |
172 | frame_delta_time_prev_displayed(const struct epan_session *epan, |
173 | const frame_data *fdata, nstime_t *delta) |
174 | { |
175 | return frame_delta_abs_time(epan, fdata, fdata->prev_dis_num, delta); |
176 | } |
177 | |
178 | static int |
179 | frame_compare_delta_times_prev_displayed(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2) |
180 | { |
181 | nstime_t del_dis_ts1, del_dis_ts2; |
182 | bool_Bool have_del_dis_ts1, have_del_dis_ts2; |
183 | |
184 | have_del_dis_ts1 = frame_delta_time_prev_displayed(epan, fdata1, &del_dis_ts1); |
185 | have_del_dis_ts2 = frame_delta_time_prev_displayed(epan, fdata2, &del_dis_ts2); |
186 | |
187 | return frame_compare_time_deltas(fdata1, have_del_dis_ts1, &del_dis_ts1, |
188 | fdata2, have_del_dis_ts2, &del_dis_ts2); |
189 | } |
190 | |
191 | static int |
192 | frame_data_aggregation_values_compare(GSList* list1, GSList* list2) { |
193 | GHashTable* set = g_hash_table_new(g_str_hash, g_str_equal); |
194 | for (GSList* node = list1; node; node = node->next) |
195 | g_hash_table_add(set, node->data); |
196 | |
197 | for (GSList* node = list2; node; node = node->next) { |
198 | if (g_hash_table_contains(set, node->data)) { |
199 | g_hash_table_destroy(set); |
200 | return 0; |
201 | } |
202 | } |
203 | g_hash_table_destroy(set); |
204 | return 1; |
205 | } |
206 | |
207 | void |
208 | free_aggregation_key(gpointer data) { |
209 | aggregation_key* key = (aggregation_key*)data; |
210 | if (!key) return; |
211 | |
212 | if (key->field) { |
213 | g_free(key->field); |
214 | key->field = NULL((void*)0); |
215 | } |
216 | |
217 | if (key->values) { |
218 | g_slist_free_full(key->values, g_free); |
219 | key->values = NULL((void*)0); |
220 | } |
221 | |
222 | g_free(key); |
223 | } |
224 | |
225 | int |
226 | frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field) |
227 | { |
228 | switch (field) { |
229 | case COL_NUMBER: |
230 | return COMPARE_FRAME_NUM()((fdata1->num < fdata2->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0); |
231 | |
232 | case COL_NUMBER_DIS: |
233 | return COMPARE_NUM(dis_num)((fdata1->dis_num < fdata2->dis_num) ? -1 : (fdata1-> dis_num > fdata2->dis_num) ? 1 : ((fdata1->num < fdata2 ->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0 )); |
234 | |
235 | case COL_CLS_TIME: |
236 | switch (timestamp_get_type()) { |
237 | case TS_ABSOLUTE: |
238 | case TS_ABSOLUTE_WITH_YMD: |
239 | case TS_ABSOLUTE_WITH_YDOY: |
240 | case TS_UTC: |
241 | case TS_UTC_WITH_YMD: |
242 | case TS_UTC_WITH_YDOY: |
243 | case TS_EPOCH: |
244 | return COMPARE_TS(abs_ts)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (fdata1->abs_ts).secs < (fdata2->abs_ts).secs) ? -1 : ((fdata1->abs_ts).secs > (fdata2->abs_ts).secs) ? 1 : ((fdata1->abs_ts).nsecs < (fdata2->abs_ts).nsecs) ? -1 : ((fdata1->abs_ts).nsecs > (fdata2->abs_ts).nsecs ) ? 1 : ((fdata1->num < fdata2->num) ? -1 : (fdata1-> num > fdata2->num) ? 1 : 0)); |
245 | |
246 | case TS_RELATIVE: |
247 | return frame_compare_rel_times(epan, fdata1, fdata2); |
248 | |
249 | case TS_DELTA: |
250 | return frame_compare_delta_times_prev_captured(epan, fdata1, fdata2); |
251 | |
252 | case TS_DELTA_DIS: |
253 | return frame_compare_delta_times_prev_displayed(epan, fdata1, fdata2); |
254 | |
255 | case TS_NOT_SET: |
256 | return 0; |
257 | } |
258 | return 0; |
259 | |
260 | case COL_ABS_TIME: |
261 | case COL_ABS_YMD_TIME: |
262 | case COL_ABS_YDOY_TIME: |
263 | case COL_UTC_TIME: |
264 | case COL_UTC_YMD_TIME: |
265 | case COL_UTC_YDOY_TIME: |
266 | return COMPARE_TS(abs_ts)((fdata1->ref_time && !fdata2->ref_time) ? -1 : (!fdata1->ref_time && fdata2->ref_time) ? 1 : ( (fdata1->abs_ts).secs < (fdata2->abs_ts).secs) ? -1 : ((fdata1->abs_ts).secs > (fdata2->abs_ts).secs) ? 1 : ((fdata1->abs_ts).nsecs < (fdata2->abs_ts).nsecs) ? -1 : ((fdata1->abs_ts).nsecs > (fdata2->abs_ts).nsecs ) ? 1 : ((fdata1->num < fdata2->num) ? -1 : (fdata1-> num > fdata2->num) ? 1 : 0)); |
267 | |
268 | case COL_REL_TIME: |
269 | return frame_compare_rel_times(epan, fdata1, fdata2); |
270 | |
271 | case COL_DELTA_TIME: |
272 | return frame_compare_delta_times_prev_captured(epan, fdata1, fdata2); |
273 | |
274 | case COL_DELTA_TIME_DIS: |
275 | return frame_compare_delta_times_prev_displayed(epan, fdata1, fdata2); |
276 | |
277 | case COL_PACKET_LENGTH: |
278 | return COMPARE_NUM(pkt_len)((fdata1->pkt_len < fdata2->pkt_len) ? -1 : (fdata1-> pkt_len > fdata2->pkt_len) ? 1 : ((fdata1->num < fdata2 ->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0 )); |
279 | |
280 | case COL_CUMULATIVE_BYTES: |
281 | return COMPARE_NUM(cum_bytes)((fdata1->cum_bytes < fdata2->cum_bytes) ? -1 : (fdata1 ->cum_bytes > fdata2->cum_bytes) ? 1 : ((fdata1-> num < fdata2->num) ? -1 : (fdata1->num > fdata2-> num) ? 1 : 0)); |
282 | |
283 | } |
284 | g_return_val_if_reached(0)do { g_log (((gchar*) 0), G_LOG_LEVEL_CRITICAL, "file %s: line %d (%s): should not be reached" , "epan/frame_data.c", 284, ((const char*) (__func__))); return (0); } while (0); |
285 | } |
286 | |
287 | int |
288 | frame_data_aggregation_compare(const frame_data* fdata1, const frame_data* fdata2) |
289 | { |
290 | unsigned length = g_slist_length(fdata1->aggregation_keys); |
291 | if (length != g_slist_length(fdata2->aggregation_keys)) { |
292 | return 1; |
293 | } |
294 | unsigned i = 0; |
295 | while (i < length) { |
296 | const aggregation_key* key1 = (aggregation_key*)g_slist_nth_data(fdata1->aggregation_keys, i); |
297 | const aggregation_key* key2 = (aggregation_key*)g_slist_nth_data(fdata2->aggregation_keys, i); |
298 | if (g_strcmp0(key1->field, key2->field) != 0 || |
299 | frame_data_aggregation_values_compare(key1->values, key2->values) == 1) { |
300 | return 1; |
301 | } |
302 | i++; |
303 | } |
304 | return 0; |
305 | } |
306 | |
307 | void |
308 | frame_data_init(frame_data *fdata, uint32_t num, const wtap_rec *rec, |
309 | int64_t offset, uint32_t cum_bytes) |
310 | { |
311 | fdata->pfd = NULL((void*)0); |
312 | fdata->num = num; |
313 | fdata->dis_num = num; |
314 | fdata->file_off = offset; |
315 | fdata->passed_dfilter = 1; |
316 | fdata->dependent_of_displayed = 0; |
317 | fdata->dependent_frames = NULL((void*)0); |
318 | fdata->encoding = PACKET_CHAR_ENC_CHAR_ASCII; |
319 | fdata->visited = 0; |
320 | fdata->marked = 0; |
321 | fdata->ref_time = 0; |
322 | fdata->ignored = 0; |
323 | fdata->has_ts = (rec->presence_flags & WTAP_HAS_TS0x00000001) ? 1 : 0; |
324 | fdata->tcp_snd_manual_analysis = 0; |
325 | switch (rec->rec_type) { |
326 | |
327 | case REC_TYPE_PACKET0: |
328 | fdata->pkt_len = rec->rec_header.packet_header.len; |
329 | fdata->cum_bytes = cum_bytes + rec->rec_header.packet_header.len; |
330 | fdata->cap_len = rec->rec_header.packet_header.caplen; |
331 | break; |
332 | |
333 | case REC_TYPE_FT_SPECIFIC_EVENT1: |
334 | case REC_TYPE_FT_SPECIFIC_REPORT2: |
335 | /* |
336 | * XXX |
337 | */ |
338 | fdata->pkt_len = rec->rec_header.ft_specific_header.record_len; |
339 | fdata->cum_bytes = cum_bytes + rec->rec_header.ft_specific_header.record_len; |
340 | fdata->cap_len = rec->rec_header.ft_specific_header.record_len; |
341 | break; |
342 | |
343 | case REC_TYPE_SYSCALL3: |
344 | /* |
345 | * XXX - is cum_bytes supposed to count non-packet bytes? |
346 | */ |
347 | fdata->pkt_len = rec->rec_header.syscall_header.event_data_len; |
348 | fdata->cum_bytes = cum_bytes + rec->rec_header.syscall_header.event_data_len; |
349 | fdata->cap_len = rec->rec_header.syscall_header.event_data_len; |
350 | break; |
351 | |
352 | case REC_TYPE_SYSTEMD_JOURNAL_EXPORT4: |
353 | /* |
354 | * XXX - is cum_bytes supposed to count non-packet bytes? |
355 | */ |
356 | fdata->pkt_len = rec->rec_header.systemd_journal_export_header.record_len; |
357 | fdata->cum_bytes = cum_bytes + rec->rec_header.systemd_journal_export_header.record_len; |
358 | fdata->cap_len = rec->rec_header.systemd_journal_export_header.record_len; |
359 | break; |
360 | |
361 | case REC_TYPE_CUSTOM_BLOCK5: |
362 | /* |
363 | * XXX - is cum_bytes supposed to count non-packet bytes? |
364 | */ |
365 | fdata->pkt_len = rec->rec_header.custom_block_header.length; |
366 | fdata->cum_bytes = cum_bytes + rec->rec_header.custom_block_header.length; |
367 | fdata->cap_len = rec->rec_header.custom_block_header.length; |
368 | break; |
369 | |
370 | } |
371 | |
372 | /* To save some memory, we coerce it into 4 bits */ |
373 | ws_assert(rec->tsprec <= 0xF)do { if ((1) && !(rec->tsprec <= 0xF)) ws_log_fatal_full ("", LOG_LEVEL_ERROR, "epan/frame_data.c", 373, __func__, "assertion failed: %s" , "rec->tsprec <= 0xF"); } while (0); |
374 | fdata->tsprec = (unsigned int)rec->tsprec; |
375 | fdata->abs_ts = rec->ts; |
376 | fdata->has_modified_block = 0; |
377 | fdata->need_colorize = 0; |
378 | fdata->color_filter = NULL((void*)0); |
379 | fdata->shift_offset.secs = 0; |
380 | fdata->shift_offset.nsecs = 0; |
381 | fdata->frame_ref_num = 0; |
382 | fdata->prev_dis_num = 0; |
383 | fdata->aggregation_keys = NULL((void*)0); |
384 | } |
385 | |
386 | void |
387 | frame_data_set_before_dissect(frame_data *fdata, |
388 | nstime_t *elapsed_time, |
389 | const frame_data **frame_ref, |
390 | const frame_data *prev_dis) |
391 | { |
392 | nstime_t rel_ts; |
393 | |
394 | /* If this frame doesn't have a time stamp, don't set it as the |
395 | * reference frame used for calculating time deltas, set elapsed |
396 | * time, etc. We also won't need to calculate the delta of this |
397 | * frame's timestamp to any other frame. |
398 | */ |
399 | if (!fdata->has_ts) { |
400 | /* If it was marked as a reference time frame anyway (should we |
401 | * allow that?), clear the existing reference frame so that the |
402 | * next frame with a time stamp will become the reference frame. |
403 | */ |
404 | if(fdata->ref_time) { |
405 | *frame_ref = NULL((void*)0); |
406 | } |
407 | return; |
408 | } |
409 | |
410 | /* Don't have the reference frame, set to current */ |
411 | if (*frame_ref == NULL((void*)0)) |
412 | *frame_ref = fdata; |
413 | |
414 | /* if this frames is marked as a reference time frame, |
415 | set reference frame this frame */ |
416 | if(fdata->ref_time) |
417 | *frame_ref = fdata; |
418 | |
419 | /* Get the time elapsed between the first packet and this packet. */ |
420 | nstime_delta(&rel_ts, &fdata->abs_ts, &(*frame_ref)->abs_ts); |
421 | |
422 | /* If it's greater than the current elapsed time, set the elapsed time |
423 | to it (we check for "greater than" so as not to be confused by |
424 | time moving backwards). */ |
425 | if (nstime_cmp(elapsed_time, &rel_ts) < 0) { |
426 | *elapsed_time = rel_ts; |
427 | } |
428 | |
429 | fdata->frame_ref_num = (*frame_ref != fdata) ? (*frame_ref)->num : 0; |
430 | fdata->prev_dis_num = (prev_dis) ? prev_dis->num : 0; |
431 | } |
432 | |
433 | void |
434 | frame_data_set_after_dissect(frame_data *fdata, |
435 | uint32_t *cum_bytes) |
436 | { |
437 | /* This frame either passed the display filter list or is marked as |
438 | a time reference frame. All time reference frames are displayed |
439 | even if they don't pass the display filter */ |
440 | if(fdata->ref_time){ |
441 | /* if this was a TIME REF frame we should reset the cul bytes field */ |
442 | *cum_bytes = fdata->pkt_len; |
443 | fdata->cum_bytes = *cum_bytes; |
444 | } else { |
445 | /* increase cum_bytes with this packets length */ |
446 | *cum_bytes += fdata->pkt_len; |
447 | fdata->cum_bytes = *cum_bytes; |
448 | } |
449 | } |
450 | |
451 | void |
452 | frame_data_reset(frame_data *fdata) |
453 | { |
454 | fdata->visited = 0; |
455 | |
456 | frame_data_destroy(fdata); |
457 | } |
458 | |
459 | void |
460 | frame_data_destroy(frame_data *fdata) |
461 | { |
462 | if (fdata->pfd) { |
463 | g_slist_free(fdata->pfd); |
464 | fdata->pfd = NULL((void*)0); |
465 | } |
466 | |
467 | if (fdata->dependent_frames) { |
468 | g_hash_table_destroy(fdata->dependent_frames); |
469 | fdata->dependent_frames = NULL((void*)0); |
470 | } |
471 | |
472 | frame_data_aggregation_free(fdata); |
473 | } |
474 | |
475 | void frame_data_aggregation_free(frame_data* fdata) |
476 | { |
477 | if (fdata->aggregation_keys) { |
478 | g_slist_free_full(fdata->aggregation_keys, free_aggregation_key); |
479 | fdata->aggregation_keys = NULL((void*)0); |
480 | } |
481 | } |
482 | |
483 | /* |
484 | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
485 | * |
486 | * Local variables: |
487 | * c-basic-offset: 2 |
488 | * tab-width: 8 |
489 | * indent-tabs-mode: nil |
490 | * End: |
491 | * |
492 | * vi: set shiftwidth=2 tabstop=8 expandtab: |
493 | * :indentSize=2:tabSize=8:noTabs=true: |
494 | */ |