ICU 55.1 55.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-2015, 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
152 struct USpoofChecker;
153 typedef struct USpoofChecker USpoofChecker;
162 typedef enum USpoofChecks {
168 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
169
178 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
179
189 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
190
197 USPOOF_ANY_CASE = 8,
198
212 USPOOF_RESTRICTION_LEVEL = 16,
213
214 #ifndef U_HIDE_DEPRECATED_API
215
220 USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL,
221 #endif /* U_HIDE_DEPRECATED_API */
222
229 USPOOF_INVISIBLE = 32,
230
235 USPOOF_CHAR_LIMIT = 64,
236
243 USPOOF_MIXED_NUMBERS = 128,
244
250 USPOOF_ALL_CHECKS = 0xFFFF,
251
264 USPOOF_AUX_INFO = 0x40000000
265
266 } USpoofChecks;
267
268
274 typedef enum URestrictionLevel {
280 USPOOF_ASCII = 0x10000000,
286 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
294 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
300 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
306 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
312 USPOOF_UNRESTRICTIVE = 0x60000000,
318 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000
319 } URestrictionLevel;
320
331 U_STABLE USpoofChecker * U_EXPORT2
332 uspoof_open(UErrorCode *status);
333
334
356 U_STABLE USpoofChecker * U_EXPORT2
357 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
358 UErrorCode *pErrorCode);
359
391 U_STABLE USpoofChecker * U_EXPORT2
392 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
393 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
394 int32_t *errType, UParseError *pe, UErrorCode *status);
395
396
402 U_STABLE void U_EXPORT2
403 uspoof_close(USpoofChecker *sc);
404
405 #if U_SHOW_CPLUSPLUS_API
406
407 U_NAMESPACE_BEGIN
408
418 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
419
420 U_NAMESPACE_END
421
422 #endif
423
433 U_STABLE USpoofChecker * U_EXPORT2
434 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
435
436
449 U_STABLE void U_EXPORT2
450 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
451
463 U_STABLE int32_t U_EXPORT2
464 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
465
474 U_STABLE void U_EXPORT2
475 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
476
477
485 U_STABLE URestrictionLevel U_EXPORT2
486 uspoof_getRestrictionLevel(const USpoofChecker *sc);
487
530 U_STABLE void U_EXPORT2
531 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
532
554 U_STABLE const char * U_EXPORT2
555 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
556
557
576 U_STABLE void U_EXPORT2
577 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
578
579
600 U_STABLE const USet * U_EXPORT2
601 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
602
603
604 #if U_SHOW_CPLUSPLUS_API
605
623 U_STABLE void U_EXPORT2
624 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
625
626
647 U_STABLE const icu::UnicodeSet * U_EXPORT2
648 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
649 #endif
650
651
678 U_STABLE int32_t U_EXPORT2
679 uspoof_check(const USpoofChecker *sc,
680 const UChar *id, int32_t length,
681 int32_t *position,
682 UErrorCode *status);
683
684
712 U_STABLE int32_t U_EXPORT2
713 uspoof_checkUTF8(const USpoofChecker *sc,
714 const char *id, int32_t length,
715 int32_t *position,
716 UErrorCode *status);
717
718
719 #if U_SHOW_CPLUSPLUS_API
720
743 U_STABLE int32_t U_EXPORT2
744 uspoof_checkUnicodeString(const USpoofChecker *sc,
745 const icu::UnicodeString &id,
746 int32_t *position,
747 UErrorCode *status);
748
749 #endif
750
751
791 U_STABLE int32_t U_EXPORT2
792 uspoof_areConfusable(const USpoofChecker *sc,
793 const UChar *id1, int32_t length1,
794 const UChar *id2, int32_t length2,
795 UErrorCode *status);
796
797
798
824 U_STABLE int32_t U_EXPORT2
825 uspoof_areConfusableUTF8(const USpoofChecker *sc,
826 const char *id1, int32_t length1,
827 const char *id2, int32_t length2,
828 UErrorCode *status);
829
830
831
832
833 #if U_SHOW_CPLUSPLUS_API
834
855 U_STABLE int32_t U_EXPORT2
856 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
857 const icu::UnicodeString &s1,
858 const icu::UnicodeString &s2,
859 UErrorCode *status);
860 #endif
861
862
895 U_STABLE int32_t U_EXPORT2
896 uspoof_getSkeleton(const USpoofChecker *sc,
897 uint32_t type,
898 const UChar *id, int32_t length,
899 UChar *dest, int32_t destCapacity,
900 UErrorCode *status);
901
937 U_STABLE int32_t U_EXPORT2
938 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
939 uint32_t type,
940 const char *id, int32_t length,
941 char *dest, int32_t destCapacity,
942 UErrorCode *status);
943
944 #if U_SHOW_CPLUSPLUS_API
945
970 U_I18N_API icu::UnicodeString & U_EXPORT2
971 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
972 uint32_t type,
973 const icu::UnicodeString &id,
974 icu::UnicodeString &dest,
975 UErrorCode *status);
976 #endif /* U_SHOW_CPLUSPLUS_API */
977
989 U_STABLE const USet * U_EXPORT2
990 uspoof_getInclusionSet(UErrorCode *status);
991
1003 U_STABLE const USet * U_EXPORT2
1004 uspoof_getRecommendedSet(UErrorCode *status);
1005
1006 #if U_SHOW_CPLUSPLUS_API
1007
1019 U_STABLE const icu::UnicodeSet * U_EXPORT2
1020 uspoof_getInclusionUnicodeSet(UErrorCode *status);
1021
1033 U_STABLE const icu::UnicodeSet * U_EXPORT2
1034 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
1035
1036 #endif /* U_SHOW_CPLUSPLUS_API */
1037
1060 U_STABLE int32_t U_EXPORT2
1061 uspoof_serialize(USpoofChecker *sc,
1062 void *data, int32_t capacity,
1063 UErrorCode *status);
1064
1065
1066 #endif
1067
1068 #endif /* USPOOF_H */