Constify krb5int_utf8_normalize input parameter
[krb5.git] / src / include / k5-unicode.h
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright (C) 2008 by the Massachusetts Institute of Technology,
4  * Cambridge, MA, USA.  All Rights Reserved.
5  *
6  * This software is being provided to you, the LICENSEE, by the
7  * Massachusetts Institute of Technology (M.I.T.) under the following
8  * license.  By obtaining, using and/or copying this software, you agree
9  * that you have read, understood, and will comply with these terms and
10  * conditions:
11  *
12  * Export of this software from the United States of America may
13  * require a specific license from the United States Government.
14  * It is the responsibility of any person or organization contemplating
15  * export to obtain such a license before exporting.
16  *
17  * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
18  * this software and its documentation for any purpose and without fee or
19  * royalty is hereby granted, provided that you agree to comply with the
20  * following copyright notice and statements, including the disclaimer, and
21  * that the same appear on ALL copies of the software and documentation,
22  * including modifications that you make for internal use or for
23  * distribution:
24  *
25  * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
26  * OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not
27  * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
28  * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
29  * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
30  * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
31  *
32  * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
33  * be used in advertising or publicity pertaining to distribution of the
34  * software.  Title to copyright in this software and any associated
35  * documentation shall at all times remain with M.I.T., and USER agrees to
36  * preserve same.
37  *
38  * Furthermore if you modify this software you must label
39  * your software as modified software and not distribute it in such a
40  * fashion that it might be confused with the original M.I.T. software.
41  */
42 /*
43  * Copyright 1998-2008 The OpenLDAP Foundation.
44  * All rights reserved.
45  *
46  * Redistribution and use in source and binary forms, with or without
47  * modification, are permitted only as authorized by the OpenLDAP
48  * Public License.
49  *
50  * A copy of this license is available in file LICENSE in the
51  * top-level directory of the distribution or, alternatively, at
52  * <http://www.OpenLDAP.org/license.html>.
53  */
54 /*
55  * Copyright (C) 2000 Novell, Inc. All Rights Reserved.
56  *
57  * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
58  * USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO VERSION
59  * 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS AVAILABLE AT
60  * HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE" IN THE
61  * TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION OF THIS
62  * WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP PUBLIC
63  * LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT THE
64  * PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
65  */
66
67 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. */
68
69 #ifndef K5_UNICODE_H
70 #define K5_UNICODE_H
71
72 #include "autoconf.h"
73
74 #ifdef HAVE_SYS_TYPES_H
75 #include <sys/types.h>
76 #endif
77
78 #ifdef HAVE_UNISTD_H
79 #include <unistd.h>
80 #endif
81
82 #ifdef HAVE_STDLIB_H
83 #include <stdlib.h>
84 #endif
85
86 #include "k5-utf8.h"
87
88 typedef krb5_ucs4 krb5_unicode;
89
90 int krb5int_ucstrncmp(
91     const krb5_unicode *,
92     const krb5_unicode *,
93     size_t);
94
95 int krb5int_ucstrncasecmp(
96     const krb5_unicode *,
97     const krb5_unicode *,
98     size_t);
99
100 krb5_unicode *krb5int_ucstrnchr(
101     const krb5_unicode *,
102     size_t,
103     krb5_unicode);
104
105 krb5_unicode *krb5int_ucstrncasechr(
106     const krb5_unicode *,
107     size_t,
108     krb5_unicode);
109
110 void krb5int_ucstr2upper(
111     krb5_unicode *,
112     size_t);
113
114 #define KRB5_UTF8_NOCASEFOLD    0x0U
115 #define KRB5_UTF8_CASEFOLD      0x1U
116 #define KRB5_UTF8_ARG1NFC       0x2U
117 #define KRB5_UTF8_ARG2NFC       0x4U
118 #define KRB5_UTF8_APPROX        0x8U
119
120 krb5_error_code krb5int_utf8_normalize(
121     const krb5_data *,
122     krb5_data **,
123     unsigned);
124
125 int krb5int_utf8_normcmp(
126     const krb5_data *,
127     const krb5_data *,
128     unsigned);
129
130 #endif /* K5_UNICODE_H */