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

- File List
- Globals

# uspoof.h

Go to the documentation of this file.

    00001 /*
    00002 ***************************************************************************
    00003 * Copyright (C) 2008-2010, 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 #include "unicode/localpointer.h"
    00029
    00030 #if !UCONFIG_NO_NORMALIZATION
    00031
    00032
    00033 #if U_SHOW_CPLUSPLUS_API
    00034 #include "unicode/unistr.h"
    00035 #include "unicode/uniset.h"
    00036
    00037 U_NAMESPACE_USE
    00038 #endif
    00039
    00040
    00151 struct USpoofChecker;
    00152 typedef struct USpoofChecker USpoofChecker;
    00161 typedef enum USpoofChecks {
    00167     USPOOF_SINGLE_SCRIPT_CONFUSABLE =   1,
    00168
    00177     USPOOF_MIXED_SCRIPT_CONFUSABLE  =   2,
    00178
    00188     USPOOF_WHOLE_SCRIPT_CONFUSABLE  =   4,
    00189
    00196     USPOOF_ANY_CASE                 =   8,
    00197
    00202     USPOOF_SINGLE_SCRIPT            =  16,
    00203
    00210     USPOOF_INVISIBLE                =  32,
    00211
    00216     USPOOF_CHAR_LIMIT               =  64,
    00217
    00218     USPOOF_ALL_CHECKS               = 0x7f
    00219     } USpoofChecks;
    00220
    00221
    00232 U_STABLE USpoofChecker * U_EXPORT2
    00233 uspoof_open(UErrorCode *status);
    00234
    00235
    00257 U_CAPI USpoofChecker * U_EXPORT2
    00258 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
    00259                           UErrorCode *pErrorCode);
    00260
    00292 U_CAPI USpoofChecker * U_EXPORT2
    00293 uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
    00294                       const char *confusablesWholeScript, int32_t confusablesWholeScriptLen,
    00295                       int32_t *errType, UParseError *pe, UErrorCode *status);
    00296
    00297
    00303 U_STABLE void U_EXPORT2
    00304 uspoof_close(USpoofChecker *sc);
    00305
    00306 #if U_SHOW_CPLUSPLUS_API
    00307
    00308 U_NAMESPACE_BEGIN
    00309
    00319 U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
    00320
    00321 U_NAMESPACE_END
    00322
    00323 #endif
    00324
    00334 U_STABLE USpoofChecker * U_EXPORT2
    00335 uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
    00336
    00337
    00350 U_STABLE void U_EXPORT2
    00351 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
    00352
    00364 U_STABLE int32_t U_EXPORT2
    00365 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
    00366
    00409 U_STABLE void U_EXPORT2
    00410 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
    00411
    00433 U_STABLE const char * U_EXPORT2
    00434 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
    00435
    00436
    00455 U_STABLE void U_EXPORT2
    00456 uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
    00457
    00458
    00479 U_STABLE const USet * U_EXPORT2
    00480 uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
    00481
    00482
    00483 #if U_SHOW_CPLUSPLUS_API
    00484
    00502 U_STABLE void U_EXPORT2
    00503 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status);
    00504
    00505
    00526 U_STABLE const UnicodeSet * U_EXPORT2
    00527 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
    00528 #endif
    00529
    00530
    00559 U_STABLE int32_t U_EXPORT2
    00560 uspoof_check(const USpoofChecker *sc,
    00561                          const UChar *text, int32_t length,
    00562                          int32_t *position,
    00563                          UErrorCode *status);
    00564
    00565
    00594 U_STABLE int32_t U_EXPORT2
    00595 uspoof_checkUTF8(const USpoofChecker *sc,
    00596                  const char *text, int32_t length,
    00597                  int32_t *position,
    00598                  UErrorCode *status);
    00599
    00600
    00601 #if U_SHOW_CPLUSPLUS_API
    00602
    00627 U_STABLE int32_t U_EXPORT2
    00628 uspoof_checkUnicodeString(const USpoofChecker *sc,
    00629                           const U_NAMESPACE_QUALIFIER UnicodeString &text,
    00630                           int32_t *position,
    00631                           UErrorCode *status);
    00632
    00633 #endif
    00634
    00635
    00675 U_STABLE int32_t U_EXPORT2
    00676 uspoof_areConfusable(const USpoofChecker *sc,
    00677                      const UChar *s1, int32_t length1,
    00678                      const UChar *s2, int32_t length2,
    00679                      UErrorCode *status);
    00680
    00681
    00682
    00708 U_STABLE int32_t U_EXPORT2
    00709 uspoof_areConfusableUTF8(const USpoofChecker *sc,
    00710                          const char *s1, int32_t length1,
    00711                          const char *s2, int32_t length2,
    00712                          UErrorCode *status);
    00713
    00714
    00715
    00716
    00717 #if U_SHOW_CPLUSPLUS_API
    00718
    00739 U_STABLE int32_t U_EXPORT2
    00740 uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
    00741                                   const U_NAMESPACE_QUALIFIER UnicodeString &s1,
    00742                                   const U_NAMESPACE_QUALIFIER UnicodeString &s2,
    00743                                   UErrorCode *status);
    00744 #endif
    00745
    00746
    00779 U_STABLE int32_t U_EXPORT2
    00780 uspoof_getSkeleton(const USpoofChecker *sc,
    00781                    uint32_t type,
    00782                    const UChar *s,  int32_t length,
    00783                    UChar *dest, int32_t destCapacity,
    00784                    UErrorCode *status);
    00785
    00821 U_STABLE int32_t U_EXPORT2
    00822 uspoof_getSkeletonUTF8(const USpoofChecker *sc,
    00823                        uint32_t type,
    00824                        const char *s,  int32_t length,
    00825                        char *dest, int32_t destCapacity,
    00826                        UErrorCode *status);
    00827
    00828 #if U_SHOW_CPLUSPLUS_API
    00829
    00857 U_STABLE UnicodeString & U_EXPORT2
    00858 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
    00859                                 uint32_t type,
    00860                                 const UnicodeString &s,
    00861                                 UnicodeString &dest,
    00862                                 UErrorCode *status);
    00863 #endif   /* U_SHOW_CPLUSPLUS_API */
    00864
    00865
    00884 U_CAPI int32_t U_EXPORT2
    00885 uspoof_serialize(USpoofChecker *sc,
    00886                  void *data, int32_t capacity,
    00887                  UErrorCode *status);
    00888
    00889
    00890 #endif
    00891
    00892 #endif   /* USPOOF_H */

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines