ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uspoof.h
Go to the documentation of this file.
1 /*
2 ***************************************************************************
3 * Copyright (C) 2008-2014, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 ***************************************************************************
6 * file name: uspoof.h
7 * encoding: US-ASCII
8 * tab size: 8 (not used)
9 * indentation:4
10 *
11 * created on: 2008Feb13
12 * created by: Andy Heninger
13 *
14 * Unicode Spoof Detection
15 */
16
17 #ifndef USPOOF_H
18 #define USPOOF_H
19
20 #include "unicode/utypes.h"
21 #include "unicode/uset.h"
22 #include "unicode/parseerr.h"
23 #include "unicode/localpointer.h"
24
25 #if !UCONFIG_NO_NORMALIZATION
26
27
28 #if U_SHOW_CPLUSPLUS_API
29 #include "unicode/unistr.h"
30 #include "unicode/uniset.h"
31 #endif
32
33
144 struct USpoofChecker;
145 typedef struct USpoofChecker USpoofChecker;
154 typedef enum USpoofChecks {
160 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
161
170 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
171
181 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
182
189 USPOOF_ANY_CASE = 8,
190
204 USPOOF_RESTRICTION_LEVEL = 16,
205
206 #ifndef U_HIDE_DEPRECATED_API
207
212 USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL,
213 #endif /* U_HIDE_DEPRECATED_API */
214
221 USPOOF_INVISIBLE = 32,
222
227 USPOOF_CHAR_LIMIT = 64,
228
235 USPOOF_MIXED_NUMBERS = 128,
236
242 USPOOF_ALL_CHECKS = 0xFFFF,
243
256 USPOOF_AUX_INFO = 0x40000000
257
258 } USpoofChecks;
259
260
266 typedef enum URestrictionLevel {
272 USPOOF_ASCII = 0x10000000,
273 #ifndef U_HIDE_DRAFT_API
274
279 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
280 #endif /* U_HIDE_DRAFT_API */
281
288 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
294 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
300 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
306 USPOOF_UNRESTRICTIVE = 0x60000000,
307 #ifndef U_HIDE_DRAFT_API
308
313 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000
314 #endif /* U_HIDE_DRAFT_API */
315 } URestrictionLevel;
316
327 U_STABLE USpoofChecker * U_EXPORT2
328 uspoof_open(UErrorCode *status);
329
330
352 U_STABLE USpoofChecker * U_EXPORT2
353 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
354 UErrorCode *pErrorCode);
355
387 U_STABLE USpoofChecker * U_EXPORT2
388 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
389 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
390 int32_t *errType, UParseError *pe, UErrorCode *status);
391
392
398 U_STABLE void U_EXPORT2
399 uspoof_close(USpoofChecker *sc);
400
401 #if U_SHOW_CPLUSPLUS_API
402
403 U_NAMESPACE_BEGIN
404
414 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
415
416 U_NAMESPACE_END
417
418 #endif
419
429 U_STABLE USpoofChecker * U_EXPORT2
430 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
431
432
445 U_STABLE void U_EXPORT2
446 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
447
459 U_STABLE int32_t U_EXPORT2
460 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
461
470 U_STABLE void U_EXPORT2
471 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
472
473
481 U_STABLE URestrictionLevel U_EXPORT2
482 uspoof_getRestrictionLevel(const USpoofChecker *sc);
483
526 U_STABLE void U_EXPORT2
527 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
528
550 U_STABLE const char * U_EXPORT2
551 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
552
553
572 U_STABLE void U_EXPORT2
573 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
574
575
596 U_STABLE const USet * U_EXPORT2
597 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
598
599
600 #if U_SHOW_CPLUSPLUS_API
601
619 U_STABLE void U_EXPORT2
620 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
621
622
643 U_STABLE const icu::UnicodeSet * U_EXPORT2
644 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
645 #endif
646
647
674 U_STABLE int32_t U_EXPORT2
675 uspoof_check(const USpoofChecker *sc,
676 const UChar *id, int32_t length,
677 int32_t *position,
678 UErrorCode *status);
679
680
708 U_STABLE int32_t U_EXPORT2
709 uspoof_checkUTF8(const USpoofChecker *sc,
710 const char *id, int32_t length,
711 int32_t *position,
712 UErrorCode *status);
713
714
715 #if U_SHOW_CPLUSPLUS_API
716
739 U_STABLE int32_t U_EXPORT2
740 uspoof_checkUnicodeString(const USpoofChecker *sc,
741 const icu::UnicodeString &id,
742 int32_t *position,
743 UErrorCode *status);
744
745 #endif
746
747
787 U_STABLE int32_t U_EXPORT2
788 uspoof_areConfusable(const USpoofChecker *sc,
789 const UChar *id1, int32_t length1,
790 const UChar *id2, int32_t length2,
791 UErrorCode *status);
792
793
794
820 U_STABLE int32_t U_EXPORT2
821 uspoof_areConfusableUTF8(const USpoofChecker *sc,
822 const char *id1, int32_t length1,
823 const char *id2, int32_t length2,
824 UErrorCode *status);
825
826
827
828
829 #if U_SHOW_CPLUSPLUS_API
830
851 U_STABLE int32_t U_EXPORT2
852 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
853 const icu::UnicodeString &s1,
854 const icu::UnicodeString &s2,
855 UErrorCode *status);
856 #endif
857
858
891 U_STABLE int32_t U_EXPORT2
892 uspoof_getSkeleton(const USpoofChecker *sc,
893 uint32_t type,
894 const UChar *id, int32_t length,
895 UChar *dest, int32_t destCapacity,
896 UErrorCode *status);
897
933 U_STABLE int32_t U_EXPORT2
934 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
935 uint32_t type,
936 const char *id, int32_t length,
937 char *dest, int32_t destCapacity,
938 UErrorCode *status);
939
940 #if U_SHOW_CPLUSPLUS_API
941
966 U_I18N_API icu::UnicodeString & U_EXPORT2
967 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
968 uint32_t type,
969 const icu::UnicodeString &id,
970 icu::UnicodeString &dest,
971 UErrorCode *status);
972 #endif /* U_SHOW_CPLUSPLUS_API */
973
985 U_STABLE const USet * U_EXPORT2
986 uspoof_getInclusionSet(UErrorCode *status);
987
999 U_STABLE const USet * U_EXPORT2
1000 uspoof_getRecommendedSet(UErrorCode *status);
1001
1002 #if U_SHOW_CPLUSPLUS_API
1003
1015 U_STABLE const icu::UnicodeSet * U_EXPORT2
1016 uspoof_getInclusionUnicodeSet(UErrorCode *status);
1017
1029 U_STABLE const icu::UnicodeSet * U_EXPORT2
1030 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
1031
1032 #endif /* U_SHOW_CPLUSPLUS_API */
1033
1056 U_STABLE int32_t U_EXPORT2
1057 uspoof_serialize(USpoofChecker *sc,
1058 void *data, int32_t capacity,
1059 UErrorCode *status);
1060
1061
1062 #endif
1063
1064 #endif /* USPOOF_H */