]> git.sur5r.net Git - openldap/blob - libraries/liblunicode/ure/ure.h
Full implementation of server identity checking per RFC2830 section 3.6
[openldap] / libraries / liblunicode / ure / ure.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /*
7  * Copyright 1997, 1998, 1999 Computing Research Labs,
8  * New Mexico State University
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
23  * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
24  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
25  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
26  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  */
28 #ifndef _h_ure
29 #define _h_ure
30
31 #include "portable.h"
32
33 /*
34  * $Id: ure.h,v 1.2 1999/09/21 15:47:44 mleisher Exp $
35  */
36
37 #include <stdio.h>
38
39 LDAP_BEGIN_DECL
40
41 /*
42  * Set of character class flags.
43  */
44 #define _URE_NONSPACING  0x00000001
45 #define _URE_COMBINING   0x00000002
46 #define _URE_NUMDIGIT    0x00000004
47 #define _URE_NUMOTHER    0x00000008
48 #define _URE_SPACESEP    0x00000010
49 #define _URE_LINESEP     0x00000020
50 #define _URE_PARASEP     0x00000040
51 #define _URE_CNTRL       0x00000080
52 #define _URE_PUA         0x00000100
53
54 #define _URE_UPPER       0x00000200
55 #define _URE_LOWER       0x00000400
56 #define _URE_TITLE       0x00000800
57 #define _URE_MODIFIER    0x00001000
58 #define _URE_OTHERLETTER 0x00002000
59 #define _URE_DASHPUNCT   0x00004000
60 #define _URE_OPENPUNCT   0x00008000
61 #define _URE_CLOSEPUNCT  0x00010000
62 #define _URE_OTHERPUNCT  0x00020000
63 #define _URE_MATHSYM     0x00040000
64 #define _URE_CURRENCYSYM 0x00080000
65 #define _URE_OTHERSYM    0x00100000
66
67 #define _URE_LTR         0x00200000
68 #define _URE_RTL         0x00400000
69
70 #define _URE_EURONUM     0x00800000
71 #define _URE_EURONUMSEP  0x01000000
72 #define _URE_EURONUMTERM 0x02000000
73 #define _URE_ARABNUM     0x04000000
74 #define _URE_COMMONSEP   0x08000000
75
76 #define _URE_BLOCKSEP    0x10000000
77 #define _URE_SEGMENTSEP  0x20000000
78
79 #define _URE_WHITESPACE  0x40000000
80 #define _URE_OTHERNEUT   0x80000000
81
82 /*
83  * Error codes.
84  */
85 #define _URE_OK               0
86 #define _URE_UNEXPECTED_EOS   -1
87 #define _URE_CCLASS_OPEN      -2
88 #define _URE_UNBALANCED_GROUP -3
89 #define _URE_INVALID_PROPERTY -4
90
91 /*
92  * Options that can be combined for searching.
93  */
94 #define URE_IGNORE_NONSPACING      0x01
95 #define URE_DOT_MATCHES_SEPARATORS 0x02
96
97 typedef unsigned long ucs4_t;
98 typedef unsigned short ucs2_t;
99
100 /*
101  * Opaque type for memory used when compiling expressions.
102  */
103 typedef struct _ure_buffer_t *ure_buffer_t;
104
105 /*
106  * Opaque type for the minimal DFA used when matching.
107  */
108 typedef struct _ure_dfa_t *ure_dfa_t;
109
110 /*************************************************************************
111  *
112  * API.
113  *
114  *************************************************************************/
115
116 extern ure_buffer_t ure_buffer_create LDAP_P((void));
117
118 extern void ure_buffer_free LDAP_P((ure_buffer_t buf));
119
120 extern ure_dfa_t ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
121                                  int casefold, ure_buffer_t buf));
122
123 extern void ure_dfa_free LDAP_P((ure_dfa_t dfa));
124
125 extern void ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
126
127 extern int ure_exec LDAP_P((ure_dfa_t dfa, int flags,
128                         ucs2_t *text, unsigned long textlen,
129                         unsigned long *match_start, unsigned long *match_end));
130
131 /*************************************************************************
132  *
133  * Prototypes for stub functions used for URE.  These need to be rewritten to
134  * use the Unicode support available on the system.
135  *
136  *************************************************************************/
137
138 extern ucs4_t _ure_tolower LDAP_P((ucs4_t c));
139
140 extern int _ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
141
142 LDAP_END_DECL
143
144 #endif /* _h_ure */