GME  13
apr_base64.h
Go to the documentation of this file.
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  * The apr_vsnprintf/apr_snprintf functions are based on, and used with the
00016  * permission of, the  SIO stdio-replacement strx_* functions by Panos
00017  * Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
00018  */
00019 
00024 #ifndef APR_BASE64_H
00025 #define APR_BASE64_H
00026 
00027 #include "apu.h"
00028 #include "apr_general.h"
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00040 /* Simple BASE64 encode/decode functions.
00041  * 
00042  * As we might encode binary strings, hence we require the length of
00043  * the incoming plain source. And return the length of what we decoded.
00044  *
00045  * The decoding function takes any non valid char (i.e. whitespace, \0
00046  * or anything non A-Z,0-9 etc as terminal.
00047  * 
00048  * plain strings/binary sequences are not assumed '\0' terminated. Encoded
00049  * strings are neither. But probably should.
00050  *
00051  */
00052 
00060 APU_DECLARE(int) apr_base64_encode_len(int len);
00061 
00069 APU_DECLARE(int) apr_base64_encode(char * coded_dst, const char *plain_src, 
00070                                  int len_plain_src);
00071 
00079 APU_DECLARE(int) apr_base64_encode_binary(char * coded_dst, 
00080                                         const unsigned char *plain_src,
00081                                         int len_plain_src);
00082 
00089 APU_DECLARE(int) apr_base64_decode_len(const char * coded_src);
00090 
00097 APU_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src);
00098 
00105 APU_DECLARE(int) apr_base64_decode_binary(unsigned char * plain_dst, 
00106                                         const char *coded_src);
00107 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif  /* !APR_BASE64_H */