HTP  0.5
htp_utf8_decoder.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2009-2010 Open Information Security Foundation
3  * Copyright (c) 2010-2013 Qualys, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * - Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12 
13  * - Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16 
17  * - Neither the name of the Qualys, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  ***************************************************************************/
33 
39 /* LibHTP changes:
40  *
41  * - Changed the name of the function from "decode" to "utf8_decode"
42  * - Created a separate header file
43  * - Copied the license from the web page
44  * - Created a copy of the data and function "utf8_decode_allow_overlong", which
45  * does not treat overlong characters as invalid.
46  */
47 
48 /*
49 Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
50 
51 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
52 and associated documentation files (the "Software"), to deal in the Software without restriction,
53 including without limitation the rights to use, copy, modify, merge, publish, distribute,
54 sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
55 furnished to do so, subject to the following conditions:
56 
57 The above copyright notice and this permission notice shall be included in all copies or
58 substantial portions of the Software.
59 
60 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
61 NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
62 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
63 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65 */
66 
67 #ifndef _UTF8_DECODER_H
68 #define _UTF8_DECODER_H
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 #include <stdint.h>
75 
76 #define HTP_UTF8_ACCEPT 0
77 #define HTP_UTF8_REJECT 1
78 
79 uint32_t htp_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte);
80 uint32_t htp_utf8_decode_allow_overlong(uint32_t* state, uint32_t* codep, uint32_t byte);
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* _UTF8_DECODER_H */
uint32_t htp_utf8_decode_allow_overlong(uint32_t *state, uint32_t *codep, uint32_t byte)
Definition: htp_utf8_decoder.c:129
uint32_t htp_utf8_decode(uint32_t *state, uint32_t *codep, uint32_t byte)
Definition: htp_utf8_decoder.c:108