aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filetap/CMakeLists.txt1
-rw-r--r--filetap/Makefile.common2
-rw-r--r--filetap/file_access.c2
-rw-r--r--filetap/ftap.c2
-rw-r--r--filetap/ftap.h2
-rw-r--r--wiretap/5views.c2
-rw-r--r--wiretap/CMakeLists.txt1
-rw-r--r--wiretap/Makefile.common2
-rw-r--r--wiretap/aethra.c2
-rw-r--r--wiretap/ascend.y2
-rw-r--r--wiretap/ascendtext.c2
-rw-r--r--wiretap/ber.c2
-rw-r--r--wiretap/btsnoop.c2
-rw-r--r--wiretap/buffer.c162
-rw-r--r--wiretap/buffer.h72
-rw-r--r--wiretap/camins.c2
-rw-r--r--wiretap/catapult_dct2000.c2
-rw-r--r--wiretap/commview.c2
-rw-r--r--wiretap/cosine.c2
-rw-r--r--wiretap/csids.c2
-rw-r--r--wiretap/daintree-sna.c2
-rw-r--r--wiretap/dbs-etherwatch.c2
-rw-r--r--wiretap/dct3trace.c2
-rw-r--r--wiretap/erf.c2
-rw-r--r--wiretap/eyesdn.c2
-rw-r--r--wiretap/file_access.c2
-rw-r--r--wiretap/hcidump.c2
-rw-r--r--wiretap/i4btrace.c2
-rw-r--r--wiretap/ipfix.c2
-rw-r--r--wiretap/iptrace.c2
-rw-r--r--wiretap/iseries.c2
-rw-r--r--wiretap/k12.c2
-rw-r--r--wiretap/k12text.l2
-rw-r--r--wiretap/lanalyzer.c2
-rw-r--r--wiretap/libpcap.c2
-rw-r--r--wiretap/logcat.c2
-rw-r--r--wiretap/mime_file.c2
-rw-r--r--wiretap/mp2t.c2
-rw-r--r--wiretap/mpeg.c2
-rw-r--r--wiretap/netmon.c2
-rw-r--r--wiretap/netscaler.c2
-rw-r--r--wiretap/netscreen.c2
-rw-r--r--wiretap/nettl.c2
-rw-r--r--wiretap/network_instruments.c2
-rw-r--r--wiretap/netxray.c2
-rw-r--r--wiretap/ngsniffer.c2
-rw-r--r--wiretap/packetlogger.c2
-rw-r--r--wiretap/pcapng.c2
-rw-r--r--wiretap/peekclassic.c2
-rw-r--r--wiretap/peektagged.c2
-rw-r--r--wiretap/pppdump.c2
-rw-r--r--wiretap/radcom.c2
-rw-r--r--wiretap/snoop.c2
-rw-r--r--wiretap/stanag4607.c2
-rw-r--r--wiretap/tnef.c2
-rw-r--r--wiretap/toshiba.c2
-rw-r--r--wiretap/visual.c2
-rw-r--r--wiretap/vms.c2
-rw-r--r--wiretap/vwr.c2
-rw-r--r--wiretap/wtap.c2
-rw-r--r--wiretap/wtap.h2
-rw-r--r--wsutil/CMakeLists.txt1
-rw-r--r--wsutil/Makefile.common2
-rw-r--r--wsutil/buffer.c (renamed from filetap/buffer.c)0
-rw-r--r--wsutil/buffer.h (renamed from filetap/buffer.h)0
65 files changed, 58 insertions, 295 deletions
diff --git a/filetap/CMakeLists.txt b/filetap/CMakeLists.txt
index 8c3578c3b0..98ffcad866 100644
--- a/filetap/CMakeLists.txt
+++ b/filetap/CMakeLists.txt
@@ -22,7 +22,6 @@
include(UseABICheck)
set(CLEAN_FILES
- buffer.c
file_access.c
ft_file_wrappers.c
ftap.c
diff --git a/filetap/Makefile.common b/filetap/Makefile.common
index 50a65c8761..30e684a4cc 100644
--- a/filetap/Makefile.common
+++ b/filetap/Makefile.common
@@ -27,14 +27,12 @@
# generated from YACC or Lex files (as Automake doesn't want them in
# _SOURCES variables).
NONGENERATED_C_FILES = \
- buffer.c \
file_access.c \
ft_file_wrappers.c \
ftap.c
# Header files that are not generated from other files
NONGENERATED_HEADER_FILES = \
- buffer.h \
ft_file_wrappers.h \
ftap.h \
ftap-int.h
diff --git a/filetap/file_access.c b/filetap/file_access.c
index e82905f840..d3bf37fc40 100644
--- a/filetap/file_access.c
+++ b/filetap/file_access.c
@@ -38,7 +38,7 @@
#include "ftap-int.h"
#include "ft_file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
/*
* Add an extension, and all compressed versions thereof, to a GSList
diff --git a/filetap/ftap.c b/filetap/ftap.c
index 0a8c6fa66f..11d79b904d 100644
--- a/filetap/ftap.c
+++ b/filetap/ftap.c
@@ -39,7 +39,7 @@
#include "ft_file_wrappers.h"
#include <wsutil/file_util.h>
-#include "buffer.h"
+#include <wsutil/buffer.h>
#ifdef HAVE_PLUGINS
diff --git a/filetap/ftap.h b/filetap/ftap.h
index 85839e0b6b..c31f7d3225 100644
--- a/filetap/ftap.h
+++ b/filetap/ftap.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include <time.h>
-#include <filetap/buffer.h>
+#include <wsutil/buffer.h>
#include <wsutil/nstime.h>
#include "ws_symbol_export.h"
diff --git a/wiretap/5views.c b/wiretap/5views.c
index c7440bd3f6..4db2d69d59 100644
--- a/wiretap/5views.c
+++ b/wiretap/5views.c
@@ -25,7 +25,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "5views.h"
diff --git a/wiretap/CMakeLists.txt b/wiretap/CMakeLists.txt
index 0bdb91fc28..319e64a72f 100644
--- a/wiretap/CMakeLists.txt
+++ b/wiretap/CMakeLists.txt
@@ -28,7 +28,6 @@ set(CLEAN_FILES
atm.c
ber.c
btsnoop.c
- buffer.c
camins.c
catapult_dct2000.c
commview.c
diff --git a/wiretap/Makefile.common b/wiretap/Makefile.common
index e7ddddcea3..e36949bbbd 100644
--- a/wiretap/Makefile.common
+++ b/wiretap/Makefile.common
@@ -33,7 +33,6 @@ NONGENERATED_C_FILES = \
atm.c \
ber.c \
btsnoop.c \
- buffer.c \
camins.c \
catapult_dct2000.c \
commview.c \
@@ -90,7 +89,6 @@ NONGENERATED_HEADER_FILES = \
ascend-int.h \
atm.h \
ber.h \
- buffer.h \
btsnoop.h \
camins.h \
catapult_dct2000.h \
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
index 59fbcd55e7..2a91970fad 100644
--- a/wiretap/aethra.c
+++ b/wiretap/aethra.c
@@ -23,7 +23,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "aethra.h"
/* Magic number in Aethra PC108 files. */
diff --git a/wiretap/ascend.y b/wiretap/ascend.y
index b26222e43b..3ba2deae6b 100644
--- a/wiretap/ascend.y
+++ b/wiretap/ascend.y
@@ -133,7 +133,7 @@ XMIT-Max7:20: (task "_brouterControlTask" at 0xb094ac20, time: 1481.51) 20 octet
#include <string.h>
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "ascendtext.h"
#include "ascend-int.h"
#include "file_wrappers.h"
diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c
index 32d4d49418..1e6f4fbbf8 100644
--- a/wiretap/ascendtext.c
+++ b/wiretap/ascendtext.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "ascendtext.h"
#include "ascend-int.h"
#include "file_wrappers.h"
diff --git a/wiretap/ber.c b/wiretap/ber.c
index 8e52e79b06..4d015097ba 100644
--- a/wiretap/ber.c
+++ b/wiretap/ber.c
@@ -27,7 +27,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "ber.h"
diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c
index 9ea165ad4c..6d3e75a2c6 100644
--- a/wiretap/btsnoop.c
+++ b/wiretap/btsnoop.c
@@ -23,7 +23,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
#include "btsnoop.h"
diff --git a/wiretap/buffer.c b/wiretap/buffer.c
deleted file mode 100644
index e12c8de5f6..0000000000
--- a/wiretap/buffer.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* buffer.c
- *
- * Wiretap Library
- * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
- *
- * 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.
- *
- */
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-
-#include "buffer.h"
-
-/* Initializes a buffer with a certain amount of allocated space */
-void
-buffer_init(Buffer* buffer, gsize space)
-{
- buffer->data = (guint8*)g_malloc(space);
- buffer->allocated = space;
- buffer->start = 0;
- buffer->first_free = 0;
-}
-
-/* Frees the memory used by a buffer */
-void
-buffer_free(Buffer* buffer)
-{
- g_free(buffer->data);
- buffer->data = NULL;
-}
-
-/* Assures that there are 'space' bytes at the end of the used space
- so that another routine can copy directly into the buffer space. After
- doing that, the routine will also want to run
- buffer_increase_length(). */
-void
-buffer_assure_space(Buffer* buffer, gsize space)
-{
- gsize available_at_end = buffer->allocated - buffer->first_free;
- gsize space_used;
- gboolean space_at_beginning;
-
- /* If we've got the space already, good! */
- if (space <= available_at_end) {
- return;
- }
-
- /* Maybe we don't have the space available at the end, but we would
- if we moved the used space back to the beginning of the
- allocation. The buffer could have become fragmented through lots
- of calls to buffer_remove_start(). I'm using buffer->start as the
- same as 'available_at_start' in this comparison. */
-
- /* or maybe there's just no more room. */
-
- space_at_beginning = buffer->start >= space;
- if (space_at_beginning || buffer->start > 0) {
- space_used = buffer->first_free - buffer->start;
- /* this memory copy better be safe for overlapping memory regions! */
- memmove(buffer->data, buffer->data + buffer->start, space_used);
- buffer->start = 0;
- buffer->first_free = space_used;
- }
- /*if (buffer->start >= space) {*/
- if (space_at_beginning) {
- return;
- }
-
- /* We'll allocate more space */
- buffer->allocated += space + 1024;
- buffer->data = (guint8*)g_realloc(buffer->data, buffer->allocated);
-}
-
-void
-buffer_append(Buffer* buffer, guint8 *from, gsize bytes)
-{
- buffer_assure_space(buffer, bytes);
- memcpy(buffer->data + buffer->first_free, from, bytes);
- buffer->first_free += bytes;
-}
-
-void
-buffer_remove_start(Buffer* buffer, gsize bytes)
-{
- if (buffer->start + bytes > buffer->first_free) {
- g_error("buffer_remove_start trying to remove %" G_GINT64_MODIFIER "u bytes. s=%" G_GINT64_MODIFIER "u ff=%" G_GINT64_MODIFIER "u!\n",
- (guint64)bytes, (guint64)buffer->start,
- (guint64)buffer->first_free);
- /** g_error() does an abort() and thus never returns **/
- }
- buffer->start += bytes;
-
- if (buffer->start == buffer->first_free) {
- buffer->start = 0;
- buffer->first_free = 0;
- }
-}
-
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-void
-buffer_clean(Buffer* buffer)
-{
- buffer_remove_start(buffer, buffer_length(buffer));
-}
-#endif
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-void
-buffer_increase_length(Buffer* buffer, gsize bytes)
-{
- buffer->first_free += bytes;
-}
-#endif
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-gsize
-buffer_length(Buffer* buffer)
-{
- return buffer->first_free - buffer->start;
-}
-#endif
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-guint8 *
-buffer_start_ptr(Buffer* buffer)
-{
- return buffer->data + buffer->start;
-}
-#endif
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-guint8 *
-buffer_end_ptr(Buffer* buffer)
-{
- return buffer->data + buffer->first_free;
-}
-#endif
-
-#ifndef SOME_FUNCTIONS_ARE_DEFINES
-void
-buffer_append_buffer(Buffer* buffer, Buffer* src_buffer)
-{
- buffer_append(buffer, buffer_start_ptr(src_buffer), buffer_length(src_buffer));
-}
-#endif
diff --git a/wiretap/buffer.h b/wiretap/buffer.h
deleted file mode 100644
index 774dcdddb6..0000000000
--- a/wiretap/buffer.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* buffer.h
- *
- * Wiretap Library
- * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
- *
- * 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 __W_BUFFER_H__
-#define __W_BUFFER_H__
-
-#include <glib.h>
-#include "ws_symbol_export.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define SOME_FUNCTIONS_ARE_DEFINES
-
-typedef struct Buffer {
- guint8 *data;
- gsize allocated;
- gsize start;
- 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
-# define buffer_clean(buffer) buffer_remove_start((buffer), buffer_length(buffer))
-# define buffer_increase_length(buffer,bytes) (buffer)->first_free += (bytes)
-# define buffer_length(buffer) ((buffer)->first_free - (buffer)->start)
-# define buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start)
-# define buffer_end_ptr(buffer) ((buffer)->data + (buffer)->first_free)
-# define buffer_append_buffer(buffer,src_buffer) buffer_append((buffer), buffer_start_ptr(src_buffer), buffer_length(src_buffer))
-#else
- void buffer_clean(Buffer* buffer);
- void buffer_increase_length(Buffer* buffer, unsigned int bytes);
- unsigned int buffer_length(Buffer* buffer);
- guint8* buffer_start_ptr(Buffer* buffer);
- guint8* buffer_end_ptr(Buffer* buffer);
- void buffer_append_buffer(Buffer* buffer, Buffer* src_buffer);
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/wiretap/camins.c b/wiretap/camins.c
index f065f0bd1d..333eca16d8 100644
--- a/wiretap/camins.c
+++ b/wiretap/camins.c
@@ -64,7 +64,7 @@
#include <wtap.h>
#include <wtap-int.h>
#include <file_wrappers.h>
-#include <buffer.h>
+#include <wsutil/buffer.h>
#include "camins.h"
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c
index 63a261fe01..72a9fabd8a 100644
--- a/wiretap/catapult_dct2000.c
+++ b/wiretap/catapult_dct2000.c
@@ -26,7 +26,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "catapult_dct2000.h"
diff --git a/wiretap/commview.c b/wiretap/commview.c
index b9ad83bfd0..5a5f881a77 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -38,7 +38,7 @@
#include "wtap.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "file_wrappers.h"
#include "commview.h"
diff --git a/wiretap/cosine.c b/wiretap/cosine.c
index a583e766b0..4b87d53578 100644
--- a/wiretap/cosine.c
+++ b/wiretap/cosine.c
@@ -23,7 +23,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "cosine.h"
#include "file_wrappers.h"
diff --git a/wiretap/csids.c b/wiretap/csids.c
index bdfe8fcd34..94632c0e5d 100644
--- a/wiretap/csids.c
+++ b/wiretap/csids.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "csids.h"
#include "file_wrappers.h"
diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c
index ea47993d5f..7379aa8688 100644
--- a/wiretap/daintree-sna.c
+++ b/wiretap/daintree-sna.c
@@ -55,7 +55,7 @@
#include "wtap.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "file_wrappers.h"
#include "daintree-sna.h"
diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c
index 2fb4bc873a..99f0df529c 100644
--- a/wiretap/dbs-etherwatch.c
+++ b/wiretap/dbs-etherwatch.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "dbs-etherwatch.h"
#include "file_wrappers.h"
diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c
index b1bc62050b..7e02c16e98 100644
--- a/wiretap/dct3trace.c
+++ b/wiretap/dct3trace.c
@@ -26,7 +26,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "dct3trace.h"
#include "file_wrappers.h"
diff --git a/wiretap/erf.c b/wiretap/erf.c
index 5800c81650..0d47ee0f56 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -52,7 +52,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "pcap-encap.h"
#include "atm.h"
#include "erf.h"
diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c
index 399c02d5b2..f9d7aea66e 100644
--- a/wiretap/eyesdn.c
+++ b/wiretap/eyesdn.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "eyesdn.h"
#include "file_wrappers.h"
diff --git a/wiretap/file_access.c b/wiretap/file_access.c
index 2eb514302a..f320ffa236 100644
--- a/wiretap/file_access.c
+++ b/wiretap/file_access.c
@@ -38,7 +38,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "lanalyzer.h"
#include "ngsniffer.h"
#include "radcom.h"
diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c
index 2253134a05..f2353be970 100644
--- a/wiretap/hcidump.c
+++ b/wiretap/hcidump.c
@@ -21,7 +21,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "hcidump.h"
struct dump_hdr {
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index e6952c51ff..f4fea01fb0 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -25,7 +25,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "i4b_trace.h"
#include "i4btrace.h"
diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c
index 54fb229e86..8229255cb2 100644
--- a/wiretap/ipfix.c
+++ b/wiretap/ipfix.c
@@ -65,7 +65,7 @@
#include <errno.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "libpcap.h"
#include "pcap-common.h"
#include "pcap-encap.h"
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index c7fa0249a7..e5192e9981 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -24,7 +24,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
#include "iptrace.h"
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index 62ee92b8dd..f0c32f255e 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -150,7 +150,7 @@ Number S/R Length Timer MAC Address MAC Address
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "iseries.h"
#include "file_wrappers.h"
diff --git a/wiretap/k12.c b/wiretap/k12.c
index 3bd3d3f533..1e8ad078d8 100644
--- a/wiretap/k12.c
+++ b/wiretap/k12.c
@@ -31,7 +31,7 @@
#include "wtap-int.h"
#include "wtap.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "k12.h"
#include <wsutil/str_util.h>
diff --git a/wiretap/k12text.l b/wiretap/k12text.l
index fd332f2739..0174954da1 100644
--- a/wiretap/k12text.l
+++ b/wiretap/k12text.l
@@ -75,7 +75,7 @@
#include "wtap-int.h"
#include "wtap.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "k12.h"
#include "k12text_lex.h"
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index d00691beac..9fea6b34ea 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -23,7 +23,7 @@
#include <errno.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "lanalyzer.h"
/* The LANalyzer format is documented (at least in part) in Novell document
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index 83ff0886d9..727e48eddd 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -25,7 +25,7 @@
#include <errno.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "pcap-common.h"
#include "pcap-encap.h"
#include "libpcap.h"
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index 65dc070859..e937d6b700 100644
--- a/wiretap/logcat.c
+++ b/wiretap/logcat.c
@@ -24,7 +24,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "logcat.h"
diff --git a/wiretap/mime_file.c b/wiretap/mime_file.c
index 52c04ccc69..e89f16dea6 100644
--- a/wiretap/mime_file.c
+++ b/wiretap/mime_file.c
@@ -44,7 +44,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "mime_file.h"
typedef struct {
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
index 103d6fe298..9ea24a2b36 100644
--- a/wiretap/mp2t.c
+++ b/wiretap/mp2t.c
@@ -33,7 +33,7 @@
#include "mp2t.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "file_wrappers.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c
index b8d867754c..92cdc80b20 100644
--- a/wiretap/mpeg.c
+++ b/wiretap/mpeg.c
@@ -34,7 +34,7 @@
#include "wsutil/mpeg-audio.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "file_wrappers.h"
#include <errno.h>
#include <stdlib.h>
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 6dcd40a5cc..23c1aa3c40 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -23,7 +23,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
#include "pcap-encap.h"
#include "netmon.h"
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
index e6df1d1081..edc1eea34e 100644
--- a/wiretap/netscaler.c
+++ b/wiretap/netscaler.c
@@ -23,7 +23,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "netscaler.h"
/* Defines imported from netscaler code: nsperfrc.h */
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c
index 0d07d14c5e..42918b1475 100644
--- a/wiretap/netscreen.c
+++ b/wiretap/netscreen.c
@@ -24,7 +24,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "netscreen.h"
#include "file_wrappers.h"
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 8727db106a..f93b92baf0 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -28,7 +28,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "nettl.h"
/* HP nettl file header */
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
index 5e95e1826e..fb571a041f 100644
--- a/wiretap/network_instruments.c
+++ b/wiretap/network_instruments.c
@@ -22,7 +22,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "network_instruments.h"
static const char network_instruments_magic[] = {"ObserverPktBufferVersion=15.00"};
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 1a7465453d..49e810ad61 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -25,7 +25,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
#include "netxray.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
/* Capture file header, *including* magic number, is padded to 128 bytes. */
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index dd341413b9..2bfdd1f2da 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -58,7 +58,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
#include "ngsniffer.h"
diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c
index 1941e981d8..51954f87ee 100644
--- a/wiretap/packetlogger.c
+++ b/wiretap/packetlogger.c
@@ -35,7 +35,7 @@
#include "wtap.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "file_wrappers.h"
#include "packetlogger.h"
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index a0bec4c838..45f1ad3156 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -37,7 +37,7 @@
#include "wtap-int.h"
#include <epan/addr_resolv.h>
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "libpcap.h"
#include "pcap-common.h"
#include "pcap-encap.h"
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index 4bde81adde..db6a97b2fd 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -38,7 +38,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "peekclassic.h"
/* CREDITS
*
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index ae3881ed90..3084ebf353 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -36,7 +36,7 @@
#include <stdlib.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "peektagged.h"
/* CREDITS
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index c22b70a682..300e2ae649 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -19,7 +19,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "pppdump.h"
#include "file_wrappers.h"
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 96842d00bd..1c67c24ddb 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -24,7 +24,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "radcom.h"
struct frame_date {
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index c6991d064c..e5f831f3d8 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -23,7 +23,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "atm.h"
#include "snoop.h"
/* See RFC 1761 for a description of the "snoop" file format. */
diff --git a/wiretap/stanag4607.c b/wiretap/stanag4607.c
index 369bb31654..c3703cc7ff 100644
--- a/wiretap/stanag4607.c
+++ b/wiretap/stanag4607.c
@@ -30,7 +30,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "stanag4607.h"
typedef struct {
diff --git a/wiretap/tnef.c b/wiretap/tnef.c
index b7e834eaaa..aada2b9c0f 100644
--- a/wiretap/tnef.c
+++ b/wiretap/tnef.c
@@ -27,7 +27,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "tnef.h"
static gboolean tnef_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
index e649bf8fb3..049251499a 100644
--- a/wiretap/toshiba.c
+++ b/wiretap/toshiba.c
@@ -20,7 +20,7 @@
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "toshiba.h"
#include "file_wrappers.h"
diff --git a/wiretap/visual.c b/wiretap/visual.c
index c10594b615..84b87be60f 100644
--- a/wiretap/visual.c
+++ b/wiretap/visual.c
@@ -25,7 +25,7 @@
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "visual.h"
/*
diff --git a/wiretap/vms.c b/wiretap/vms.c
index 4cabfdf3d8..027e3928b6 100644
--- a/wiretap/vms.c
+++ b/wiretap/vms.c
@@ -27,7 +27,7 @@
*/
#include "config.h"
#include "wtap-int.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "vms.h"
#include "file_wrappers.h"
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
index 7dad644fcb..73c650921a 100644
--- a/wiretap/vwr.c
+++ b/wiretap/vwr.c
@@ -26,7 +26,7 @@
#include "wtap-int.h"
#include "file_wrappers.h"
-#include "buffer.h"
+#include <wsutil/buffer.h>
#include "vwr.h"
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 3cbc9c54f3..2a6b7f220d 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -39,7 +39,7 @@
#include "file_wrappers.h"
#include <wsutil/file_util.h>
-#include "buffer.h"
+#include <wsutil/buffer.h>
#ifdef HAVE_PLUGINS
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 153f53ab94..f0716376c6 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -27,7 +27,7 @@
#include <glib.h>
#include <time.h>
-#include <wiretap/buffer.h>
+#include <wsutil/buffer.h>
#include <wsutil/nstime.h>
#include "ws_symbol_export.h"
diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt
index 0f44b8dc51..9efb7b26a4 100644
--- a/wsutil/CMakeLists.txt
+++ b/wsutil/CMakeLists.txt
@@ -44,6 +44,7 @@ set(WSUTIL_FILES
airpdcap_wep.c
base64.c
bitswap.c
+ buffer.c
cfutils.c
clopts_common.c
cmdarg_err.c
diff --git a/wsutil/Makefile.common b/wsutil/Makefile.common
index 2ea4a6082e..6201a78591 100644
--- a/wsutil/Makefile.common
+++ b/wsutil/Makefile.common
@@ -32,6 +32,7 @@ LIBWSUTIL_SRC = \
airpdcap_wep.c \
base64.c \
bitswap.c \
+ buffer.c \
cfutils.c \
clopts_common.c \
cmdarg_err.c \
@@ -83,6 +84,7 @@ LIBWSUTIL_INCLUDES = \
bits_ctz.h \
bits_count_ones.h \
bitswap.h \
+ buffer.h \
cfutils.h \
clopts_common.h \
cmdarg_err.h \
diff --git a/filetap/buffer.c b/wsutil/buffer.c
index e12c8de5f6..e12c8de5f6 100644
--- a/filetap/buffer.c
+++ b/wsutil/buffer.c
diff --git a/filetap/buffer.h b/wsutil/buffer.h
index 774dcdddb6..774dcdddb6 100644
--- a/filetap/buffer.h
+++ b/wsutil/buffer.h