diff options
author | Guy Harris <gharris@sonic.net> | 2021-07-07 22:43:29 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-07-08 00:05:35 -0700 |
commit | dd5907d2a3f6d0ac572a76770b43422b0b82c2ab (patch) | |
tree | 88c706f42fc5b21ee0f9d12e949a02f16651a554 /epan | |
parent | 6dfa2cb0ae4f15d171da8cf77f2a6e11d35d0d86 (diff) |
Consistently refer to blocks that have been modified as "modified".
"User" sounds as if the blocks belong to the user; at most, the current
user might have modified them directly, but they might also have, for
example, run a Lua script that, unknown to them, modified comments.
Also, a file might have "user comments" added by a previous user, who
them wrote the file and and provided it to the current user.
"Modified" seems a bit clearer than "changed".
Diffstat (limited to 'epan')
-rw-r--r-- | epan/epan.c | 6 | ||||
-rw-r--r-- | epan/epan.h | 4 | ||||
-rw-r--r-- | epan/frame_data.c | 2 | ||||
-rw-r--r-- | epan/frame_data.h | 2 | ||||
-rw-r--r-- | epan/packet.c | 18 | ||||
-rw-r--r-- | epan/wslua/wslua_dumper.c | 8 |
6 files changed, 23 insertions, 17 deletions
diff --git a/epan/epan.c b/epan/epan.c index bd17666f79..1eea3d1906 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -449,10 +449,10 @@ epan_new(struct packet_provider_data *prov, } wtap_block_t -epan_get_user_block(const epan_t *session, const frame_data *fd) +epan_get_modified_block(const epan_t *session, const frame_data *fd) { - if (session->funcs.get_user_block) - return session->funcs.get_user_block(session->prov, fd); + if (session->funcs.get_modified_block) + return session->funcs.get_modified_block(session->prov, fd); return NULL; } diff --git a/epan/epan.h b/epan/epan.h index dc42541d93..dd322644e4 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -50,7 +50,7 @@ struct packet_provider_funcs { const nstime_t *(*get_frame_ts)(struct packet_provider_data *prov, guint32 frame_num); const char *(*get_interface_name)(struct packet_provider_data *prov, guint32 interface_id); const char *(*get_interface_description)(struct packet_provider_data *prov, guint32 interface_id); - wtap_block_t (*get_user_block)(struct packet_provider_data *prov, const frame_data *fd); + wtap_block_t (*get_modified_block)(struct packet_provider_data *prov, const frame_data *fd); }; /** @@ -154,7 +154,7 @@ typedef struct epan_session epan_t; WS_DLL_PUBLIC epan_t *epan_new(struct packet_provider_data *prov, const struct packet_provider_funcs *funcs); -WS_DLL_PUBLIC wtap_block_t epan_get_user_block(const epan_t *session, const frame_data *fd); +WS_DLL_PUBLIC wtap_block_t epan_get_modified_block(const epan_t *session, const frame_data *fd); WS_DLL_PUBLIC const char *epan_get_interface_name(const epan_t *session, guint32 interface_id); diff --git a/epan/frame_data.c b/epan/frame_data.c index 8cc35ee374..c60271e674 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -219,7 +219,7 @@ frame_data_init(frame_data *fdata, guint32 num, const wtap_rec *rec, fdata->tsprec = (unsigned int)rec->tsprec; fdata->abs_ts = rec->ts; fdata->has_phdr_block = (rec->block != NULL); - fdata->has_user_block = 0; + fdata->has_modified_block = 0; fdata->need_colorize = 0; fdata->color_filter = NULL; fdata->shift_offset.secs = 0; diff --git a/epan/frame_data.h b/epan/frame_data.h index 00d7585ef3..004d931830 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -85,7 +85,7 @@ typedef struct _frame_data { unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */ unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */ unsigned int has_phdr_block : 1; /** 1 = there's a block (possibly with options) for this packet */ - unsigned int has_user_block : 1; /** 1 = user changed block (or its options) for this packet */ + unsigned int has_modified_block : 1; /** 1 = block for this packet has been modified */ unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */ unsigned int tsprec : 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */ nstime_t abs_ts; /**< Absolute timestamp */ diff --git a/epan/packet.c b/epan/packet.c index 969c77b056..c2eb0c9c75 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -583,9 +583,12 @@ dissect_record(epan_dissect_t *edt, int file_type_subtype, frame_delta_abs_time(edt->session, fd, fd->frame_ref_num, &edt->pi.rel_ts); - /* pkt block use first user, later from rec */ - if (fd->has_user_block) { - frame_dissector_data.pkt_block = epan_get_user_block(edt->session, fd); + /* + * If the block has been modified, use the modified block, + * otherwise use the block from the file. + */ + if (fd->has_modified_block) { + frame_dissector_data.pkt_block = epan_get_modified_block(edt->session, fd); } else if (fd->has_phdr_block) { frame_dissector_data.pkt_block = rec->block; @@ -657,9 +660,12 @@ dissect_file(epan_dissect_t *edt, wtap_rec *rec, TRY { - /* pkt block use first user, later from rec */ - if (fd->has_user_block) { - file_dissector_data.pkt_block = epan_get_user_block(edt->session, fd); + /* + * If the block has been modified, use the modified block, + * otherwise use the block from the file. + */ + if (fd->has_modified_block) { + file_dissector_data.pkt_block = epan_get_modified_block(edt->session, fd); } else if (fd->has_phdr_block) { file_dissector_data.pkt_block = rec->block; diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c index b733a19578..4f6527c8af 100644 --- a/epan/wslua/wslua_dumper.c +++ b/epan/wslua/wslua_dumper.c @@ -541,12 +541,12 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) { /* * wtap_dump does not modify rec.block, so it should be possible to - * pass epan_get_user_block() or lua_pinfo->rec->block directly. + * pass epan_get_modified_block() or lua_pinfo->rec->block directly. * Temporarily duplicating the memory should not hurt though. */ - if (lua_pinfo->fd->has_user_block) { - rec.block = epan_get_user_block(lua_pinfo->epan, lua_pinfo->fd); - rec.has_block_changed = TRUE; + if (lua_pinfo->fd->has_modified_block) { + rec.block = epan_get_modified_block(lua_pinfo->epan, lua_pinfo->fd); + rec.block_was_modified = TRUE; } else if (lua_pinfo->fd->has_phdr_block) { rec.block = lua_pinfo->rec->block; } |