CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/CondCore/DBCommon/src/base64.h

Go to the documentation of this file.
00001 /* -*- buffer-read-only: t -*- vi: set ro: */
00002 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
00003 /* base64.h -- Encode binary data using printable characters.
00004    Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc.
00005    Written by Simon Josefsson.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3, or (at your option)
00010    any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software Foundation,
00019    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #ifndef BASE64_H
00022 # define BASE64_H
00023 
00024 /* Get size_t. */
00025 # include <stddef.h>
00026 
00027 /* Get bool. */
00028 # include <stdbool.h>
00029 
00030 /* This uses that the expression (n+(k-1))/k means the smallest
00031    integer >= n/k, i.e., the ceiling of n/k.  */
00032 # define BASE64_LENGTH(inlen) ((((inlen) + 2) / 3) * 4)
00033 
00034 struct base64_decode_context
00035 {
00036   unsigned int i;
00037   char buf[4];
00038 };
00039 
00040 extern bool isbase64 (char ch);
00041 
00042 extern void base64_encode (const char *in, size_t inlen,
00043                            char *out, size_t outlen);
00044 
00045 extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
00046 
00047 extern void base64_decode_ctx_init (struct base64_decode_context *ctx);
00048 
00049 extern bool base64_decode_ctx (struct base64_decode_context *ctx,
00050                                const char *in, size_t inlen,
00051                                char *out, size_t *outlen);
00052 
00053 extern bool base64_decode_alloc_ctx (struct base64_decode_context *ctx,
00054                                      const char *in, size_t inlen,
00055                                      char **out, size_t *outlen);
00056 
00057 #define base64_decode(in, inlen, out, outlen) \
00058         base64_decode_ctx (NULL, in, inlen, out, outlen)
00059 
00060 #define base64_decode_alloc(in, inlen, out, outlen) \
00061         base64_decode_alloc_ctx (NULL, in, inlen, out, outlen)
00062 
00063 #endif /* BASE64_H */