00001 /*************************************************************************** 00002 * Copyright (c) 2009-2010 Open Information Security Foundation 00003 * Copyright (c) 2010-2013 Qualys, Inc. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are 00008 * met: 00009 * 00010 * - Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 00013 * - Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 00017 * - Neither the name of the Qualys, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived from 00019 * this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 ***************************************************************************/ 00033 00039 /* LibHTP changes: 00040 * 00041 * - Changed the name of the function from "decode" to "utf8_decode" 00042 * - Created a separate header file 00043 * - Copied the license from the web page 00044 * - Created a copy of the data and function "utf8_decode_allow_overlong", which 00045 * does not treat overlong characters as invalid. 00046 */ 00047 00048 /* 00049 Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de> 00050 00051 Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00052 and associated documentation files (the "Software"), to deal in the Software without restriction, 00053 including without limitation the rights to use, copy, modify, merge, publish, distribute, 00054 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 00055 furnished to do so, subject to the following conditions: 00056 00057 The above copyright notice and this permission notice shall be included in all copies or 00058 substantial portions of the Software. 00059 00060 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 00061 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00062 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00063 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00064 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00065 */ 00066 00067 #ifndef _UTF8_DECODER_H 00068 #define _UTF8_DECODER_H 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00074 #include <stdint.h> 00075 00076 #define HTP_UTF8_ACCEPT 0 00077 #define HTP_UTF8_REJECT 1 00078 00079 uint32_t htp_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte); 00080 uint32_t htp_utf8_decode_allow_overlong(uint32_t* state, uint32_t* codep, uint32_t byte); 00081 00082 #ifdef __cplusplus 00083 } 00084 #endif 00085 00086 #endif /* _UTF8_DECODER_H */