1 /* stringprep.h header file for libstringprep -*- c -*-
2 * Copyright (C) 2002 Simon Josefsson
4 * This file is part of Libstringprep.
6 * Libstringprep is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * Libstringprep is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with Libstringprep; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #define STRINGPREP_VERSION "@PACKAGE_VERSION@"
36 /* Stringprep errors. */
37 STRINGPREP_CONTAINS_UNASSIGNED
= 1,
38 STRINGPREP_CONTAINS_PROHIBITED
= 2,
39 STRINGPREP_BIDI_BOTH_L_AND_RAL
= 3,
40 STRINGPREP_BIDI_LEADTRAIL_NOT_RAL
= 4,
41 STRINGPREP_BIDI_CONTAINS_PROHIBITED
= 5,
42 /* Error in calling application. */
43 STRINGPREP_TOO_SMALL_BUFFER
= 100,
44 STRINGPREP_PROFILE_ERROR
= 101,
45 STRINGPREP_FLAG_ERROR
= 102,
46 /* Internal errors. */
47 STRINGPREP_NFKC_FAILED
= 200,
48 STRINGPREP_MALLOC_ERROR
= 201,
51 /* Flags used when calling stringprep(). */
54 STRINGPREP_NO_NFKC
= 1,
55 STRINGPREP_NO_BIDI
= 2,
56 STRINGPREP_NO_UNASSIGNED
= 4,
59 /* Steps in a stringprep profile. */
64 STRINGPREP_MAP_TABLE
= 3,
65 STRINGPREP_UNASSIGNED_TABLE
= 4,
66 STRINGPREP_PROHIBIT_TABLE
= 5,
67 STRINGPREP_BIDI_PROHIBIT_TABLE
= 6,
68 STRINGPREP_BIDI_RAL_TABLE
= 7,
69 STRINGPREP_BIDI_L_TABLE
= 8
72 #define STRINGPREP_MAX_MAP_CHARS 5
74 struct Stringprep_table_element
77 long end
; /* 0 if only one character */
78 long map
[STRINGPREP_MAX_MAP_CHARS
]; /* Always NULL if end is non-0 */
80 typedef struct Stringprep_table_element Stringprep_table_element
;
82 struct Stringprep_table
86 Stringprep_table_element
*table
;
89 typedef struct Stringprep_table Stringprep_profile
;
93 extern int stringprep (char *in
, int maxlen
, int flags
,
94 Stringprep_profile
* profile
);
96 extern const char *stringprep_check_version (const char *req_version
);
100 extern int stringprep_unichar_to_utf8 (long c
, char *outbuf
);
101 extern long stringprep_utf8_to_unichar (const char *p
);
103 extern long *stringprep_utf8_to_ucs4 (const char *str
, int len
,
105 extern char *stringprep_ucs4_to_utf8 (const long *str
, int len
,
106 int *items_read
, int *items_written
);
108 extern char *stringprep_utf8_nfkc_normalize (const char *str
, int len
);
109 extern long *stringprep_ucs4_nfkc_normalize (long *str
, int len
);
111 extern const char *stringprep_locale_charset ();
112 extern char *stringprep_convert (const char *str
,
113 const char *to_codeset
,
114 const char *from_codeset
);
115 extern char *stringprep_locale_to_utf8 (const char *str
);
120 #endif /* _STRINGPREP_H */