• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

ink_base64.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #ifndef _ink_base64_h_
00025 #define _ink_base64_h_
00026 
00027 /*
00028  * Base64 encoding and decoding as according to RFC1521.  Similar to uudecode.
00029  * See RFC1521 for specificiation.
00030  *
00031  * RFC 1521 requires inserting line breaks for long lines.  The basic web
00032  * authentication scheme does not require them.  This implementation is
00033  * intended for web-related use, and line breaks are not implemented.
00034  *
00035  * These routines return char*'s to malloc-ed strings.  The caller is
00036  * responsible for freeing the strings.
00037  *
00038  */
00039 // Encodes / Decodes into user supplied buffer.  Returns number of bytes decoded
00040 bool ats_base64_encode(const char *inBuffer, size_t inBufferSize, char *outBuffer, size_t outBufSize, size_t *length);
00041 bool ats_base64_encode(const unsigned char *inBuffer, size_t inBufferSize, char *outBuffer, size_t outBufSize, size_t *length);
00042 
00043 bool ats_base64_decode(const char *inBuffer, size_t inBufferSize, unsigned char *outBuffer, size_t outBufSize, size_t *length);
00044 
00045 // Little helper functions to calculate minimum required output buffer for encoding/decoding.
00046 #define ATS_BASE64_ENCODE_DSTLEN(_length) ((_length * 8) / 6 + 4)
00047 #define ATS_BASE64_DECODE_DSTLEN(_length) (((_length + 3) / 4) * 3)
00048 
00049 #endif

Generated by  doxygen 1.7.1