diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-16 18:48:30 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-17 01:49:01 +0000 |
commit | 407a2b07e55a262905881c7d1e225d618e9824fb (patch) | |
tree | ff273d3ca4dc747c9dc397244a04d90872c3b4d0 | |
parent | 1bfc8580e322450f8afaaf797e236469b948c984 (diff) |
Rename some routines and structure members.
They deal with sets of hfids, which can belong to protocols as well as
fields (I guess you could argue that a protocol is a field, but...).
Change-Id: Ibd103cfa26427ead4ef54be89f1251908004cfae
Reviewed-on: https://code.wireshark.org/review/21154
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | debian/libwireshark0.symbols | 6 | ||||
-rw-r--r-- | epan/packet.c | 24 | ||||
-rw-r--r-- | epan/packet.h | 15 | ||||
-rw-r--r-- | file.c | 23 | ||||
-rw-r--r-- | plugins/mate/packet-mate.c | 2 | ||||
-rw-r--r-- | plugins/transum/packet-transum.c | 2 | ||||
-rw-r--r-- | sharkd.c | 9 | ||||
-rw-r--r-- | tfshark.c | 18 | ||||
-rw-r--r-- | tshark.c | 23 |
9 files changed, 66 insertions, 56 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 2fcd2d0fda..133805e308 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -940,7 +940,7 @@ libwireshark.so.0 libwireshark0 #MINVER# port_type_to_str@Base 1.12.0~rc1 port_with_resolution_to_str@Base 2.1.0 port_with_resolution_to_str_buf@Base 2.0.0 - postdissectors_want_fields@Base 2.3.0 + postdissectors_want_hfids@Base 2.3.0 postseq_cleanup_all_protocols@Base 1.9.1 pref_clean_stash@Base 2.3.0 pref_stash@Base 2.3.0 @@ -1016,7 +1016,7 @@ libwireshark.so.0 libwireshark0 #MINVER# prefs_set_stashed_range_value@Base 2.3.0 prefs_set_string_value@Base 2.3.0 prefs_set_uint_value@Base 2.3.0 - prime_epan_dissect_with_postdissector_wanted_fields@Base 2.3.0 + prime_epan_dissect_with_postdissector_wanted_hfids@Base 2.3.0 print_bookmark@Base 1.12.0~rc1 print_finale@Base 1.12.0~rc1 print_hex_data@Base 1.12.0~rc1 @@ -1354,7 +1354,7 @@ libwireshark.so.0 libwireshark0 #MINVER# set_enabled_protos_list@Base 2.3.0 set_fd_time@Base 1.9.1 set_mac_lte_proto_data@Base 1.9.1 - set_postdissector_wanted_fields@Base 2.3.0 + set_postdissector_wanted_hfids@Base 2.3.0 set_srt_table_param_data@Base 1.99.8 set_tap_dfilter@Base 1.9.1 show_exception@Base 1.9.1 diff --git a/epan/packet.c b/epan/packet.c index bb43449d7f..5a62a1cbf6 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -133,7 +133,7 @@ static GSList *postseq_cleanup_routines; */ typedef struct { dissector_handle_t handle; - GArray *wanted_fields; + GArray *wanted_hfids; } postdissector; /* @@ -3274,12 +3274,12 @@ register_postdissector(dissector_handle_t handle) postdissectors = g_array_sized_new(FALSE, FALSE, (guint)sizeof(postdissector), 1); p.handle = handle; - p.wanted_fields = NULL; + p.wanted_hfids = NULL; postdissectors = g_array_append_val(postdissectors, p); } void -set_postdissector_wanted_fields(dissector_handle_t handle, GArray *wanted_fields) +set_postdissector_wanted_hfids(dissector_handle_t handle, GArray *wanted_hfids) { guint i; @@ -3287,7 +3287,7 @@ set_postdissector_wanted_fields(dissector_handle_t handle, GArray *wanted_fields for (i = 0; i < postdissectors->len; i++) { if (POSTDISSECTORS(i).handle == handle) { - POSTDISSECTORS(i).wanted_fields = wanted_fields; + POSTDISSECTORS(i).wanted_hfids = wanted_hfids; break; } } @@ -3338,34 +3338,34 @@ call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } gboolean -postdissectors_want_fields(void) +postdissectors_want_hfids(void) { guint i; for (i = 0; i < postdissectors->len; i++) { - if (POSTDISSECTORS(i).wanted_fields != NULL && - POSTDISSECTORS(i).wanted_fields->len != 0) + if (POSTDISSECTORS(i).wanted_hfids != NULL && + POSTDISSECTORS(i).wanted_hfids->len != 0) return TRUE; } return FALSE; } void -prime_epan_dissect_with_postdissector_wanted_fields(epan_dissect_t *edt) +prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt) { guint i; if (postdissectors == NULL) { /* - * No postdissector expressed an interest in any fields. + * No postdissector expressed an interest in any hfids. */ return; } for (i = 0; i < postdissectors->len; i++) { - if (POSTDISSECTORS(i).wanted_fields != NULL && - POSTDISSECTORS(i).wanted_fields->len != 0) + if (POSTDISSECTORS(i).wanted_hfids != NULL && + POSTDISSECTORS(i).wanted_hfids->len != 0) epan_dissect_prime_with_hfid_array(edt, - POSTDISSECTORS(i).wanted_fields); + POSTDISSECTORS(i).wanted_hfids); } } diff --git a/epan/packet.h b/epan/packet.h index e0625ae226..d6e512532f 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -776,11 +776,11 @@ WS_DLL_PUBLIC void dissector_dump_heur_decodes(void); WS_DLL_PUBLIC void register_postdissector(dissector_handle_t handle); /* - * Specify a set of fields that the postdissector will need. + * Specify a set of hfids that the postdissector will need. * The GArray is an array of hfids. */ -WS_DLL_PUBLIC void set_postdissector_wanted_fields(dissector_handle_t handle, - GArray *wanted_fields); +WS_DLL_PUBLIC void set_postdissector_wanted_hfids(dissector_handle_t handle, + GArray *wanted_hfids); /* * Deregister a postdissector. Not for use in (post)dissectors or @@ -803,15 +803,16 @@ extern gboolean have_postdissector(void); extern void call_all_postdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); /* - * Return TRUE if at least one postdissector wants fields, FALSE otherwise. + * Return TRUE if at least one postdissector needs at least one hfid, + * FALSE otherwise. */ -WS_DLL_PUBLIC gboolean postdissectors_want_fields(void); +WS_DLL_PUBLIC gboolean postdissectors_want_hfids(void); /* - * Prime an epan_dissect_t with all the fields wanted by postdissectors. + * Prime an epan_dissect_t with all the hfids wanted by postdissectors. */ WS_DLL_PUBLIC void -prime_epan_dissect_with_postdissector_wanted_fields(epan_dissect_t *edt); +prime_epan_dissect_with_postdissector_wanted_hfids(epan_dissect_t *edt); /** @} */ @@ -572,11 +572,12 @@ cf_read(capture_file *cf, gboolean reloading) * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols on + * the first pass. */ create_proto_tree = (dfcode != NULL || have_filtering_tap_listeners() || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields()); + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids()); reset_tap_listeners(); @@ -812,11 +813,12 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err) * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols on + * the first pass. */ create_proto_tree = (dfcode != NULL || have_filtering_tap_listeners() || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields()); + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids()); *err = 0; @@ -957,11 +959,12 @@ cf_finish_tail(capture_file *cf, int *err) * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols on + * the first pass. */ create_proto_tree = (dfcode != NULL || have_filtering_tap_listeners() || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields()); + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids()); if (cf->wth == NULL) { cf_close(cf); @@ -1165,8 +1168,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, if (fdata->flags.visited) { /* This is the first pass, so prime the epan_dissect_t with the - fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); } /* Dissect the frame. */ @@ -1640,12 +1643,12 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb * one of the tap listeners requires a protocol tree; * * we're redissecting and a postdissector wants field - * values on the first pass. + * values or protocols on the first pass. */ create_proto_tree = (dfcode != NULL || have_filtering_tap_listeners() || (tap_flags & TL_REQUIRES_PROTO_TREE) || - (redissect && postdissectors_want_fields())); + (redissect && postdissectors_want_hfids())); reset_tap_listeners(); /* Which frame, if any, is the currently selected frame? diff --git a/plugins/mate/packet-mate.c b/plugins/mate/packet-mate.c index 2334826c49..cf30903eee 100644 --- a/plugins/mate/packet-mate.c +++ b/plugins/mate/packet-mate.c @@ -362,7 +362,7 @@ proto_reg_handoff_mate(void) /* * Set the list of hfids we want. */ - set_postdissector_wanted_fields(mate_handle, + set_postdissector_wanted_hfids(mate_handle, mc->wanted_hfids); tap_error = register_tap_listener("frame", &mate_tap_data, diff --git a/plugins/transum/packet-transum.c b/plugins/transum/packet-transum.c index 79f4507e92..313d45fe00 100644 --- a/plugins/transum/packet-transum.c +++ b/plugins/transum/packet-transum.c @@ -727,7 +727,7 @@ static void init_globals(void) { g_array_append_val(wanted_fields, hf_of_interest[i].hf); } - set_postdissector_wanted_fields(transum_handle, wanted_fields); + set_postdissector_wanted_hfids(transum_handle, wanted_fields); GString* fake_tap_filter = g_string_new("frame || eth.type"); @@ -308,8 +308,8 @@ process_packet(capture_file *cf, epan_dissect_t *edt, epan_dissect_prime_with_dfilter(edt, cf->dfcode); /* This is the first and only pass, so prime the epan_dissect_t - with the fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + with the hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, &ref, prev_dis); @@ -378,10 +378,11 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count) * * we're going to apply a display filter; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols + * on the first pass. */ create_proto_tree = - (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_fields()); + (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_hfids()); /* We're not going to display the protocol tree on this pass, so it's not going to be "visible". */ @@ -1100,8 +1100,8 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, epan_dissect_prime_with_dfilter(edt, cf->rfcode); /* This is the first pass, so prime the epan_dissect_t with the - fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, &ref, prev_dis); @@ -1166,8 +1166,8 @@ process_packet_second_pass(capture_file *cf, epan_dissect_t *edt, epan_dissect_prime_with_dfilter(edt, cf->dfcode); /* This is the first and only pass, so prime the epan_dissect_t - with the fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + with the hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); col_custom_prime_edt(edt, &cf->cinfo); @@ -1342,10 +1342,11 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count) * * we're going to apply a read filter; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols + * on the first pass. */ create_proto_tree = - (cf->rfcode != NULL || postdissectors_want_fields()); + (cf->rfcode != NULL || postdissectors_want_hfids()); /* We're not going to display the protocol tree on this pass, so it's not going to be "visible". */ @@ -1453,14 +1454,15 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count) * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass; + * a postdissector wants field values or protocols + * on the first pass; * * we have custom columns (which require field values, which * currently requires that we build a protocol tree). */ create_proto_tree = (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() || + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids() || have_custom_cols(&cf->cinfo)); /* The protocol tree will be "visible", i.e., printed, only if we're @@ -2586,14 +2586,15 @@ capture_input_new_packets(capture_session *cap_session, int to_read) * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass; + * a postdissector wants field values or protocols + * on the first pass; * * we have custom columns (which require field values, which * currently requires that we build a protocol tree). */ create_proto_tree = (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() || + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids() || have_custom_cols(&cf->cinfo)); /* The protocol tree will be "visible", i.e., printed, only if we're @@ -2822,8 +2823,8 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, epan_dissect_prime_with_dfilter(edt, cf->dfcode); /* This is the first pass, so prime the epan_dissect_t with the - fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, &ref, prev_dis); @@ -3104,10 +3105,11 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, * * we're going to apply a display filter; * - * a postdissector wants field values on the first pass. + * a postdissector wants field values or protocols + * on the first pass. */ create_proto_tree = - (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_fields()); + (cf->rfcode != NULL || cf->dfcode != NULL || postdissectors_want_hfids()); tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE"); @@ -3306,14 +3308,15 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, * * one of the tap listeners requires a protocol tree; * - * a postdissector wants field values on the first pass; + * a postdissector wants field values or protocols + * on the first pass; * * we have custom columns (which require field values, which * currently requires that we build a protocol tree). */ create_proto_tree = (cf->rfcode || cf->dfcode || print_details || filtering_tap_listeners || - (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_fields() || + (tap_flags & TL_REQUIRES_PROTO_TREE) || postdissectors_want_hfids() || have_custom_cols(&cf->cinfo)) tshark_debug("tshark: create_proto_tree = %s", create_proto_tree ? "TRUE" : "FALSE"); @@ -3556,8 +3559,8 @@ process_packet_single_pass(capture_file *cf, epan_dissect_t *edt, gint64 offset, epan_dissect_prime_with_dfilter(edt, cf->dfcode); /* This is the first and only pass, so prime the epan_dissect_t - with the fields postdissectors want on the first pass. */ - prime_epan_dissect_with_postdissector_wanted_fields(edt); + with the hfids postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_hfids(edt); col_custom_prime_edt(edt, &cf->cinfo); |