blob: 2c39c704e03368f2f7b3a7c3699a062b17fb8974 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* tvbuff_base64.c
* Base-64 tvbuff implementation (based on real tvb)
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <glib.h>
#include <epan/tvbuff.h>
tvbuff_t *
base64_to_tvb(tvbuff_t *parent, const char *base64)
{
tvbuff_t *tvb;
char *data;
gsize len;
data = g_base64_decode(base64, &len);
tvb = tvb_new_child_real_data(parent, (const guint8 *)data, (gint)len, (gint)len);
tvb_set_free_cb(tvb, g_free);
return tvb;
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
|