#ifndef HEADER_CURL_BASE64_H
#define HEADER_CURL_BASE64_H
/***************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
 * are also available at http://curl.haxx.se/docs/copyright.html.
 *
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 * copies of the Software, and permit persons to whom the Software is
 * furnished to do so, under the terms of the COPYING file.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ***************************************************************************/
#include "stdint.h"
#include "stddef.h"
#include "string.h"
#include "stdio.h"

#define BASE64_OK                   0
#define BASE64_BAD_CONTENT_ENCODING 1
#define BASE64_OUT_OF_MEMORY        2

#define BASE64_DECODE_MAX_LEN       40*1024 // 16384
#define BASE64_ENCODE_MAX_LEN       40*1024 //12285 /* 16384 = 12285*4/3+4*/

uint32_t base64_encode(
		uint8_t *inputbuff, uint32_t insize,
		uint8_t *outptr, uint32_t *outlen);

uint32_t base64_decode(
		uint8_t *src, uint32_t srclen,
		uint8_t *outptr, uint32_t *outlen);

uint32_t base64url_encode(
		uint8_t *inputbuff, uint32_t insize,
		uint8_t *outptr, uint32_t *outlen);

uint32_t base64url_decode(
		uint8_t *src, uint32_t srclen,
		uint8_t *outptr, uint32_t *outlen);

uint32_t base64url_encode_nopad(
		uint8_t *inputbuff, uint32_t insize,
		uint8_t *outptr, uint32_t *outlen);

uint32_t base64url_decode_nopad(
		uint8_t *src, uint32_t srclen,
		uint8_t *outptr, uint32_t *outlen);

#endif /* HEADER_CURL_BASE64_H */
