| 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 <gerald@wireshark.org> |
| 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 | int |
| 192 | frame_data_compare(const struct epan_session *epan, const frame_data *fdata1, const frame_data *fdata2, int field) |
| 193 | { |
| 194 | switch (field) { |
| 195 | case COL_NUMBER: |
| 196 | return COMPARE_FRAME_NUM()((fdata1->num < fdata2->num) ? -1 : (fdata1->num > fdata2->num) ? 1 : 0); |
| 197 | |
| 198 | case COL_NUMBER_DIS: |
| 199 | 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 )); |
| 200 | |
| 201 | case COL_CLS_TIME: |
| 202 | switch (timestamp_get_type()) { |
| 203 | case TS_ABSOLUTE: |
| 204 | case TS_ABSOLUTE_WITH_YMD: |
| 205 | case TS_ABSOLUTE_WITH_YDOY: |
| 206 | case TS_UTC: |
| 207 | case TS_UTC_WITH_YMD: |
| 208 | case TS_UTC_WITH_YDOY: |
| 209 | case TS_EPOCH: |
| 210 | 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)); |
| 211 | |
| 212 | case TS_RELATIVE: |
| 213 | return frame_compare_rel_times(epan, fdata1, fdata2); |
| 214 | |
| 215 | case TS_DELTA: |
| 216 | return frame_compare_delta_times_prev_captured(epan, fdata1, fdata2); |
| 217 | |
| 218 | case TS_DELTA_DIS: |
| 219 | return frame_compare_delta_times_prev_displayed(epan, fdata1, fdata2); |
| 220 | |
| 221 | case TS_NOT_SET: |
| 222 | return 0; |
| 223 | } |
| 224 | return 0; |
| 225 | |
| 226 | case COL_ABS_TIME: |
| 227 | case COL_ABS_YMD_TIME: |
| 228 | case COL_ABS_YDOY_TIME: |
| 229 | case COL_UTC_TIME: |
| 230 | case COL_UTC_YMD_TIME: |
| 231 | case COL_UTC_YDOY_TIME: |
| 232 | 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)); |
| 233 | |
| 234 | case COL_REL_TIME: |
| 235 | return frame_compare_rel_times(epan, fdata1, fdata2); |
| 236 | |
| 237 | case COL_DELTA_TIME: |
| 238 | return frame_compare_delta_times_prev_captured(epan, fdata1, fdata2); |
| 239 | |
| 240 | case COL_DELTA_TIME_DIS: |
| 241 | return frame_compare_delta_times_prev_displayed(epan, fdata1, fdata2); |
| 242 | |
| 243 | case COL_PACKET_LENGTH: |
| 244 | 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 )); |
| 245 | |
| 246 | case COL_CUMULATIVE_BYTES: |
| 247 | 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)); |
| 248 | |
| 249 | } |
| 250 | 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", 250, ((const char*) (__func__))); return (0); } while (0); |
| 251 | } |
| 252 | |
| 253 | void |
| 254 | frame_data_init(frame_data *fdata, uint32_t num, const wtap_rec *rec, |
| 255 | int64_t offset, uint32_t cum_bytes) |
| 256 | { |
| 257 | fdata->pfd = NULL((void*)0); |
| 258 | fdata->num = num; |
| 259 | fdata->dis_num = num; |
| 260 | fdata->file_off = offset; |
| 261 | fdata->passed_dfilter = 1; |
| 262 | fdata->dependent_of_displayed = 0; |
| 263 | fdata->dependent_frames = NULL((void*)0); |
| 264 | fdata->encoding = PACKET_CHAR_ENC_CHAR_ASCII; |
| 265 | fdata->visited = 0; |
| 266 | fdata->marked = 0; |
| 267 | fdata->ref_time = 0; |
| 268 | fdata->ignored = 0; |
| 269 | fdata->has_ts = (rec->presence_flags & WTAP_HAS_TS0x00000001) ? 1 : 0; |
| 270 | fdata->tcp_snd_manual_analysis = 0; |
| 271 | switch (rec->rec_type) { |
| 272 | |
| 273 | case REC_TYPE_PACKET0: |
| 274 | fdata->pkt_len = rec->rec_header.packet_header.len; |
| 275 | fdata->cum_bytes = cum_bytes + rec->rec_header.packet_header.len; |
| 276 | fdata->cap_len = rec->rec_header.packet_header.caplen; |
| 277 | break; |
| 278 | |
| 279 | case REC_TYPE_FT_SPECIFIC_EVENT1: |
| 280 | case REC_TYPE_FT_SPECIFIC_REPORT2: |
| 281 | /* |
| 282 | * XXX |
| 283 | */ |
| 284 | fdata->pkt_len = rec->rec_header.ft_specific_header.record_len; |
| 285 | fdata->cum_bytes = cum_bytes + rec->rec_header.ft_specific_header.record_len; |
| 286 | fdata->cap_len = rec->rec_header.ft_specific_header.record_len; |
| 287 | break; |
| 288 | |
| 289 | case REC_TYPE_SYSCALL3: |
| 290 | /* |
| 291 | * XXX - is cum_bytes supposed to count non-packet bytes? |
| 292 | */ |
| 293 | fdata->pkt_len = rec->rec_header.syscall_header.event_data_len; |
| 294 | fdata->cum_bytes = cum_bytes + rec->rec_header.syscall_header.event_data_len; |
| 295 | fdata->cap_len = rec->rec_header.syscall_header.event_data_len; |
| 296 | break; |
| 297 | |
| 298 | case REC_TYPE_SYSTEMD_JOURNAL_EXPORT4: |
| 299 | /* |
| 300 | * XXX - is cum_bytes supposed to count non-packet bytes? |
| 301 | */ |
| 302 | fdata->pkt_len = rec->rec_header.systemd_journal_export_header.record_len; |
| 303 | fdata->cum_bytes = cum_bytes + rec->rec_header.systemd_journal_export_header.record_len; |
| 304 | fdata->cap_len = rec->rec_header.systemd_journal_export_header.record_len; |
| 305 | break; |
| 306 | |
| 307 | case REC_TYPE_CUSTOM_BLOCK5: |
| 308 | /* |
| 309 | * XXX - is cum_bytes supposed to count non-packet bytes? |
| 310 | */ |
| 311 | fdata->pkt_len = rec->rec_header.custom_block_header.length; |
| 312 | fdata->cum_bytes = cum_bytes + rec->rec_header.custom_block_header.length; |
| 313 | fdata->cap_len = rec->rec_header.custom_block_header.length; |
| 314 | break; |
| 315 | |
| 316 | } |
| 317 | |
| 318 | /* To save some memory, we coerce it into 4 bits */ |
| 319 | ws_assert(rec->tsprec <= 0xF)do { if ((1) && !(rec->tsprec <= 0xF)) ws_log_fatal_full ("", LOG_LEVEL_ERROR, "epan/frame_data.c", 319, __func__, "assertion failed: %s" , "rec->tsprec <= 0xF"); } while (0); |
| 320 | fdata->tsprec = (unsigned int)rec->tsprec; |
| 321 | fdata->abs_ts = rec->ts; |
| 322 | fdata->has_modified_block = 0; |
| 323 | fdata->need_colorize = 0; |
| 324 | fdata->color_filter = NULL((void*)0); |
| 325 | fdata->shift_offset.secs = 0; |
| 326 | fdata->shift_offset.nsecs = 0; |
| 327 | fdata->frame_ref_num = 0; |
| 328 | fdata->prev_dis_num = 0; |
| 329 | } |
| 330 | |
| 331 | void |
| 332 | frame_data_set_before_dissect(frame_data *fdata, |
| 333 | nstime_t *elapsed_time, |
| 334 | const frame_data **frame_ref, |
| 335 | const frame_data *prev_dis) |
| 336 | { |
| 337 | nstime_t rel_ts; |
| 338 | |
| 339 | /* If this frame doesn't have a time stamp, don't set it as the |
| 340 | * reference frame used for calculating time deltas, set elapsed |
| 341 | * time, etc. We also won't need to calculate the delta of this |
| 342 | * frame's timestamp to any other frame. |
| 343 | */ |
| 344 | if (!fdata->has_ts) { |
| 345 | /* If it was marked as a reference time frame anyway (should we |
| 346 | * allow that?), clear the existing reference frame so that the |
| 347 | * next frame with a time stamp will become the reference frame. |
| 348 | */ |
| 349 | if(fdata->ref_time) { |
| 350 | *frame_ref = NULL((void*)0); |
| 351 | } |
| 352 | return; |
| 353 | } |
| 354 | |
| 355 | /* Don't have the reference frame, set to current */ |
| 356 | if (*frame_ref == NULL((void*)0)) |
| 357 | *frame_ref = fdata; |
| 358 | |
| 359 | /* if this frames is marked as a reference time frame, |
| 360 | set reference frame this frame */ |
| 361 | if(fdata->ref_time) |
| 362 | *frame_ref = fdata; |
| 363 | |
| 364 | /* Get the time elapsed between the first packet and this packet. */ |
| 365 | nstime_delta(&rel_ts, &fdata->abs_ts, &(*frame_ref)->abs_ts); |
| 366 | |
| 367 | /* If it's greater than the current elapsed time, set the elapsed time |
| 368 | to it (we check for "greater than" so as not to be confused by |
| 369 | time moving backwards). */ |
| 370 | if (nstime_cmp(elapsed_time, &rel_ts) < 0) { |
| 371 | *elapsed_time = rel_ts; |
| 372 | } |
| 373 | |
| 374 | fdata->frame_ref_num = (*frame_ref != fdata) ? (*frame_ref)->num : 0; |
| 375 | fdata->prev_dis_num = (prev_dis) ? prev_dis->num : 0; |
| 376 | } |
| 377 | |
| 378 | void |
| 379 | frame_data_set_after_dissect(frame_data *fdata, |
| 380 | uint32_t *cum_bytes) |
| 381 | { |
| 382 | /* This frame either passed the display filter list or is marked as |
| 383 | a time reference frame. All time reference frames are displayed |
| 384 | even if they don't pass the display filter */ |
| 385 | if(fdata->ref_time){ |
| 386 | /* if this was a TIME REF frame we should reset the cul bytes field */ |
| 387 | *cum_bytes = fdata->pkt_len; |
| 388 | fdata->cum_bytes = *cum_bytes; |
| 389 | } else { |
| 390 | /* increase cum_bytes with this packets length */ |
| 391 | *cum_bytes += fdata->pkt_len; |
| 392 | fdata->cum_bytes = *cum_bytes; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | void |
| 397 | frame_data_reset(frame_data *fdata) |
| 398 | { |
| 399 | fdata->visited = 0; |
| 400 | |
| 401 | if (fdata->pfd) { |
| 402 | g_slist_free(fdata->pfd); |
| 403 | fdata->pfd = NULL((void*)0); |
| 404 | } |
| 405 | |
| 406 | if (fdata->dependent_frames) { |
| 407 | g_hash_table_destroy(fdata->dependent_frames); |
| 408 | fdata->dependent_frames = NULL((void*)0); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | void |
| 413 | frame_data_destroy(frame_data *fdata) |
| 414 | { |
| 415 | if (fdata->pfd) { |
| 416 | g_slist_free(fdata->pfd); |
| 417 | fdata->pfd = NULL((void*)0); |
| 418 | } |
| 419 | |
| 420 | if (fdata->dependent_frames) { |
| 421 | g_hash_table_destroy(fdata->dependent_frames); |
| 422 | fdata->dependent_frames = NULL((void*)0); |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | /* |
| 427 | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
| 428 | * |
| 429 | * Local variables: |
| 430 | * c-basic-offset: 2 |
| 431 | * tab-width: 8 |
| 432 | * indent-tabs-mode: nil |
| 433 | * End: |
| 434 | * |
| 435 | * vi: set shiftwidth=2 tabstop=8 expandtab: |
| 436 | * :indentSize=2:tabSize=8:noTabs=true: |
| 437 | */ |