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