diff --git a/wiretap/5views.h b/wiretap/5views.h index 74f7c8cb4c..98382013cc 100644 --- a/wiretap/5views.h +++ b/wiretap/5views.h @@ -25,8 +25,11 @@ #include #include +WS_DLL_LOCAL int _5views_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean _5views_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int _5views_dump_can_write_encap(int encap); #endif diff --git a/wiretap/CMakeLists.txt b/wiretap/CMakeLists.txt index a81fb1ea7d..bc9c57197d 100644 --- a/wiretap/CMakeLists.txt +++ b/wiretap/CMakeLists.txt @@ -109,6 +109,10 @@ add_library(wiretap ${LINK_MODE_LIB} set(FULL_SO_VERSION "0.0.0") +set_target_properties(wiretap PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL") +if(DEFINED COMPILE_HIDE_SYMBOLS) + set_target_properties(wiretap PROPERTIES COMPILE_FLAGS ${COMPILE_HIDE_SYMBOLS}) +endif() set_target_properties(wiretap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}") set_target_properties(wiretap PROPERTIES VERSION ${FULL_SO_VERSION} SOVERSION 0) @@ -125,7 +129,7 @@ configure_file(../abi-descriptor.template abi-descriptor.xml) file(GLOB HEADERS *.h) file(MAKE_DIRECTORY abi-check-headers) -file(COPY ${HEADERS} DESTINATION abi-check-headers) +file(COPY ${HEADERS} ../ws_symbol_export.h DESTINATION abi-check-headers) add_custom_command(OUTPUT libwiretap.abi.tar.gz COMMAND cp ../config.h abi-check-headers/ diff --git a/wiretap/Makefile.am b/wiretap/Makefile.am index 30a1671705..e1a8178b4e 100644 --- a/wiretap/Makefile.am +++ b/wiretap/Makefile.am @@ -30,10 +30,12 @@ include Makefile.common noinst_LTLIBRARIES = libwiretap_generated.la lib_LTLIBRARIES = libwiretap.la # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -libwiretap_la_LDFLAGS = -version-info 0:0:0 -export-symbols wtap.sym @LDFLAGS_SHAREDLIB@ +libwiretap_la_LDFLAGS = -version-info 0:0:0 @LDFLAGS_SHAREDLIB@ + +AM_NON_GENERATED_CFLAGS =-DWS_BUILD_DLL @COMPILE_HIDE_SYMBOLS@ if HAVE_WARNINGS_AS_ERRORS -AM_NON_GENERATED_CFLAGS = -Werror +AM_NON_GENERATED_CFLAGS += -Werror endif INCLUDES = -I$(srcdir)/.. @@ -43,7 +45,6 @@ CLEANFILES = \ libwiretap.la \ libwiretap_generated.a \ libwiretap_generated.la \ - wtap.sym \ *~ MAINTAINERCLEANFILES = \ @@ -68,12 +69,11 @@ EXTRA_DIST = \ Makefile.common \ Makefile.nmake \ libwiretap.vcproj \ - wtap.def \ $(GENERATOR_FILES) \ $(GENERATED_FILES) libwiretap_la_LIBADD = libwiretap_generated.la ${top_builddir}/wsutil/libwsutil.la $(GLIB_LIBS) -libwiretap_la_DEPENDENCIES = libwiretap_generated.la ${top_builddir}/wsutil/libwsutil.la wtap.sym +libwiretap_la_DEPENDENCIES = libwiretap_generated.la ${top_builddir}/wsutil/libwsutil.la RUNLEX = $(top_srcdir)/tools/runlex.sh @@ -96,7 +96,7 @@ ascend.c ascend.h: ascend.y dumpabi-libwiretap: all abi-descriptor.xml rm -rf abi-check-headers abi_dumps .libs/*.abi.tar.gz mkdir abi-check-headers - cp *.h abi-check-headers/ + cp *.h ../ws_symbol_export.h abi-check-headers/ abi-compliance-checker -l libwiretap -v1 `readlink .libs/libwiretap.so | sed 's/.*\.so\.//'` \ -relpath $(abs_srcdir) -dump-abi abi-descriptor.xml || \ cat logs/libwiretap/[0-9]*/log.txt diff --git a/wiretap/Makefile.nmake b/wiretap/Makefile.nmake index a036c44b2c..3160036cee 100644 --- a/wiretap/Makefile.nmake +++ b/wiretap/Makefile.nmake @@ -32,10 +32,10 @@ all: wiretap-$(WTAP_VERSION).dll wiretap-$(WTAP_VERSION).lib: wiretap-$(WTAP_VERSION).dll wiretap-$(WTAP_VERSION).exp: wiretap-$(WTAP_VERSION).dll -wiretap-$(WTAP_VERSION).dll : $(OBJECTS) wtap.def ..\image\wiretap.res +wiretap-$(WTAP_VERSION).dll : $(OBJECTS) ..\image\wiretap.res $(link) $(dlllflags) $(conlibsdll) \ $(LOCAL_LDFLAGS) $(DLL_LDFLAGS) \ - /DEF:wtap.def /OUT:wiretap-$(WTAP_VERSION).dll \ + /OUT:wiretap-$(WTAP_VERSION).dll \ /IMPLIB:wiretap-$(WTAP_VERSION).lib \ ..\image\wiretap.res \ $(OBJECTS) $(wiretap_LIBS) diff --git a/wiretap/aethra.h b/wiretap/aethra.h index 1fdd19d54f..96590cc83c 100644 --- a/wiretap/aethra.h +++ b/wiretap/aethra.h @@ -26,6 +26,7 @@ #include #include +WS_DLL_LOCAL int aethra_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/ascend-int.h b/wiretap/ascend-int.h index 2d04eb5714..1c33877e87 100644 --- a/wiretap/ascend-int.h +++ b/wiretap/ascend-int.h @@ -31,6 +31,7 @@ #endif #include +#include "ws_symbol_export.h" typedef struct { time_t start_time; @@ -50,15 +51,19 @@ extern const gchar *ascend_parse_error; extern struct ascend_phdr *pseudo_header; /* Here we provide interfaces to make our scanner act and look like lex */ +WS_DLL_LOCAL int ascendlex(void); +WS_DLL_LOCAL void init_parse_ascend(void); +WS_DLL_LOCAL void ascend_init_lexer(FILE_T fh); typedef enum { PARSED_RECORD, PARSED_NONRECORD, PARSE_FAILED } parse_t; +WS_DLL_LOCAL parse_t parse_ascend(FILE_T fh, guint8 *pd, struct ascend_phdr *phdr, ascend_pkthdr *hdr, gint64 *start_of_data); diff --git a/wiretap/ascendtext.h b/wiretap/ascendtext.h index 1e75a230be..e54a86ffb5 100644 --- a/wiretap/ascendtext.h +++ b/wiretap/ascendtext.h @@ -29,6 +29,7 @@ #define ASCEND_MAX_DATA_COLS 16 #define ASCEND_MAX_PKT_LEN (ASCEND_MAX_DATA_ROWS * ASCEND_MAX_DATA_COLS) +WS_DLL_LOCAL int ascend_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/atm.h b/wiretap/atm.h index d6a6a0ca8a..9afc109b5e 100644 --- a/wiretap/atm.h +++ b/wiretap/atm.h @@ -23,6 +23,7 @@ #ifndef __ATM_H__ #define __ATM_H__ #include +#include "ws_symbol_export.h" /* * Routines to use with ATM capture file types that don't include information @@ -30,10 +31,12 @@ * that information). */ +WS_DLL_LOCAL extern void atm_guess_traffic_type(const guint8 *pd, guint32 len, union wtap_pseudo_header *pseudo_header); +WS_DLL_LOCAL extern void atm_guess_lane_type(const guint8 *pd, guint32 len, union wtap_pseudo_header *pseudo_header); diff --git a/wiretap/ber.h b/wiretap/ber.h index 5d1469ddcc..c920317da1 100644 --- a/wiretap/ber.h +++ b/wiretap/ber.h @@ -23,7 +23,9 @@ #ifndef __BER_H__ #define __BER_H__ #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int ber_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/btsnoop.h b/wiretap/btsnoop.h index 86fe2a5f37..a3d032d436 100644 --- a/wiretap/btsnoop.h +++ b/wiretap/btsnoop.h @@ -23,10 +23,15 @@ #ifndef __W_BTSNOOP_H__ #define __W_BTSNOOP_H__ #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int btsnoop_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean btsnoop_dump_open_h1(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL gboolean btsnoop_dump_open_h4(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int btsnoop_dump_can_write_encap(int encap); #endif diff --git a/wiretap/buffer.h b/wiretap/buffer.h index e9326e36be..17265e1b6b 100644 --- a/wiretap/buffer.h +++ b/wiretap/buffer.h @@ -23,7 +23,9 @@ #ifndef __W_BUFFER_H__ #define __W_BUFFER_H__ + #include +#include "ws_symbol_export.h" #define SOME_FUNCTIONS_ARE_DEFINES @@ -34,10 +36,15 @@ typedef struct Buffer { gsize first_free; } Buffer; +WS_DLL_PUBLIC void buffer_init(Buffer* buffer, gsize space); +WS_DLL_PUBLIC void buffer_free(Buffer* buffer); +WS_DLL_PUBLIC void buffer_assure_space(Buffer* buffer, gsize space); +WS_DLL_PUBLIC void buffer_append(Buffer* buffer, guint8 *from, gsize bytes); +WS_DLL_PUBLIC void buffer_remove_start(Buffer* buffer, gsize bytes); #ifdef SOME_FUNCTIONS_ARE_DEFINES diff --git a/wiretap/catapult_dct2000.h b/wiretap/catapult_dct2000.h index 494203d500..9de081f0ca 100644 --- a/wiretap/catapult_dct2000.h +++ b/wiretap/catapult_dct2000.h @@ -24,8 +24,13 @@ #define __W_CAT_DCT2K_H__ #include +#include "ws_symbol_export.h" + +WS_DLL_LOCAL int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean catapult_dct2000_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int catapult_dct2000_dump_can_write_encap(int encap); #define DCT2000_ENCAP_UNHANDLED 0 diff --git a/wiretap/commview.h b/wiretap/commview.h index b0b7a80333..3385f32569 100644 --- a/wiretap/commview.h +++ b/wiretap/commview.h @@ -25,9 +25,13 @@ #ifndef __COMMVIEW_H__ #define __COMMVIEW_H__ #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int commview_open(wtap *wth, int *err, gchar **err_info _U_); +WS_DLL_LOCAL int commview_dump_can_write_encap(int encap); +WS_DLL_LOCAL gboolean commview_dump_open(wtap_dumper *wdh, int *err); #endif /* __COMMVIEW_H__ */ diff --git a/wiretap/cosine.h b/wiretap/cosine.h index e1ddbba36c..54b886bd6f 100644 --- a/wiretap/cosine.h +++ b/wiretap/cosine.h @@ -28,7 +28,9 @@ #define __W_COSINE_H__ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int cosine_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/csids.h b/wiretap/csids.h index 9b4ff71dff..cbb0b17a98 100644 --- a/wiretap/csids.h +++ b/wiretap/csids.h @@ -25,7 +25,9 @@ #define __CSIDS_H__ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int csids_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/daintree-sna.h b/wiretap/daintree-sna.h index d47384a9e6..f10d53def7 100644 --- a/wiretap/daintree-sna.h +++ b/wiretap/daintree-sna.h @@ -27,7 +27,9 @@ #define __DAINTREE_SNA_H__ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int daintree_sna_open(wtap *wth, int *err, gchar **err_info _U_); #endif /* __DAINTREE_SNA_H__ */ diff --git a/wiretap/dbs-etherwatch.h b/wiretap/dbs-etherwatch.h index 06c118dfb9..3fc60fa0f9 100644 --- a/wiretap/dbs-etherwatch.h +++ b/wiretap/dbs-etherwatch.h @@ -25,7 +25,9 @@ #define __W_DBS_ETHERWATCH_H__ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/dct3trace.h b/wiretap/dct3trace.h index ef2b123bc0..2c23c96cac 100644 --- a/wiretap/dct3trace.h +++ b/wiretap/dct3trace.h @@ -24,7 +24,9 @@ #define __W_DCT3TRACE_H__ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int dct3trace_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/erf.h b/wiretap/erf.h index 012afba575..a666796e2b 100644 --- a/wiretap/erf.h +++ b/wiretap/erf.h @@ -40,6 +40,7 @@ #include #include +#include "ws_symbol_export.h" /* Record type defines */ #define ERF_TYPE_LEGACY 0 @@ -104,10 +105,14 @@ union erf_subhdr { #define RECORDS_FOR_ERF_CHECK 20 #define FCS_BITS 32 +WS_DLL_LOCAL int erf_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL int erf_dump_can_write_encap(int encap); +WS_DLL_LOCAL int erf_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int erf_populate_interfaces(wtap *wth); #endif /* __W_ERF_H__ */ diff --git a/wiretap/eyesdn.h b/wiretap/eyesdn.h index 4874c26328..46cee9e53c 100644 --- a/wiretap/eyesdn.h +++ b/wiretap/eyesdn.h @@ -26,7 +26,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int eyesdn_open(wtap *wth, int *err, gchar **err_info); enum EyeSDN_TYPES { @@ -41,7 +43,9 @@ enum EyeSDN_TYPES { EYESDN_ENCAP_V5_EF }; +WS_DLL_LOCAL gboolean eyesdn_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int eyesdn_dump_can_write_encap(int encap); #endif diff --git a/wiretap/file_wrappers.h b/wiretap/file_wrappers.h index fcc320599b..ca02fbbab5 100644 --- a/wiretap/file_wrappers.h +++ b/wiretap/file_wrappers.h @@ -26,34 +26,59 @@ #include #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL extern FILE_T file_open(const char *path); +WS_DLL_LOCAL extern FILE_T file_fdopen(int fildes); +WS_DLL_LOCAL extern void file_set_random_access(FILE_T stream, gboolean random_flag, GPtrArray *seek); +WS_DLL_PUBLIC extern gint64 file_seek(FILE_T stream, gint64 offset, int whence, int *err); +WS_DLL_LOCAL extern gint64 file_skip(FILE_T file, gint64 delta, int *err); +WS_DLL_PUBLIC extern gint64 file_tell(FILE_T stream); +WS_DLL_LOCAL extern gint64 file_tell_raw(FILE_T stream); +WS_DLL_LOCAL extern int file_fstat(FILE_T stream, ws_statb64 *statb, int *err); +WS_DLL_LOCAL extern gboolean file_iscompressed(FILE_T stream); +WS_DLL_PUBLIC extern int file_read(void *buf, unsigned int count, FILE_T file); +WS_DLL_PUBLIC extern int file_getc(FILE_T stream); +WS_DLL_PUBLIC extern char *file_gets(char *buf, int len, FILE_T stream); +WS_DLL_PUBLIC extern int file_eof(FILE_T stream); +WS_DLL_PUBLIC extern int file_error(FILE_T fh, gchar **err_info); +WS_DLL_LOCAL extern void file_clearerr(FILE_T stream); +WS_DLL_LOCAL extern void file_fdclose(FILE_T file); +WS_DLL_LOCAL extern int file_fdreopen(FILE_T file, const char *path); +WS_DLL_LOCAL extern void file_close(FILE_T file); #ifdef HAVE_LIBZ typedef struct wtap_writer *GZWFILE_T; +WS_DLL_LOCAL extern GZWFILE_T gzwfile_open(const char *path); +WS_DLL_LOCAL extern GZWFILE_T gzwfile_fdopen(int fd); +WS_DLL_LOCAL extern guint gzwfile_write(GZWFILE_T state, const void *buf, guint len); +WS_DLL_LOCAL extern int gzwfile_flush(GZWFILE_T state); +WS_DLL_LOCAL extern int gzwfile_close(GZWFILE_T state); +WS_DLL_LOCAL extern int gzwfile_geterr(GZWFILE_T state); #endif /* HAVE_LIBZ */ diff --git a/wiretap/hcidump.h b/wiretap/hcidump.h index 2b76c3a941..2d66995999 100644 --- a/wiretap/hcidump.h +++ b/wiretap/hcidump.h @@ -25,7 +25,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int hcidump_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/i4btrace.h b/wiretap/i4btrace.h index 1ab785d559..1a8ccf4ae5 100644 --- a/wiretap/i4btrace.h +++ b/wiretap/i4btrace.h @@ -26,7 +26,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int i4btrace_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/ipfix.h b/wiretap/ipfix.h index 4374e03c33..04969599a1 100644 --- a/wiretap/ipfix.h +++ b/wiretap/ipfix.h @@ -25,7 +25,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int ipfix_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/iptrace.h b/wiretap/iptrace.h index edd376ad96..aa729e3d2b 100644 --- a/wiretap/iptrace.h +++ b/wiretap/iptrace.h @@ -27,6 +27,7 @@ #include #include +WS_DLL_LOCAL int iptrace_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/iseries.h b/wiretap/iseries.h index 35b4880a50..dc4388bc72 100644 --- a/wiretap/iseries.h +++ b/wiretap/iseries.h @@ -26,6 +26,7 @@ #include #include +WS_DLL_LOCAL int iseries_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/k12.h b/wiretap/k12.h index 01f2c552b2..0c214b9532 100644 --- a/wiretap/k12.h +++ b/wiretap/k12.h @@ -26,11 +26,17 @@ #include #include +WS_DLL_LOCAL int k12_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL int k12_dump_can_write_encap(int encap); +WS_DLL_LOCAL gboolean k12_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int k12text_open(wtap *wth, int *err, gchar **err_info _U_); +WS_DLL_LOCAL int k12text_dump_can_write_encap(int encap); +WS_DLL_LOCAL gboolean k12text_dump_open(wtap_dumper *wdh, int *err); #endif diff --git a/wiretap/lanalyzer.h b/wiretap/lanalyzer.h index f225170c9f..532e0b4d23 100644 --- a/wiretap/lanalyzer.h +++ b/wiretap/lanalyzer.h @@ -26,8 +26,11 @@ #include #include +WS_DLL_LOCAL int lanalyzer_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean lanalyzer_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int lanalyzer_dump_can_write_encap(int encap); #endif diff --git a/wiretap/libpcap.h b/wiretap/libpcap.h index 84d2bf0874..dee0122376 100644 --- a/wiretap/libpcap.h +++ b/wiretap/libpcap.h @@ -25,6 +25,7 @@ #include #include +#include "ws_symbol_export.h" /* Magic numbers in "libpcap" files. @@ -101,8 +102,11 @@ struct pcaprec_nokia_hdr { guint8 stuff[4]; /* mysterious stuff */ }; +WS_DLL_LOCAL int libpcap_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean libpcap_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int libpcap_dump_can_write_encap(int encap); #endif diff --git a/wiretap/libwiretap.vcproj b/wiretap/libwiretap.vcproj index 5149f6fb6a..f533b116e5 100644 --- a/wiretap/libwiretap.vcproj +++ b/wiretap/libwiretap.vcproj @@ -61,7 +61,7 @@ - - diff --git a/wiretap/mime_file.h b/wiretap/mime_file.h index 35b9e3a65f..2f03d80e24 100644 --- a/wiretap/mime_file.h +++ b/wiretap/mime_file.h @@ -26,6 +26,7 @@ #include #include +WS_DLL_LOCAL int mime_file_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/mp2t.h b/wiretap/mp2t.h index 0bc8dd63a6..f7f765d069 100644 --- a/wiretap/mp2t.h +++ b/wiretap/mp2t.h @@ -28,6 +28,7 @@ #include #include +WS_DLL_LOCAL int mp2t_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/mpeg.h b/wiretap/mpeg.h index 5cce7cee0a..ac86c53461 100644 --- a/wiretap/mpeg.h +++ b/wiretap/mpeg.h @@ -28,6 +28,7 @@ #include #include +WS_DLL_LOCAL int mpeg_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/netmon.h b/wiretap/netmon.h index cca5be3557..d70085a30e 100644 --- a/wiretap/netmon.h +++ b/wiretap/netmon.h @@ -26,9 +26,13 @@ #include #include +WS_DLL_LOCAL int netmon_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean netmon_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int netmon_dump_can_write_encap_1_x(int encap); +WS_DLL_LOCAL int netmon_dump_can_write_encap_2_x(int encap); #endif diff --git a/wiretap/netscaler.h b/wiretap/netscaler.h index 04eddb3397..3beee57c96 100644 --- a/wiretap/netscaler.h +++ b/wiretap/netscaler.h @@ -95,10 +95,14 @@ #define NSPR_HEADER_VERSION203 0x23 #define NSPR_HEADER_VERSION204 0x24 #define NSPR_HEADER_VERSION205 0x25 +WS_DLL_LOCAL int nstrace_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL int nstrace_10_dump_can_write_encap(int encap); +WS_DLL_LOCAL int nstrace_20_dump_can_write_encap(int encap); +WS_DLL_LOCAL gboolean nstrace_dump_open(wtap_dumper *wdh, int *err); diff --git a/wiretap/netscreen.h b/wiretap/netscreen.h index 9d6e9fe0e4..f048520c29 100644 --- a/wiretap/netscreen.h +++ b/wiretap/netscreen.h @@ -51,6 +51,7 @@ #define NETSCREEN_MAX_PACKET_LEN 65536 +WS_DLL_LOCAL int netscreen_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/nettl.h b/wiretap/nettl.h index 3e5227a91d..d03765b97a 100644 --- a/wiretap/nettl.h +++ b/wiretap/nettl.h @@ -128,8 +128,11 @@ #define NETTL_HDR_PDU_MASK 0x30000000 +WS_DLL_LOCAL int nettl_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean nettl_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int nettl_dump_can_write_encap(int encap); #endif diff --git a/wiretap/network_instruments.h b/wiretap/network_instruments.h index a89e2a63ba..4ca16400b3 100644 --- a/wiretap/network_instruments.h +++ b/wiretap/network_instruments.h @@ -25,8 +25,11 @@ #include #include +WS_DLL_LOCAL int network_instruments_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL int network_instruments_dump_can_write_encap(int encap); +WS_DLL_LOCAL gboolean network_instruments_dump_open(wtap_dumper *wdh, int *err); /* diff --git a/wiretap/netxray.h b/wiretap/netxray.h index 9225537207..36e275732c 100644 --- a/wiretap/netxray.h +++ b/wiretap/netxray.h @@ -26,10 +26,15 @@ #include #include +WS_DLL_LOCAL int netxray_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL int netxray_dump_can_write_encap_1_1(int encap); +WS_DLL_LOCAL gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int netxray_dump_can_write_encap_2_0(int encap); +WS_DLL_LOCAL gboolean netxray_dump_open_2_0(wtap_dumper *wdh, int *err); #endif diff --git a/wiretap/ngsniffer.h b/wiretap/ngsniffer.h index 5c4cd5afe9..7176270faa 100644 --- a/wiretap/ngsniffer.h +++ b/wiretap/ngsniffer.h @@ -26,8 +26,11 @@ #include #include +WS_DLL_LOCAL int ngsniffer_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean ngsniffer_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int ngsniffer_dump_can_write_encap(int encap); #endif diff --git a/wiretap/packetlogger.h b/wiretap/packetlogger.h index a150c9ecf6..a82256dd4a 100644 --- a/wiretap/packetlogger.h +++ b/wiretap/packetlogger.h @@ -29,6 +29,7 @@ #include #include +WS_DLL_LOCAL int packetlogger_open(wtap *wth, int *err, gchar **err_info _U_); #endif /* __PACKETLOGGER_H__ */ diff --git a/wiretap/pcap-common.h b/wiretap/pcap-common.h index 8fafb728c8..1753b792ca 100644 --- a/wiretap/pcap-common.h +++ b/wiretap/pcap-common.h @@ -29,18 +29,23 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap, guint packet_size, gboolean check_packet_size, struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); +WS_DLL_LOCAL extern void pcap_read_post_process(int file_type, int wtap_encap, union wtap_pseudo_header *pseudo_header, guint8 *pd, guint packet_size, gboolean bytes_swapped, int fcs_len); +WS_DLL_LOCAL extern int pcap_get_phdr_size(int encap, const union wtap_pseudo_header *pseudo_header); +WS_DLL_LOCAL extern gboolean pcap_write_phdr(wtap_dumper *wdh, int wtap_encap, const union wtap_pseudo_header *pseudo_header, int *err); diff --git a/wiretap/pcap-encap.h b/wiretap/pcap-encap.h index 6d0fa74fdd..c86cbfcb56 100644 --- a/wiretap/pcap-encap.h +++ b/wiretap/pcap-encap.h @@ -34,8 +34,11 @@ extern "C" { #endif /* __cplusplus */ +WS_DLL_PUBLIC extern int wtap_pcap_encap_to_wtap_encap(int encap); +WS_DLL_PUBLIC extern int wtap_wtap_encap_to_pcap_encap(int encap); +WS_DLL_PUBLIC extern gboolean wtap_encap_requires_phdr(int encap); #ifdef __cplusplus diff --git a/wiretap/pcapng.h b/wiretap/pcapng.h index 314ad326bd..41c46129ec 100644 --- a/wiretap/pcapng.h +++ b/wiretap/pcapng.h @@ -25,9 +25,13 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int pcapng_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean pcapng_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int pcapng_dump_can_write_encap(int encap); #endif diff --git a/wiretap/peekclassic.h b/wiretap/peekclassic.h index 99c902ee45..14121d82c5 100644 --- a/wiretap/peekclassic.h +++ b/wiretap/peekclassic.h @@ -26,7 +26,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int peekclassic_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/peektagged.h b/wiretap/peektagged.h index e73da0c0bd..ad6626434a 100644 --- a/wiretap/peektagged.h +++ b/wiretap/peektagged.h @@ -23,7 +23,9 @@ #ifndef __W_PEEKTAGGED_H__ #define __W_PEEKTAGGED_H__ #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int peektagged_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/pppdump.h b/wiretap/pppdump.h index 21fb2f127e..d89084d0cc 100644 --- a/wiretap/pppdump.h +++ b/wiretap/pppdump.h @@ -25,7 +25,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int pppdump_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/radcom.h b/wiretap/radcom.h index 1d2013e369..8d9af6460b 100644 --- a/wiretap/radcom.h +++ b/wiretap/radcom.h @@ -26,7 +26,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int radcom_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/snoop.h b/wiretap/snoop.h index c321053329..8010899661 100644 --- a/wiretap/snoop.h +++ b/wiretap/snoop.h @@ -25,9 +25,13 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int snoop_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean snoop_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int snoop_dump_can_write_encap(int encap); #endif diff --git a/wiretap/tnef.h b/wiretap/tnef.h index ca8c72bdd8..cbe5d8b18a 100644 --- a/wiretap/tnef.h +++ b/wiretap/tnef.h @@ -25,9 +25,11 @@ #include #include +#include "ws_symbol_export.h" #define TNEF_SIGNATURE 0x223E9F78 +WS_DLL_LOCAL int tnef_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/toshiba.h b/wiretap/toshiba.h index cf67bd5ead..26d1432afd 100644 --- a/wiretap/toshiba.h +++ b/wiretap/toshiba.h @@ -25,7 +25,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int toshiba_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/visual.h b/wiretap/visual.h index 324d91b47f..e15bd256ff 100644 --- a/wiretap/visual.h +++ b/wiretap/visual.h @@ -30,9 +30,13 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int visual_open(wtap *wth, int *err, gchar **err_info); +WS_DLL_LOCAL gboolean visual_dump_open(wtap_dumper *wdh, int *err); +WS_DLL_LOCAL int visual_dump_can_write_encap(int encap); #endif diff --git a/wiretap/vms.h b/wiretap/vms.h index dd9e6e4298..b4122083de 100644 --- a/wiretap/vms.h +++ b/wiretap/vms.h @@ -26,7 +26,9 @@ #include #include +#include "ws_symbol_export.h" +WS_DLL_LOCAL int vms_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/vwr.h b/wiretap/vwr.h index 82bbd7e67e..7cacc54c8c 100644 --- a/wiretap/vwr.h +++ b/wiretap/vwr.h @@ -24,6 +24,9 @@ #ifndef __VWR_H__ #define __VWR_H__ +#include "ws_symbol_export.h" + +WS_DLL_LOCAL int vwr_open(wtap *wth, int *err, gchar **err_info); #endif diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index a52b228baa..1e62df935e 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -39,6 +39,7 @@ #include "wtap.h" +WS_DLL_PUBLIC int wtap_fstat(wtap *wth, ws_statb64 *statb, int *err); typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*); @@ -112,12 +113,14 @@ struct wtap_dumper { GArray *interface_data; /**< An array holding the interface data from pcapng IDB:s or equivalent(?) NULL if not present.*/ }; -extern gboolean wtap_dump_file_write(wtap_dumper *wdh, const void *buf, +WS_DLL_LOCAL +gboolean wtap_dump_file_write(wtap_dumper *wdh, const void *buf, size_t bufsize, int *err); extern gint64 wtap_dump_file_seek(wtap_dumper *wdh, gint64 offset, int whence, int *err); extern gint64 wtap_dump_file_tell(wtap_dumper *wdh); +WS_DLL_LOCAL extern gint wtap_num_file_types; /* Macros to byte-swap 64-bit, 32-bit and 16-bit quantities. */ @@ -363,6 +366,7 @@ extern gint wtap_num_file_types; #endif /*** get GSList of all compressed file extensions ***/ +WS_DLL_LOCAL GSList *wtap_get_compressed_file_extensions(void); #endif /* __WTAP_INT_H__ */ diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 9f7fa3e3ca..dcc04716e5 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -601,6 +601,7 @@ static struct encap_type_info encap_table_base[] = { { "SCTP", "sctp" }, }; +WS_DLL_LOCAL gint wtap_num_encap_types = sizeof(encap_table_base) / sizeof(struct encap_type_info); static GArray* encap_table_arr = NULL; static const struct encap_type_info* encap_table = NULL; diff --git a/wiretap/wtap.def b/wiretap/wtap.def deleted file mode 100644 index d680b945c9..0000000000 --- a/wiretap/wtap.def +++ /dev/null @@ -1,84 +0,0 @@ -; wtap.def -; $Id$ - -; Add symbols that should be exported out of libwiretap.dll -; -; DATA symbols must be declared WS_VAR_IMPORT in the header file! -; -; NOTE: TABS DON'T WORK IN THIS FILE, USE SPACES INSTEAD!!! -; -EXPORTS - -buffer_assure_space -buffer_append -buffer_free -buffer_init -buffer_remove_start - -file_eof -file_error -file_getc -file_gets -file_seek -file_read -file_tell - -wtap_buf_ptr -wtap_cleareof -wtap_close -wtap_default_file_extension -wtap_dump -wtap_dump_can_open -wtap_dump_can_write_encap -wtap_dump_can_write_encaps -wtap_dump_can_compress -wtap_dump_close -wtap_dump_fdopen -wtap_dump_fdopen_ng -wtap_dump_file_encap_type -wtap_dump_flush -wtap_dump_open -wtap_dump_open_ng -wtap_dump_set_addrinfo_list -wtap_encap_requires_phdr -wtap_encap_short_string -wtap_encap_string -wtap_fdclose -wtap_fdreopen -wtap_file_encap -wtap_get_savable_file_types -wtap_get_file_extensions_list -wtap_free_file_extensions_list -wtap_file_get_idb_info -wtap_file_get_shb_info -wtap_file_size -wtap_file_tsprecision -wtap_file_type -wtap_file_type_short_string -wtap_file_type_string -wtap_fstat -wtap_get_bytes_dumped -wtap_get_num_encap_types -wtap_get_num_file_types -wtap_iscompressed -wtap_open_offline -wtap_pcap_encap_to_wtap_encap -wtap_phdr -wtap_read -wtap_read_so_far -wtap_register_encap_type -wtap_register_file_type -wtap_register_open_routine -wtap_seek_read -wtap_sequential_close -wtap_set_bytes_dumped -wtap_set_cb_new_ipv4 -wtap_set_cb_new_ipv6 -wtap_short_string_to_encap -wtap_short_string_to_file_type -wtap_snapshot_length -wtap_strerror -wtap_write_shb_comment -wtap_wtap_encap_to_pcap_encap - - diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 0990a2dff3..fc28b740dc 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -29,6 +29,7 @@ #include #include +#include "ws_symbol_export.h" #ifdef __cplusplus extern "C" { @@ -1052,6 +1053,7 @@ typedef int (*wtap_open_routine_t)(struct wtap*, int *, char **); * @param do_random TRUE if random access to the file will be done, * FALSE if not */ +WS_DLL_PUBLIC struct wtap* wtap_open_offline(const char *filename, int *err, gchar **err_info, gboolean do_random); @@ -1060,6 +1062,7 @@ struct wtap* wtap_open_offline(const char *filename, int *err, * wtap_read/gzread has a chance to succeed. This is necessary if * we're tailing a file. */ +WS_DLL_PUBLIC void wtap_cleareof(wtap *wth); /** @@ -1067,88 +1070,124 @@ void wtap_cleareof(wtap *wth); * MUST match add_ipv4_name and add_ipv6_name in addr_resolv.c. */ typedef void (*wtap_new_ipv4_callback_t) (const guint addr, const gchar *name); +WS_DLL_PUBLIC void wtap_set_cb_new_ipv4(wtap *wth, wtap_new_ipv4_callback_t add_new_ipv4); typedef void (*wtap_new_ipv6_callback_t) (const void *addrp, const gchar *name); +WS_DLL_PUBLIC void wtap_set_cb_new_ipv6(wtap *wth, wtap_new_ipv6_callback_t add_new_ipv6); /** Returns TRUE if read was successful. FALSE if failure. data_offset is * set to the offset in the file where the data for the read packet is * located. */ +WS_DLL_PUBLIC gboolean wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset); +WS_DLL_PUBLIC gboolean wtap_seek_read (wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, guint8 *pd, int len, int *err, gchar **err_info); /*** get various information snippets about the current packet ***/ +WS_DLL_PUBLIC struct wtap_pkthdr *wtap_phdr(wtap *wth); +WS_DLL_PUBLIC guint8 *wtap_buf_ptr(wtap *wth); /*** get various information snippets about the current file ***/ /** Return an approximation of the amount of data we've read sequentially * from the file so far. */ +WS_DLL_PUBLIC gint64 wtap_read_so_far(wtap *wth); +WS_DLL_PUBLIC gint64 wtap_file_size(wtap *wth, int *err); +WS_DLL_PUBLIC gboolean wtap_iscompressed(wtap *wth); +WS_DLL_PUBLIC guint wtap_snapshot_length(wtap *wth); /* per file */ +WS_DLL_PUBLIC int wtap_file_type(wtap *wth); +WS_DLL_PUBLIC int wtap_file_encap(wtap *wth); +WS_DLL_PUBLIC int wtap_file_tsprecision(wtap *wth); +WS_DLL_PUBLIC wtapng_section_t* wtap_file_get_shb_info(wtap *wth); +WS_DLL_PUBLIC wtapng_iface_descriptions_t *wtap_file_get_idb_info(wtap *wth); +WS_DLL_PUBLIC void wtap_write_shb_comment(wtap *wth, gchar *comment); /*** close the file descriptors for the current file ***/ +WS_DLL_PUBLIC void wtap_fdclose(wtap *wth); /*** reopen the random file descriptor for the current file ***/ +WS_DLL_PUBLIC gboolean wtap_fdreopen(wtap *wth, const char *filename, int *err); /*** close the current file ***/ +WS_DLL_PUBLIC void wtap_sequential_close(wtap *wth); +WS_DLL_PUBLIC void wtap_close(wtap *wth); /*** dump packets into a capture file ***/ +WS_DLL_PUBLIC gboolean wtap_dump_can_open(int filetype); +WS_DLL_PUBLIC gboolean wtap_dump_can_write_encap(int filetype, int encap); /** * Given a GArray of WTAP_ENCAP_ types, return the per-file encapsulation * type that would be needed to write out a file with those types. */ +WS_DLL_PUBLIC int wtap_dump_file_encap_type(const GArray *file_encaps); /** * Return TRUE if a capture with a given GArray of WTAP_ENCAP_ types * can be written in a specified format, and FALSE if it can't. */ +WS_DLL_PUBLIC gboolean wtap_dump_can_write_encaps(int ft, const GArray *file_encaps); +WS_DLL_PUBLIC gboolean wtap_dump_can_compress(int filetype); +WS_DLL_LOCAL gboolean wtap_dump_has_name_resolution(int filetype); +WS_DLL_PUBLIC wtap_dumper* wtap_dump_open(const char *filename, int filetype, int encap, int snaplen, gboolean compressed, int *err); +WS_DLL_PUBLIC wtap_dumper* wtap_dump_open_ng(const char *filename, int filetype, int encap, int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err); +WS_DLL_PUBLIC wtap_dumper* wtap_dump_fdopen(int fd, int filetype, int encap, int snaplen, gboolean compressed, int *err); +WS_DLL_PUBLIC wtap_dumper* wtap_dump_fdopen_ng(int fd, int filetype, int encap, int snaplen, gboolean compressed, wtapng_section_t *shb_hdr, wtapng_iface_descriptions_t *idb_inf, int *err); +WS_DLL_PUBLIC gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *, const guint8 *, int *err); +WS_DLL_PUBLIC void wtap_dump_flush(wtap_dumper *); +WS_DLL_PUBLIC gint64 wtap_get_bytes_dumped(wtap_dumper *); +WS_DLL_PUBLIC void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped); struct addrinfo; +WS_DLL_PUBLIC gboolean wtap_dump_set_addrinfo_list(wtap_dumper *wdh, struct addrinfo *addrinfo_list); +WS_DLL_PUBLIC gboolean wtap_dump_close(wtap_dumper *, int *); /** @@ -1156,31 +1195,47 @@ gboolean wtap_dump_close(wtap_dumper *, int *); * to save a file of a given type with a given GArray of WTAP_ENCAP_ * types. */ +WS_DLL_PUBLIC GArray *wtap_get_savable_file_types(int file_type, const GArray *file_encaps); /*** various string converter functions ***/ +WS_DLL_PUBLIC const char *wtap_file_type_string(int filetype); +WS_DLL_PUBLIC const char *wtap_file_type_short_string(int filetype); +WS_DLL_PUBLIC int wtap_short_string_to_file_type(const char *short_name); /*** various file extension functions ***/ +WS_DLL_PUBLIC const char *wtap_default_file_extension(int filetype); +WS_DLL_PUBLIC GSList *wtap_get_file_extensions_list(int filetype, gboolean include_compressed); +WS_DLL_PUBLIC void wtap_free_file_extensions_list(GSList *extensions); +WS_DLL_PUBLIC const char *wtap_encap_string(int encap); +WS_DLL_PUBLIC const char *wtap_encap_short_string(int encap); +WS_DLL_PUBLIC int wtap_short_string_to_encap(const char *short_name); +WS_DLL_PUBLIC const char *wtap_strerror(int err); /*** get available number of file types and encapsulations ***/ +WS_DLL_PUBLIC int wtap_get_num_encap_types(void); +WS_DLL_PUBLIC int wtap_get_num_file_types(void); /*** dynamically register new file types and encapsulations ***/ +WS_DLL_PUBLIC void wtap_register_open_routine(wtap_open_routine_t, gboolean has_magic); +WS_DLL_PUBLIC int wtap_register_file_type(const struct file_type_info* fi); +WS_DLL_PUBLIC int wtap_register_encap_type(const char* name, const char* short_name);