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

- Search for |

- File List
- Globals

# uspoof.h

Go to the documentation of this file.

    00001 /*
    00002 ***************************************************************************
    00003 * Copyright (C) 2008-2009, International Business Machines Corporation
    00004 * and others. All Rights Reserved.
    00005 ***************************************************************************
    00006 *   file name:  uspoof.h
    00007 *   encoding:   US-ASCII
    00008 *   tab size:   8 (not used)
    00009 *   indentation:4
    00010 *
    00011 *   created on: 2008Feb13
    00012 *   created by: Andy Heninger
    00013 *
    00014 *   Unicode Spoof Detection
    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
    00134 struct USpoofChecker;
    00135 typedef struct USpoofChecker USpoofChecker;
    00144 typedef enum USpoofChecks {
    00150     USPOOF_SINGLE_SCRIPT_CONFUSABLE =   1,
    00151
    00160     USPOOF_MIXED_SCRIPT_CONFUSABLE  =   2,
    00161
    00171     USPOOF_WHOLE_SCRIPT_CONFUSABLE  =   4,
    00172
    00179     USPOOF_ANY_CASE                 =   8,
    00180
    00185     USPOOF_SINGLE_SCRIPT            =  16,
    00186
    00193     USPOOF_INVISIBLE                =  32,
    00194
    00199     USPOOF_CHAR_LIMIT               =  64,
    00200
    00201     USPOOF_ALL_CHECKS               = 0x7f
    00202     } USpoofChecks;
    00203
    00204
    00215 U_DRAFT USpoofChecker * U_EXPORT2
    00216 uspoof_open(UErrorCode *status);
    00217
    00218
    00240 U_CAPI USpoofChecker * U_EXPORT2
    00241 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
    00242                           UErrorCode *pErrorCode);
    00243
    00275 U_CAPI USpoofChecker * U_EXPORT2
    00276 uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
    00277                       const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
    00278                       int32_t *errType, UParseError *pe, UErrorCode *status);
    00279
    00280
    00286 U_DRAFT void U_EXPORT2
    00287 uspoof_close(USpoofChecker *sc);
    00288
    00298 U_DRAFT USpoofChecker * U_EXPORT2
    00299 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
    00300
    00301
    00314 U_DRAFT void U_EXPORT2
    00315 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
    00316
    00328 U_DRAFT int32_t U_EXPORT2
    00329 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
    00330
    00373 U_DRAFT void U_EXPORT2
    00374 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
    00375
    00397 U_DRAFT const char * U_EXPORT2
    00398 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
    00399
    00400
    00419 U_DRAFT void U_EXPORT2
    00420 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
    00421
    00422
    00443 U_DRAFT const USet * U_EXPORT2
    00444 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
    00445
    00446
    00447 #ifdef XP_CPLUSPLUS
    00448
    00466 U_DRAFT void U_EXPORT2
    00467 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status);
    00468
    00469
    00490 U_DRAFT const UnicodeSet * U_EXPORT2
    00491 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
    00492 #endif
    00493
    00494
    00523 U_DRAFT int32_t U_EXPORT2
    00524 uspoof_check(const USpoofChecker *sc,
    00525                          const UChar *text, int32_t length,
    00526                          int32_t *position,
    00527                          UErrorCode *status);
    00528
    00529
    00558 U_DRAFT int32_t U_EXPORT2
    00559 uspoof_checkUTF8(const USpoofChecker *sc,
    00560                  const char *text, int32_t length,
    00561                  int32_t *position,
    00562                  UErrorCode *status);
    00563
    00564
    00565 #ifdef XP_CPLUSPLUS
    00566
    00591 U_DRAFT int32_t U_EXPORT2
    00592 uspoof_checkUnicodeString(const USpoofChecker *sc,
    00593                           const U_NAMESPACE_QUALIFIER UnicodeString &text,
    00594                           int32_t *position,
    00595                           UErrorCode *status);
    00596
    00597 #endif
    00598
    00599
    00639 U_DRAFT int32_t U_EXPORT2
    00640 uspoof_areConfusable(const USpoofChecker *sc,
    00641                      const UChar *s1, int32_t length1,
    00642                      const UChar *s2, int32_t length2,
    00643                      UErrorCode *status);
    00644
    00645
    00646
    00672 U_DRAFT int32_t U_EXPORT2
    00673 uspoof_areConfusableUTF8(const USpoofChecker *sc,
    00674                          const char *s1, int32_t length1,
    00675                          const char *s2, int32_t length2,
    00676                          UErrorCode *status);
    00677
    00678
    00679
    00680
    00681 #ifdef XP_CPLUSPLUS
    00682
    00703 U_DRAFT int32_t U_EXPORT2
    00704 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
    00705                                   const U_NAMESPACE_QUALIFIER UnicodeString &s1,
    00706                                   const U_NAMESPACE_QUALIFIER UnicodeString &s2,
    00707                                   UErrorCode *status);
    00708 #endif
    00709
    00710
    00743 U_DRAFT int32_t U_EXPORT2
    00744 uspoof_getSkeleton(const USpoofChecker *sc,
    00745                    uint32_t type,
    00746                    const UChar *s,  int32_t length,
    00747                    UChar *dest, int32_t destCapacity,
    00748                    UErrorCode *status);
    00749
    00785 U_DRAFT int32_t U_EXPORT2
    00786 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
    00787                        uint32_t type,
    00788                        const char *s,  int32_t length,
    00789                        char *dest, int32_t destCapacity,
    00790                        UErrorCode *status);
    00791
    00792 #ifdef XP_CPLUSPLUS
    00793
    00821 U_DRAFT UnicodeString & U_EXPORT2
    00822 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
    00823                                 uint32_t type,
    00824                                 const UnicodeString &s,
    00825                                 UnicodeString &dest,
    00826                                 UErrorCode *status);
    00827 #endif   /* XP_CPLUSPLUS */
    00828
    00829
    00848 U_CAPI int32_t U_EXPORT2
    00849 uspoof_serialize(USpoofChecker *sc,
    00850                  void *data, int32_t capacity,
    00851                  UErrorCode *status);
    00852
    00853
    00854 #endif   /* USPOOF_H */