HTP
0.3
Main Page
Related Pages
Data Structures
Files
File List
Globals
htp
htp_base64.h
Go to the documentation of this file.
1
/***************************************************************************
2
* Copyright (c) 2009-2010, Open Information Security Foundation
3
* Copyright (c) 2009-2012, Qualys, Inc.
4
* All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions are
8
* met:
9
*
10
* * Redistributions of source code must retain the above copyright
11
* notice, this list of conditions and the following disclaimer.
12
* * Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
* * Neither the name of the Qualys, Inc. nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
***************************************************************************/
31
37
/* Adapted from the libb64 project (http://sourceforge.net/projects/libb64), which is in public domain. */
38
39
#ifndef _HTP_BASE64_H
40
#define _HTP_BASE64_H
41
42
#include "
bstr.h
"
43
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
48
typedef
enum
{
49
step_a
,
step_b
,
step_c
,
step_d
50
}
htp_base64_decodestep
;
51
52
typedef
struct
{
53
htp_base64_decodestep
step
;
54
char
plainchar
;
55
}
htp_base64_decoder
;
56
57
void
htp_base64_decoder_init
(
htp_base64_decoder
* state_in);
58
59
int
htp_base64_decode_single
(
char
value_in);
60
61
int
htp_base64_decode
(
htp_base64_decoder
* decoder,
const
char
* code_in,
const
int
length_in,
62
char
* plaintext_out,
const
int
length_out);
63
64
bstr
*
htp_base64_decode_bstr
(
bstr
*input);
65
bstr
*
htp_base64_decode_mem
(
const
char
*data,
size_t
len);
66
67
#ifdef __cplusplus
68
}
69
#endif
70
71
#endif
/* _HTP_BASE64_H */
72
Generated by
1.8.1.2