David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 19 | |
| 20 | #ifndef _THRIFT_PROTOCOL_TBASE64UTILS_H_ |
| 21 | #define _THRIFT_PROTOCOL_TBASE64UTILS_H_ |
| 22 | |
| 23 | #include <string> |
| 24 | |
T Jake Luciani | b5e6221 | 2009-01-31 22:36:20 +0000 | [diff] [blame] | 25 | namespace apache { namespace thrift { namespace protocol { |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 26 | |
| 27 | // in must be at least len bytes |
| 28 | // len must be 1, 2, or 3 |
| 29 | // buf must be a buffer of at least 4 bytes and may not overlap in |
| 30 | // the data is not padded with '='; the caller can do this if desired |
| 31 | void base64_encode(const uint8_t *in, uint32_t len, uint8_t *buf); |
| 32 | |
| 33 | // buf must be a buffer of at least 4 bytes and contain base64 encoded values |
| 34 | // buf will be changed to contain output bytes |
| 35 | // len is number of bytes to consume from input (must be 2, 3, or 4) |
| 36 | // no '=' padding should be included in the input |
| 37 | void base64_decode(uint8_t *buf, uint32_t len); |
| 38 | |
T Jake Luciani | b5e6221 | 2009-01-31 22:36:20 +0000 | [diff] [blame] | 39 | }}} // apache::thrift::protocol |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 40 | |
| 41 | #endif // #define _THRIFT_PROTOCOL_TBASE64UTILS_H_ |