aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-12-21 14:33:54 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-12-21 14:33:54 +0000
commit576c7eae45be250478b5317bacfa19ad46f812de (patch)
treed743bd527401fa0287c196c793c43b5fb5aff182 /epan
parent3778699fb53cb0ab07a0ca0977f3efd5c3a86681 (diff)
Move base64_to_tvb() to tvbuff_base64.c
svn path=/trunk/; revision=54325
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt1
-rw-r--r--epan/Makefile.common1
-rw-r--r--epan/base64.c18
-rw-r--r--epan/base64.h3
-rw-r--r--epan/dissectors/packet-ansi_a.c1
-rw-r--r--epan/dissectors/packet-imf.c1
-rw-r--r--epan/dissectors/packet-multipart.c1
-rw-r--r--epan/dissectors/packet-sdp.c1
-rw-r--r--epan/tvbuff.h9
-rw-r--r--epan/tvbuff_base64.c45
10 files changed, 56 insertions, 25 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index 9decb345a1..9b20aa0e63 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -1537,6 +1537,7 @@ set(LIBWIRESHARK_FILES
to_str.c
tvbparse.c
tvbuff.c
+ tvbuff_base64.c
tvbuff_composite.c
tvbuff_real.c
tvbuff_subset.c
diff --git a/epan/Makefile.common b/epan/Makefile.common
index 94b9da8ed4..3e7f1b288d 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -96,6 +96,7 @@ LIBWIRESHARK_SRC = \
tfs.c \
to_str.c \
tvbparse.c \
+ tvbuff_base64.c \
tvbuff_composite.c \
tvbuff_real.c \
tvbuff_subset.c \
diff --git a/epan/base64.c b/epan/base64.c
index aeba7c1d8a..bf507fca8a 100644
--- a/epan/base64.c
+++ b/epan/base64.c
@@ -65,21 +65,3 @@ size_t epan_base64_decode(char *s)
d[i*3/4] = 0;
return i*3/4;
}
-
-/* Return a tvb that contains the binary representation of a base64
- string */
-
-tvbuff_t *
-base64_to_tvb(tvbuff_t *parent, const char *base64)
-{
- tvbuff_t *tvb;
- char *data = g_strdup(base64);
- gint len;
-
- len = (gint) epan_base64_decode(data);
- tvb = tvb_new_child_real_data(parent, (const guint8 *)data, len, len);
-
- tvb_set_free_cb(tvb, g_free);
-
- return tvb;
-}
diff --git a/epan/base64.h b/epan/base64.h
index 36ccc9313a..2888bbdac0 100644
--- a/epan/base64.h
+++ b/epan/base64.h
@@ -24,7 +24,6 @@
#ifndef __BASE64_H__
#define __BASE64_H__
-#include <epan/tvbuff.h>
#include "ws_symbol_export.h"
#ifdef __cplusplus
@@ -35,8 +34,6 @@ extern "C" {
WS_DLL_PUBLIC
size_t epan_base64_decode(char *s);
-extern tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/epan/dissectors/packet-ansi_a.c b/epan/dissectors/packet-ansi_a.c
index d9174ca659..6c6e63e985 100644
--- a/epan/dissectors/packet-ansi_a.c
+++ b/epan/dissectors/packet-ansi_a.c
@@ -50,7 +50,6 @@
#include <epan/strutil.h>
#include <epan/wmem/wmem.h>
#include <epan/expert.h>
-#include <epan/base64.h>
#include <epan/tfs.h>
#include "packet-mtp3.h"
diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c
index 85c19181d1..fb6fe4c63e 100644
--- a/epan/dissectors/packet-imf.c
+++ b/epan/dissectors/packet-imf.c
@@ -32,7 +32,6 @@
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
#include <epan/uat.h>
-#include <epan/base64.h>
#include <epan/expert.h>
#include <epan/wmem/wmem.h>
diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c
index 6f5ea6f91c..8116654a35 100644
--- a/epan/dissectors/packet-multipart.c
+++ b/epan/dissectors/packet-multipart.c
@@ -65,7 +65,6 @@
#include <epan/packet.h>
#include <epan/prefs.h>
-#include <epan/base64.h>
#include <epan/wmem/wmem.h>
#include "packet-imf.h"
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index 8d90911e27..dadfbaea86 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -55,7 +55,6 @@
#include <epan/exceptions.h>
#include <epan/strutil.h>
#include <epan/wmem/wmem.h>
-#include <epan/base64.h>
#include <epan/asn1.h>
#include <epan/prefs.h>
#include <epan/expert.h>
diff --git a/epan/tvbuff.h b/epan/tvbuff.h
index cb9f2f1f50..43f13d7792 100644
--- a/epan/tvbuff.h
+++ b/epan/tvbuff.h
@@ -681,6 +681,8 @@ WS_DLL_PUBLIC const gchar *tvb_bcd_dig_to_wmem_packet_str(tvbuff_t *tvb,
WS_DLL_PUBLIC gint tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb,
const gint haystack_offset);
+/* From tvbuff_zlib.c */
+
/**
* Uncompresses a zlib compressed packet inside a tvbuff at offset with
* length comprlen. Returns an uncompressed tvbuffer if uncompression
@@ -697,6 +699,13 @@ WS_DLL_PUBLIC tvbuff_t *tvb_uncompress(tvbuff_t *tvb, const int offset,
extern tvbuff_t *tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb,
const int offset, int comprlen);
+/* From tvbuff_base64.c */
+
+/** Return a tvb that contains the binary representation of a base64
+ * string
+ */
+extern tvbuff_t* base64_to_tvb(tvbuff_t *parent, const char *base64);
+
/************** END OF ACCESSORS ****************/
/** @} */
diff --git a/epan/tvbuff_base64.c b/epan/tvbuff_base64.c
new file mode 100644
index 0000000000..425670a71b
--- /dev/null
+++ b/epan/tvbuff_base64.c
@@ -0,0 +1,45 @@
+/* tvbuff_base64.c
+ * Base-64 tvbuff implementation (based on real tvb)
+ *
+ * $Id$
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <epan/tvbuff.h>
+#include <epan/base64.h>
+
+tvbuff_t *
+base64_to_tvb(tvbuff_t *parent, const char *base64)
+{
+ tvbuff_t *tvb;
+ char *data = g_strdup(base64);
+ gint len;
+
+ len = (gint) epan_base64_decode(data);
+ tvb = tvb_new_child_real_data(parent, (const guint8 *)data, len, len);
+
+ tvb_set_free_cb(tvb, g_free);
+
+ return tvb;
+}