HTP
0.3
|
00001 /*************************************************************************** 00002 * Copyright 2009-2010 Open Information Security Foundation 00003 * Copyright 2010-2011 Qualys, Inc. 00004 * 00005 * Licensed to You 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 00023 /* Adapted from the libb64 project (http://sourceforge.net/projects/libb64), which is in public domain. */ 00024 00025 #ifndef _HTP_BASE64_H 00026 #define _HTP_BASE64_H 00027 00028 #include "bstr.h" 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 typedef enum { 00035 step_a, step_b, step_c, step_d 00036 } htp_base64_decodestep; 00037 00038 typedef struct { 00039 htp_base64_decodestep step; 00040 char plainchar; 00041 } htp_base64_decoder; 00042 00043 void htp_base64_decoder_init(htp_base64_decoder* state_in); 00044 00045 int htp_base64_decode_single(char value_in); 00046 00047 int htp_base64_decode(htp_base64_decoder* decoder, const char* code_in, const int length_in, 00048 char* plaintext_out, const int length_out); 00049 00050 bstr *htp_base64_decode_bstr(bstr *input); 00051 bstr *htp_base64_decode_mem(char *data, size_t len); 00052 00053 #ifdef __cplusplus 00054 } 00055 #endif 00056 00057 #endif /* _HTP_BASE64_H */ 00058