00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00022 #ifndef USPOOF_H
00023 #define USPOOF_H
00024
00025 #include "unicode/utypes.h"
00026 #include "unicode/uset.h"
00027 #include "unicode/parseerr.h"
00028
00029 #ifdef XP_CPLUSPLUS
00030 #include "unicode/unistr.h"
00031 #include "unicode/uniset.h"
00032
00033 U_NAMESPACE_USE
00034 #endif
00035
00036
00100 struct USpoofChecker;
00101 typedef struct USpoofChecker USpoofChecker;
00110 typedef enum USpoofChecks {
00114 USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1,
00115
00124 USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
00125
00135 USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4,
00136
00140 USPOOF_ANY_CASE = 8,
00141
00146 USPOOF_SINGLE_SCRIPT = 16,
00147
00154 USPOOF_INVISIBLE = 32,
00155 USPOOF_CHAR_LIMIT = 64,
00156 USPOOF_ALL_CHECKS = 0x7f
00157 } USpoofChecks;
00158
00159
00170 U_DRAFT USpoofChecker * U_EXPORT2
00171 uspoof_open(UErrorCode *status);
00172
00173
00195 U_CAPI USpoofChecker * U_EXPORT2
00196 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
00197 UErrorCode *pErrorCode);
00198
00230 U_CAPI USpoofChecker * U_EXPORT2
00231 uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
00232 const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
00233 int32_t *errType, UParseError *pe, UErrorCode *status);
00234
00235
00241 U_DRAFT void U_EXPORT2
00242 uspoof_close(USpoofChecker *sc);
00243
00253 U_DRAFT USpoofChecker * U_EXPORT2
00254 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
00255
00256
00269 U_DRAFT void U_EXPORT2
00270 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
00271
00283 U_DRAFT int32_t U_EXPORT2
00284 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
00285
00322 U_DRAFT void U_EXPORT2
00323 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
00324
00346 U_DRAFT const char * U_EXPORT2
00347 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
00348
00349
00368 U_DRAFT void U_EXPORT2
00369 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
00370
00371
00392 U_DRAFT const USet * U_EXPORT2
00393 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
00394
00395
00396 #ifdef XP_CPLUSPLUS
00397
00415 U_DRAFT void U_EXPORT2
00416 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status);
00417
00418
00439 U_DRAFT const UnicodeSet * U_EXPORT2
00440 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
00441 #endif
00442
00443
00472 U_DRAFT int32_t U_EXPORT2
00473 uspoof_check(const USpoofChecker *sc,
00474 const UChar *text, int32_t length,
00475 int32_t *position,
00476 UErrorCode *status);
00477
00478
00507 U_DRAFT int32_t U_EXPORT2
00508 uspoof_checkUTF8(const USpoofChecker *sc,
00509 const char *text, int32_t length,
00510 int32_t *position,
00511 UErrorCode *status);
00512
00513
00514 #ifdef XP_CPLUSPLUS
00515
00540 U_DRAFT int32_t U_EXPORT2
00541 uspoof_checkUnicodeString(const USpoofChecker *sc,
00542 const U_NAMESPACE_QUALIFIER UnicodeString &text,
00543 int32_t *position,
00544 UErrorCode *status);
00545
00546 #endif
00547
00548
00583 U_DRAFT int32_t U_EXPORT2
00584 uspoof_areConfusable(const USpoofChecker *sc,
00585 const UChar *s1, int32_t length1,
00586 const UChar *s2, int32_t length2,
00587 int32_t *position,
00588 UErrorCode *status);
00589
00590
00591
00623 U_DRAFT int32_t U_EXPORT2
00624 uspoof_areConfusableUTF8(const USpoofChecker *sc,
00625 const char *s1, int32_t length1,
00626 const char *s2, int32_t length2,
00627 int32_t *position,
00628 UErrorCode *status);
00629
00630
00631
00632
00633 #ifdef XP_CPLUSPLUS
00634
00661 U_DRAFT int32_t U_EXPORT2
00662 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
00663 const U_NAMESPACE_QUALIFIER UnicodeString &s1,
00664 const U_NAMESPACE_QUALIFIER UnicodeString &s2,
00665 int32_t *position,
00666 UErrorCode *status);
00667 #endif
00668
00669
00702 U_DRAFT int32_t U_EXPORT2
00703 uspoof_getSkeleton(const USpoofChecker *sc,
00704 uint32_t type,
00705 const UChar *s, int32_t length,
00706 UChar *dest, int32_t destCapacity,
00707 UErrorCode *status);
00708
00744 U_DRAFT int32_t U_EXPORT2
00745 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
00746 uint32_t type,
00747 const char *s, int32_t length,
00748 char *dest, int32_t destCapacity,
00749 UErrorCode *status);
00750
00751 #ifdef XP_CPLUSPLUS
00752
00780 U_DRAFT UnicodeString & U_EXPORT2
00781 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
00782 uint32_t type,
00783 const UnicodeString &s,
00784 UnicodeString &dest,
00785 UErrorCode *status);
00786 #endif
00787
00788
00807 U_CAPI int32_t U_EXPORT2
00808 uspoof_serialize(USpoofChecker *sc,
00809 void *data, int32_t capacity,
00810 UErrorCode *status);
00811
00812
00813 #endif