1 /*
2  *			GPAC - Multimedia Framework C SDK
3  *
4  *			Authors: Jean Le Feuvre
5  *			Copyright (c) Telecom ParisTech 2000-2019
6  *					All rights reserved
7  *
8  *  This file is part of GPAC / common tools sub-project
9  *
10  *  GPAC is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU Lesser General Public License as published by
12  *  the Free Software Foundation; either version 2, or (at your option)
13  *  any later version.
14  *
15  *  GPAC is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; see the file COPYING.  If not, write to
22  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 
26 #ifndef _GF_BASE_CODING_H_
27 #define _GF_BASE_CODING_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*!
34 \file <gpac/base_coding.h>
35 \brief Base 16 and 64 coding.
36 */
37 
38 /*!
39 \addtogroup bascod_grp
40 \brief Base 16 and 64 coding
41 
42 This section documents the base encoding and decoding functions of the GPAC framework.
43 
44 @{
45  */
46 
47 #include <gpac/tools.h>
48 
49 #ifndef GPAC_DISABLE_CORE_TOOLS
50 
51 /*!
52 \brief base64 encoder
53 
54 Encodes a data buffer to Base64
55 \param in_buffer input data buffer
56 \param in_buffer_size input data buffer size
57 \param out_buffer output Base64 buffer location
58 \param out_buffer_size output Base64 buffer allocated size
59 \return size of the encoded Base64 buffer
60 \note the encoded data buffer is not NULL-terminated.
61  */
62 u32 gf_base64_encode(const u8 *in_buffer, u32 in_buffer_size, u8 *out_buffer, u32 out_buffer_size);
63 /*!
64 \brief base64 decoder
65 
66 Decodes a Base64 buffer to data
67 \param in_buffer input Base64 buffer
68 \param in_buffer_size input Base64 buffer size
69 \param out_buffer output data buffer location
70 \param out_buffer_size output data buffer allocated size
71 \return size of the decoded buffer
72  */
73 u32 gf_base64_decode(u8 *in_buffer, u32 in_buffer_size, u8 *out_buffer, u32 out_buffer_size);
74 
75 /*!
76 \brief base16 encoder
77 
78 Encodes a data buffer to Base16
79 \param in_buffer input data buffer
80 \param in_buffer_size input data buffer size
81 \param out_buffer output Base16 buffer location
82 \param out_buffer_size output Base16 buffer allocated size
83 \return size of the encoded Base16 buffer
84 \note the encoded data buffer is not NULL-terminated.
85  */
86 u32 gf_base16_encode(u8 *in_buffer, u32 in_buffer_size, u8 *out_buffer, u32 out_buffer_size);
87 
88 /*!
89 \brief base16 decoder
90 
91 Decodes a Base16 buffer to data
92 \param in_buffer input Base16 buffer
93 \param in_buffer_size input Base16 buffer size
94 \param out_buffer output data buffer location
95 \param out_buffer_size output data buffer allocated size
96 \return size of the decoded buffer
97  */
98 u32 gf_base16_decode(u8 *in_buffer, u32 in_buffer_size, u8 *out_buffer, u32 out_buffer_size);
99 
100 /*! @} */
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /*GPAC_DISABLE_CORE_TOOLS*/
107 
108 #endif		/*_GF_BASE_CODING_H_*/
109