David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 1 | // 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 Luciani | b5e6221 | 2009-01-31 22:36:20 +0000 | [diff] [blame^] | 12 | namespace apache { namespace thrift { namespace protocol { |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 13 | |
| 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 |
| 18 | void 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 |
| 24 | void base64_decode(uint8_t *buf, uint32_t len); |
| 25 | |
T Jake Luciani | b5e6221 | 2009-01-31 22:36:20 +0000 | [diff] [blame^] | 26 | }}} // apache::thrift::protocol |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 27 | |
| 28 | #endif // #define _THRIFT_PROTOCOL_TBASE64UTILS_H_ |