Move common code to base64.c
svn path=/trunk/; revision=25908
This commit is contained in:
parent
ea4fbda062
commit
2b9d63a4b5
|
@ -66,3 +66,21 @@ size_t epan_base64_decode(char *s)
|
|||
|
||||
return i*3/4;
|
||||
}
|
||||
|
||||
/* Return a tvb that contains the binary representation of a base64
|
||||
string */
|
||||
|
||||
tvbuff_t *
|
||||
base64_to_tvb(const char *base64)
|
||||
{
|
||||
tvbuff_t *tvb;
|
||||
char *data = g_strdup(base64);
|
||||
size_t len;
|
||||
|
||||
len = epan_base64_decode(data);
|
||||
tvb = tvb_new_real_data((const guint8 *)data, len, len);
|
||||
|
||||
tvb_set_free_cb(tvb, g_free);
|
||||
|
||||
return tvb;
|
||||
}
|
|
@ -28,9 +28,12 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "epan/tvbuff.h"
|
||||
/* In-place decoding of a base64 string. */
|
||||
size_t epan_base64_decode(char *s);
|
||||
|
||||
extern tvbuff_t* base64_to_tvb(const char *base64);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -455,24 +455,6 @@ http_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_, epan_dissect_t* e
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Return a tvb that contains the binary representation of a base64
|
||||
string */
|
||||
|
||||
static tvbuff_t *
|
||||
base64_to_tvb(const char *base64)
|
||||
{
|
||||
tvbuff_t *tvb;
|
||||
char *data = g_strdup(base64);
|
||||
size_t len;
|
||||
|
||||
len = epan_base64_decode(data);
|
||||
tvb = tvb_new_real_data((const guint8 *)data, len, len);
|
||||
|
||||
tvb_set_free_cb(tvb, g_free);
|
||||
|
||||
return tvb;
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_http_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
||||
const char *line)
|
||||
|
|
|
@ -178,20 +178,12 @@ unfold_and_compact_mime_header(const char *lines, gint *first_colon_offset);
|
|||
static tvbuff_t *
|
||||
base64_decode(packet_info *pinfo, tvbuff_t *b64_tvb, char *name)
|
||||
{
|
||||
tvbuff_t *tvb;
|
||||
char *data;
|
||||
size_t len;
|
||||
|
||||
data = g_strdup(tvb_get_ephemeral_string(b64_tvb, 0, tvb_length(b64_tvb)));
|
||||
|
||||
len = epan_base64_decode(data);
|
||||
tvb = tvb_new_real_data((const guint8 *)data, len, len);
|
||||
|
||||
tvb_set_free_cb(tvb, g_free);
|
||||
|
||||
add_new_data_source(pinfo, tvb, name);
|
||||
|
||||
return tvb;
|
||||
return base64_to_tvb(data);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -898,25 +898,6 @@ static void dissect_sdp_encryption_key(tvbuff_t *tvb, proto_item * ti){
|
|||
tvb, offset, -1, FALSE);
|
||||
}
|
||||
|
||||
/* Return a tvb that contains the binary representation of a base64
|
||||
string */
|
||||
|
||||
static tvbuff_t *
|
||||
base64_to_tvb(const char *base64)
|
||||
{
|
||||
tvbuff_t *tvb;
|
||||
char *data = g_strdup(base64);
|
||||
size_t len;
|
||||
|
||||
len = epan_base64_decode(data);
|
||||
tvb = tvb_new_real_data((const guint8 *)data, len, len);
|
||||
|
||||
tvb_set_free_cb(tvb, g_free);
|
||||
|
||||
return tvb;
|
||||
}
|
||||
|
||||
|
||||
static void dissect_key_mgmt(tvbuff_t *tvb, packet_info * pinfo, proto_item * ti){
|
||||
gchar *data = NULL;
|
||||
gchar *prtcl_id = NULL;
|
||||
|
|
Loading…
Reference in New Issue