axutil_base64.h

00001 
00002 /*
00003  *   Copyright 2003-2004 The Apache Software Foundation.
00004  *
00005  *   Licensed under the Apache License, Version 2.0 (the "License");
00006  *   you may not use this file except in compliance with the License.
00007  *   You may obtain a copy of the License at
00008  *
00009  *       http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  *   Unless required by applicable law or agreed to in writing, software
00012  *   distributed under the License is distributed on an "AS IS" BASIS,
00013  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *   See the License for the specific language governing permissions and
00015  *   limitations under the License.
00016  */
00017 
00018 #include <axutil_utils_defines.h>
00019 
00020 /*
00021  * @file axutil_base64.h
00022  * @brief AXIS2-UTIL Base64 Encoding
00023  */
00024 #ifndef AXUTIL_BASE64_H
00025 #define AXUTIL_BASE64_H
00026 
00027 #ifdef __cplusplus
00028 extern "C"
00029 {
00030 #endif
00031 
00032     /*
00033      * @defgroup AXIS2_Util_Base64 base64 encoding
00034      * @ingroup AXIS2_Util
00035      */
00036 
00037     /* Simple BASE64 encode/decode functions.
00038      *
00039      * As we might encode binary strings, hence we require the length of
00040      * the incoming plain source. And return the length of what we decoded.
00041      *
00042      * The decoding function takes any non valid char (i.e. whitespace, \0
00043      * or anything non A-Z,0-9 etc as terminal.
00044      *
00045      * plain strings/binary sequences are not assumed '\0' terminated. Encoded
00046      * strings are neither. But probably should.
00047      *
00048      */
00049 
00050     /*
00051      * Given the length of an un-encrypted string, get the length of the
00052      * encrypted string.
00053      * @param len the length of an unencrypted string.
00054      * @return the length of the string after it is encrypted
00055      */
00056     AXIS2_EXTERN int AXIS2_CALL
00057     axutil_base64_encode_len(
00058         int len);
00059 
00060     /*
00061      * Encode a text string using base64encoding.
00062      * @param coded_dst The destination string for the encoded string.
00063      * @param plain_src The original string in plain text
00064      * @param len_plain_src The length of the plain text string
00065      * @return the length of the encoded string
00066      */
00067     AXIS2_EXTERN int AXIS2_CALL
00068     axutil_base64_encode(
00069         char *coded_dst,
00070         const char *plain_src,
00071         int len_plain_src);
00072 
00073     /*
00074      * Encode an EBCDIC string using base64encoding.
00075      * @param coded_dst The destination string for the encoded string.
00076      * @param plain_src The original string in plain text
00077      * @param len_plain_src The length of the plain text string
00078      * @return the length of the encoded string
00079      */
00080     AXIS2_EXTERN int AXIS2_CALL
00081     axutil_base64_encode_binary(
00082         char *coded_dst,
00083         const unsigned char *plain_src,
00084         int len_plain_src);
00085 
00086     /*
00087      * Determine the length of a plain text string given the encoded version
00088      * @param coded_src The encoded string
00089      * @return the length of the plain text string
00090      */
00091     AXIS2_EXTERN int AXIS2_CALL
00092     axutil_base64_decode_len(
00093         const char *coded_src);
00094 
00095     /*
00096      * Decode a string to plain text
00097      * @param plain_dst The destination string for the plain text. size of this should be axutil_base64_decode_len + 1
00098      * @param coded_src The encoded string
00099      * @return the length of the plain text string
00100      */
00101     AXIS2_EXTERN int AXIS2_CALL
00102     axutil_base64_decode(
00103         char *plain_dst,
00104         const char *coded_src);
00105 
00106     /*
00107      * Decode an EBCDIC string to plain text
00108      * @param plain_dst The destination string for the plain text. size of this should be axutil_base64_decode_len
00109      * @param coded_src The encoded string
00110      * @return the length of the plain text string
00111      */
00112     AXIS2_EXTERN int AXIS2_CALL
00113     axutil_base64_decode_binary(
00114         unsigned char *plain_dst,
00115         const char *coded_src);
00116 
00117     /* @} */
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 
00122 #endif                          /* !AXIS2_BASE64_H */

Generated on Fri Apr 17 11:49:42 2009 for Axis2/C by  doxygen 1.5.3