aboutsummaryrefslogtreecommitdiffstats
path: root/epan/epan.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2021-04-29 07:23:21 -0400
committerGuy Harris <gharris@sonic.net>2021-07-07 18:40:24 +0000
commit73087d6fb486a61e8eb0886a02e6c6403534fa36 (patch)
tree2cee7a922a2225628103bb247818a8bb2db133b3 /epan/epan.c
parent20f38c06eab3f9a995468141cdfb14ec821a6503 (diff)
Use wtap_blocks for packet comments
Mostly functioning proof of concept for #14329. This work is intended to allow Wireshark to support multiple packet comments per packet. Uses and expands upon the `wtap_block` API in `wiretap/wtap_opttypes.h`. It attaches a `wtap_block` structure to `wtap_rec` in place of its current `opt_comment` and `packet_verdict` members to hold OPT_COMMENT and OPT_PKT_VERDICT option values.
Diffstat (limited to 'epan/epan.c')
-rw-r--r--epan/epan.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/epan/epan.c b/epan/epan.c
index 1eb2581487..bd17666f79 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -448,11 +448,11 @@ epan_new(struct packet_provider_data *prov,
return session;
}
-const char *
-epan_get_user_comment(const epan_t *session, const frame_data *fd)
+wtap_block_t
+epan_get_user_block(const epan_t *session, const frame_data *fd)
{
- if (session->funcs.get_user_comment)
- return session->funcs.get_user_comment(session->prov, fd);
+ if (session->funcs.get_user_block)
+ return session->funcs.get_user_block(session->prov, fd);
return NULL;
}
@@ -558,6 +558,8 @@ epan_dissect_reset(epan_dissect_t *edt)
ws_assert(edt);
+ wtap_block_unref(edt->pi.rec->block);
+
g_slist_free(edt->pi.proto_data);
g_slist_free(edt->pi.dependent_frames);
@@ -611,6 +613,8 @@ epan_dissect_run(epan_dissect_t *edt, int file_type_subtype,
/* free all memory allocated */
wmem_leave_packet_scope();
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
}
void
@@ -625,6 +629,8 @@ epan_dissect_run_with_taps(epan_dissect_t *edt, int file_type_subtype,
/* free all memory allocated */
wmem_leave_packet_scope();
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
}
void
@@ -639,6 +645,8 @@ epan_dissect_file_run(epan_dissect_t *edt, wtap_rec *rec,
/* free all memory allocated */
wmem_leave_packet_scope();
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
}
void
@@ -652,6 +660,8 @@ epan_dissect_file_run_with_taps(epan_dissect_t *edt, wtap_rec *rec,
/* free all memory allocated */
wmem_leave_packet_scope();
+ wtap_block_unref(rec->block);
+ rec->block = NULL;
}
void