summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/libwireshark0.symbols6
-rw-r--r--epan/dissectors/Makefile.common1
-rw-r--r--epan/dissectors/packet-data.c1
-rw-r--r--epan/dissectors/packet-data.h33
-rw-r--r--epan/dissectors/packet-frame.c10
-rw-r--r--epan/dissectors/packet-frame.h9
-rw-r--r--epan/epan.c2
-rw-r--r--epan/print.c21
-rw-r--r--epan/print.h2
-rw-r--r--file.c1
10 files changed, 28 insertions, 58 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index f6aae54821..20bef859c0 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -712,10 +712,6 @@ libwireshark.so.0 libwireshark0 #MINVER#
heur_dissector_table_foreach@Base 1.99.2
hex_str_to_bytes@Base 1.9.1
hex_str_to_bytes_encoding@Base 1.12.0~rc1
- hf_frame_arrival_time@Base 1.9.1
- hf_frame_capture_len@Base 1.9.1
- hf_frame_len@Base 1.9.1
- hf_frame_number@Base 1.9.1
hf_text_only@Base 1.9.1
hfinfo_bitshift@Base 1.12.0~rc1
host_ip_af@Base 1.9.1
@@ -869,14 +865,12 @@ libwireshark.so.0 libwireshark0 #MINVER#
proto_can_toggle_protocol@Base 1.9.1
proto_check_field_name@Base 1.9.1
proto_construct_match_selected_string@Base 1.9.1
- proto_data@Base 1.9.1
proto_enable_all@Base 1.9.1
proto_expert@Base 1.9.1
proto_field_is_referenced@Base 1.9.1
proto_find_field_from_offset@Base 1.9.1
proto_find_finfo@Base 1.9.1
proto_find_undecoded_data@Base 1.99.3
- proto_frame@Base 1.9.1
proto_free_deregistered_fields@Base 1.12.0~rc1
proto_get_data_protocol@Base 1.9.1
proto_get_finfo_ptr_array@Base 1.9.1
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common
index 0f10691728..fe8cdd89f8 100644
--- a/epan/dissectors/Makefile.common
+++ b/epan/dissectors/Makefile.common
@@ -1432,7 +1432,6 @@ DISSECTOR_INCLUDES = \
packet-crmf.h \
packet-csn1.h \
packet-dap.h \
- packet-data.h \
packet-dcc.h \
packet-dccp.h \
packet-dcerpc.h \
diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c
index 3dc21aac19..c28b6cc5b1 100644
--- a/epan/dissectors/packet-data.c
+++ b/epan/dissectors/packet-data.c
@@ -29,7 +29,6 @@
#include <epan/prefs.h>
#include <epan/to_str.h>
#include <wsutil/md5.h>
-#include "packet-data.h"
/* proto_data cannot be static because it's referenced in the
* print routines
diff --git a/epan/dissectors/packet-data.h b/epan/dissectors/packet-data.h
deleted file mode 100644
index 5ac3668487..0000000000
--- a/epan/dissectors/packet-data.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* packet-data.h
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PACKET_DATA_H__
-#define __PACKET_DATA_H__
-
-#include "ws_symbol_export.h"
-
-/*
- "proto_data" is exported from libwireshark.dll.
- * Thus we need a special declaration.
- */
-WS_DLL_PUBLIC int proto_data;
-
-#endif /* __PACKET_DATA_H__ */
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index f7f47d86a3..3781ec32a6 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -48,18 +48,18 @@
void proto_register_frame(void);
void proto_reg_handoff_frame(void);
-int proto_frame = -1;
+static int proto_frame = -1;
static int proto_pkt_comment = -1;
-int hf_frame_arrival_time = -1;
+static int hf_frame_arrival_time = -1;
static int hf_frame_shift_offset = -1;
static int hf_frame_arrival_time_epoch = -1;
static int hf_frame_time_delta = -1;
static int hf_frame_time_delta_displayed = -1;
static int hf_frame_time_relative = -1;
static int hf_frame_time_reference = -1;
-int hf_frame_number = -1;
-int hf_frame_len = -1;
-int hf_frame_capture_len = -1;
+static int hf_frame_number = -1;
+static int hf_frame_len = -1;
+static int hf_frame_capture_len = -1;
static int hf_frame_p2p_dir = -1;
static int hf_frame_file_off = -1;
static int hf_frame_md5_hash = -1;
diff --git a/epan/dissectors/packet-frame.h b/epan/dissectors/packet-frame.h
index c6bc2a5005..899ab7a9ad 100644
--- a/epan/dissectors/packet-frame.h
+++ b/epan/dissectors/packet-frame.h
@@ -35,12 +35,3 @@ register_frame_end_routine(packet_info *pinfo, void (*func)(void));
* The frame dissector and the PPI dissector both use this
*/
extern dissector_table_t wtap_encap_dissector_table;
-
-/* following variables are exported from libwireshark.dll.
- * Thus we need a special declaration.
- */
-WS_DLL_PUBLIC int proto_frame;
-WS_DLL_PUBLIC int hf_frame_arrival_time;
-WS_DLL_PUBLIC int hf_frame_number;
-WS_DLL_PUBLIC int hf_frame_len;
-WS_DLL_PUBLIC int hf_frame_capture_len;
diff --git a/epan/epan.c b/epan/epan.c
index 50cd80b7bc..4fb797dbd7 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -47,6 +47,7 @@
#include "oids.h"
#include "wmem/wmem.h"
#include "expert.h"
+#include "print.h"
#ifdef HAVE_LUA
#include <lua.h>
@@ -118,6 +119,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da
packet_cache_proto_handles();
dfilter_init();
final_registration_all_protocols();
+ print_cache_field_handles();
expert_packet_init();
#ifdef HAVE_LUA
wslua_init(cb, client_data);
diff --git a/epan/print.c b/epan/print.c
index 66946ec9da..8072f8393c 100644
--- a/epan/print.c
+++ b/epan/print.c
@@ -35,8 +35,6 @@
#include <epan/packet-range.h>
#include <epan/print.h>
#include <epan/charsets.h>
-#include <epan/dissectors/packet-data.h>
-#include <epan/dissectors/packet-frame.h>
#include <wsutil/filesystem.h>
#include <wsutil/ws_version_info.h>
#include <ftypes/ftypes-int.h>
@@ -93,6 +91,25 @@ static void print_pdml_geninfo(proto_tree *tree, FILE *fh);
static void proto_tree_get_node_field_values(proto_node *node, gpointer data);
+/* Cache the protocols and field handles that the print functionality needs
+ This helps break explicit dependency on the dissectors. */
+static int proto_data = -1;
+static int proto_frame = -1;
+static int hf_frame_arrival_time = -1;
+static int hf_frame_number = -1;
+static int hf_frame_len = -1;
+static int hf_frame_capture_len = -1;
+
+void print_cache_field_handles(void)
+{
+ proto_data = proto_get_id_by_short_name("Data");
+ proto_frame = proto_get_id_by_short_name("Frame");
+ hf_frame_arrival_time = proto_registrar_get_id_byname("frame.time");
+ hf_frame_number = proto_registrar_get_id_byname("frame.number");
+ hf_frame_len = proto_registrar_get_id_byname("frame.len");
+ hf_frame_capture_len = proto_registrar_get_id_byname("frame.cap_len");
+}
+
gboolean
proto_tree_print(print_args_t *print_args, epan_dissect_t *edt,
GHashTable *output_only_tables, print_stream_t *stream)
diff --git a/epan/print.h b/epan/print.h
index 95bc6a9da2..334de3a29b 100644
--- a/epan/print.h
+++ b/epan/print.h
@@ -123,6 +123,8 @@ WS_DLL_PUBLIC void write_fields_finale(output_fields_t* fields, FILE *fh);
WS_DLL_PUBLIC gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt);
+extern void print_cache_field_handles(void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/file.c b/file.c
index ff396c7181..cc919aa096 100644
--- a/file.c
+++ b/file.c
@@ -56,7 +56,6 @@
#include <epan/dfilter/dfilter.h>
#include <epan/epan_dissect.h>
#include <epan/tap.h>
-#include <epan/dissectors/packet-data.h>
#include <epan/dissectors/packet-ber.h>
#include <epan/timestamp.h>
#include <epan/dfilter/dfilter-macro.h>