blob: f81476d959c9c90a98384f9d0ccafdd08a41785e [file] [log] [blame]
David Reissdb0ea152008-02-18 01:49:37 +00001// Copyright (c) 2006- Facebook
2// Distributed under the Thrift Software License
3//
4// See accompanying file LICENSE or visit the Thrift site at:
5// http://developers.facebook.com/thrift/
6
7#ifndef _THRIFT_PROTOCOL_TBASE64UTILS_H_
8#define _THRIFT_PROTOCOL_TBASE64UTILS_H_
9
10#include <string>
11
T Jake Lucianib5e62212009-01-31 22:36:20 +000012namespace apache { namespace thrift { namespace protocol {
David Reissdb0ea152008-02-18 01:49:37 +000013
14// in must be at least len bytes
15// len must be 1, 2, or 3
16// buf must be a buffer of at least 4 bytes and may not overlap in
17// the data is not padded with '='; the caller can do this if desired
18void base64_encode(const uint8_t *in, uint32_t len, uint8_t *buf);
19
20// buf must be a buffer of at least 4 bytes and contain base64 encoded values
21// buf will be changed to contain output bytes
22// len is number of bytes to consume from input (must be 2, 3, or 4)
23// no '=' padding should be included in the input
24void base64_decode(uint8_t *buf, uint32_t len);
25
T Jake Lucianib5e62212009-01-31 22:36:20 +000026}}} // apache::thrift::protocol
David Reissdb0ea152008-02-18 01:49:37 +000027
28#endif // #define _THRIFT_PROTOCOL_TBASE64UTILS_H_