root/src/utils/noit_b32.h

Revision 1774a2db88a0c683623716a678d38d508802f8eb, 3.0 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 4 years ago)

fixes #346

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2005-2007, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *    * Redistributions of source code must retain the above copyright
10  *      notice, this list of conditions and the following disclaimer.
11  *    * Redistributions in binary form must reproduce the above
12  *      copyright notice, this list of conditions and the following
13  *      disclaimer in the documentation and/or other materials provided
14  *      with the distribution.
15  *    * Neither the name OmniTI Computer Consulting, Inc. nor the names
16  *      of its contributors may be used to endorse or promote products
17  *      derived from this software without specific prior written
18  *      permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _NOIT_B32_H
34 #define _NOIT_B32_H
35
36 #include "noit_config.h"
37 #include "noit_defines.h"
38
39 /*! \fn int noit_b32_decode(const char *src, size_t src_len, unsigned char *dest, size_t dest_len)
40     \brief Decode a base32 encoded input buffer into the provided output buffer.
41     \param src The buffer containing the encoded content.
42     \param src_len The size (in bytes) of the encoded data.
43     \param dest The destination buffer to which the function will produce.
44     \param dest_len The size of the destination buffer.
45     \return The size of the decoded output.  Returns zero is dest_len is too small.
46    
47     noit_b32_decode decodes input until an the entire input is consumed or until an invalid base32 character is encountered.
48  */
49 API_EXPORT(int) noit_b32_decode(const char *, size_t, unsigned char *, size_t);
50 /*! \fn int noit_b32_encode(const unsigned char *src, size_t src_len, char *dest, size_t dest_len)
51     \brief Encode raw data as base32 encoded output into the provided buffer.
52     \param src The buffer containing the raw data.
53     \param src_len The size (in bytes) of the raw data.
54     \param dest The destination buffer to which the function will produce.
55     \param dest_len The size of the destination buffer.
56     \return The size of the encoded output.  Returns zero is out_sz is too small.
57  */
58 API_EXPORT(int) noit_b32_encode(const unsigned char *, size_t, char *, size_t);
59
60 #endif
Note: See TracBrowser for help on using the browser.