00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef USPOOF_H
00018 #define USPOOF_H
00019
00020 #include "unicode/utypes.h"
00021 #include "unicode/uset.h"
00022 #include "unicode/parseerr.h"
00023 #include "unicode/localpointer.h"
00024
00025 #if !UCONFIG_NO_NORMALIZATION
00026
00027
00028 #if U_SHOW_CPLUSPLUS_API
00029 #include "unicode/unistr.h"
00030 #include "unicode/uniset.h"
00031 #endif
00032
00033
00152 struct USpoofChecker;
00153 typedef struct USpoofChecker USpoofChecker;
00162 typedef enum USpoofChecks {
00168 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
00169
00178 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
00179
00189 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
00190
00197 USPOOF_ANY_CASE = 8,
00198
00212 USPOOF_RESTRICTION_LEVEL = 16,
00213
00214 #ifndef U_HIDE_DEPRECATED_API
00215
00220 USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL,
00221 #endif
00222
00229 USPOOF_INVISIBLE = 32,
00230
00235 USPOOF_CHAR_LIMIT = 64,
00236
00243 USPOOF_MIXED_NUMBERS = 128,
00244
00250 USPOOF_ALL_CHECKS = 0xFFFF,
00251
00264 USPOOF_AUX_INFO = 0x40000000
00265
00266 } USpoofChecks;
00267
00268
00274 typedef enum URestrictionLevel {
00280 USPOOF_ASCII = 0x10000000,
00286 USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000,
00294 USPOOF_HIGHLY_RESTRICTIVE = 0x30000000,
00300 USPOOF_MODERATELY_RESTRICTIVE = 0x40000000,
00306 USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000,
00312 USPOOF_UNRESTRICTIVE = 0x60000000,
00318 USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000
00319 } URestrictionLevel;
00320
00331 U_STABLE USpoofChecker * U_EXPORT2
00332 uspoof_open(UErrorCode *status);
00333
00334
00356 U_STABLE USpoofChecker * U_EXPORT2
00357 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
00358 UErrorCode *pErrorCode);
00359
00391 U_STABLE USpoofChecker * U_EXPORT2
00392 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
00393 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
00394 int32_t *errType, UParseError *pe, UErrorCode *status);
00395
00396
00402 U_STABLE void U_EXPORT2
00403 uspoof_close(USpoofChecker *sc);
00404
00405 #if U_SHOW_CPLUSPLUS_API
00406
00407 U_NAMESPACE_BEGIN
00408
00418 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
00419
00420 U_NAMESPACE_END
00421
00422 #endif
00423
00433 U_STABLE USpoofChecker * U_EXPORT2
00434 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
00435
00436
00449 U_STABLE void U_EXPORT2
00450 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
00451
00463 U_STABLE int32_t U_EXPORT2
00464 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
00465
00474 U_STABLE void U_EXPORT2
00475 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel);
00476
00477
00485 U_STABLE URestrictionLevel U_EXPORT2
00486 uspoof_getRestrictionLevel(const USpoofChecker *sc);
00487
00530 U_STABLE void U_EXPORT2
00531 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
00532
00554 U_STABLE const char * U_EXPORT2
00555 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
00556
00557
00576 U_STABLE void U_EXPORT2
00577 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
00578
00579
00600 U_STABLE const USet * U_EXPORT2
00601 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
00602
00603
00604 #if U_SHOW_CPLUSPLUS_API
00605
00623 U_STABLE void U_EXPORT2
00624 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status);
00625
00626
00647 U_STABLE const icu::UnicodeSet * U_EXPORT2
00648 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
00649 #endif
00650
00651
00678 U_STABLE int32_t U_EXPORT2
00679 uspoof_check(const USpoofChecker *sc,
00680 const UChar *id, int32_t length,
00681 int32_t *position,
00682 UErrorCode *status);
00683
00684
00712 U_STABLE int32_t U_EXPORT2
00713 uspoof_checkUTF8(const USpoofChecker *sc,
00714 const char *id, int32_t length,
00715 int32_t *position,
00716 UErrorCode *status);
00717
00718
00719 #if U_SHOW_CPLUSPLUS_API
00720
00743 U_STABLE int32_t U_EXPORT2
00744 uspoof_checkUnicodeString(const USpoofChecker *sc,
00745 const icu::UnicodeString &id,
00746 int32_t *position,
00747 UErrorCode *status);
00748
00749 #endif
00750
00751
00791 U_STABLE int32_t U_EXPORT2
00792 uspoof_areConfusable(const USpoofChecker *sc,
00793 const UChar *id1, int32_t length1,
00794 const UChar *id2, int32_t length2,
00795 UErrorCode *status);
00796
00797
00798
00824 U_STABLE int32_t U_EXPORT2
00825 uspoof_areConfusableUTF8(const USpoofChecker *sc,
00826 const char *id1, int32_t length1,
00827 const char *id2, int32_t length2,
00828 UErrorCode *status);
00829
00830
00831
00832
00833 #if U_SHOW_CPLUSPLUS_API
00834
00855 U_STABLE int32_t U_EXPORT2
00856 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
00857 const icu::UnicodeString &s1,
00858 const icu::UnicodeString &s2,
00859 UErrorCode *status);
00860 #endif
00861
00862
00895 U_STABLE int32_t U_EXPORT2
00896 uspoof_getSkeleton(const USpoofChecker *sc,
00897 uint32_t type,
00898 const UChar *id, int32_t length,
00899 UChar *dest, int32_t destCapacity,
00900 UErrorCode *status);
00901
00937 U_STABLE int32_t U_EXPORT2
00938 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
00939 uint32_t type,
00940 const char *id, int32_t length,
00941 char *dest, int32_t destCapacity,
00942 UErrorCode *status);
00943
00944 #if U_SHOW_CPLUSPLUS_API
00945
00970 U_I18N_API icu::UnicodeString & U_EXPORT2
00971 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
00972 uint32_t type,
00973 const icu::UnicodeString &id,
00974 icu::UnicodeString &dest,
00975 UErrorCode *status);
00976 #endif
00977
00989 U_STABLE const USet * U_EXPORT2
00990 uspoof_getInclusionSet(UErrorCode *status);
00991
01003 U_STABLE const USet * U_EXPORT2
01004 uspoof_getRecommendedSet(UErrorCode *status);
01005
01006 #if U_SHOW_CPLUSPLUS_API
01007
01019 U_STABLE const icu::UnicodeSet * U_EXPORT2
01020 uspoof_getInclusionUnicodeSet(UErrorCode *status);
01021
01033 U_STABLE const icu::UnicodeSet * U_EXPORT2
01034 uspoof_getRecommendedUnicodeSet(UErrorCode *status);
01035
01036 #endif
01037
01060 U_STABLE int32_t U_EXPORT2
01061 uspoof_serialize(USpoofChecker *sc,
01062 void *data, int32_t capacity,
01063 UErrorCode *status);
01064
01065
01066 #endif
01067
01068 #endif