(libidn.info.gz) Stringprep Functions

Info Catalog (libidn.info.gz) Utility Functions (libidn.info.gz) Top (libidn.info.gz) Punycode Functions
 
 4 Stringprep Functions
 **********************
 
 Stringprep describes a framework for preparing Unicode text strings in
 order to increase the likelihood that string input and string
 comparison work in ways that make sense for typical users throughout
 the world. The stringprep protocol is useful for protocol identifier
 values, company and personal names, internationalized domain names, and
 other text strings.
 
 4.1 Header file `stringprep.h'
 ==============================
 
 To use the functions explained in this chapter, you need to include the
 file `stringprep.h' using:
 
      #include <stringprep.h>
 
 4.2 Defining A Stringprep Profile
 =================================
 
 Further types and structures are defined for applications that want to
 specify their own stringprep profile.  As these are fairly obscure, and
 by necessity tied to the implementation, we do not document them here.
 Look into the `stringprep.h' header file, and the `profiles.c' source
 code for the details.
 
 4.3 Control Flags
 =================
 
  -- Stringprep flags: Stringprep_profile_flags STRINGPREP_NO_NFKC
      Disable the NFKC normalization, as well as selecting the non-NFKC
      case folding tables.  Usually the profile specifies BIDI and NFKC
      settings, and applications should not override it unless in
      special situations.
 
  -- Stringprep flags: Stringprep_profile_flags STRINGPREP_NO_BIDI
      Disable the BIDI step.  Usually the profile specifies BIDI and NFKC
      settings, and applications should not override it unless in special
      situations.
 
  -- Stringprep flags: Stringprep_profile_flags STRINGPREP_NO_UNASSIGNED
      Make the library return with an error if string contains unassigned
      characters according to profile.
 
 4.4 Core Functions
 ==================
 
 stringprep_4i
 -------------
 
  -- Function: int stringprep_4i (uint32_t * UCS4, size_t * LEN, size_t
           MAXUCS4LEN, Stringprep_profile_flags FLAGS, const
           Stringprep_profile * PROFILE)
      UCS4: input/output array with string to prepare.
 
      LEN: on input, length of input array with Unicode code points, on
      exit, length of output array with Unicode code points.
 
      MAXUCS4LEN: maximum length of input/output array.
 
      FLAGS: a `Stringprep_profile_flags' value, or 0.
 
      PROFILE: pointer to `Stringprep_profile' to use.
 
      Prepare the input UCS-4 string according to the stringprep profile,
      and write back the result to the input string.
 
      The input is not required to be zero terminated (`ucs4'[`len'] =
      0).  The output will not be zero terminated unless `ucs4'[`len'] =
      0.  Instead, see `stringprep_4zi()' if your input is zero
      terminated or if you want the output to be.
 
      Since the stringprep operation can expand the string, `maxucs4len'
      indicate how large the buffer holding the string is.  This function
      will not read or write to code points outside that size.
 
      The `flags' are one of `Stringprep_profile_flags' values, or 0.
 
      The `profile' contain the `Stringprep_profile' instructions to
      perform.  Your application can define new profiles, possibly
      re-using the generic stringprep tables that always will be part of
      the library, or use one of the currently supported profiles.
 
      *Return value:* Returns `STRINGPREP_OK' iff successful, or an
      `Stringprep_rc' error code.
 
 stringprep_4zi
 --------------
 
  -- Function: int stringprep_4zi (uint32_t * UCS4, size_t MAXUCS4LEN,
           Stringprep_profile_flags FLAGS, const Stringprep_profile *
           PROFILE)
      UCS4: input/output array with zero terminated string to prepare.
 
      MAXUCS4LEN: maximum length of input/output array.
 
      FLAGS: a `Stringprep_profile_flags' value, or 0.
 
      PROFILE: pointer to `Stringprep_profile' to use.
 
      Prepare the input zero terminated UCS-4 string according to the
      stringprep profile, and write back the result to the input string.
 
      Since the stringprep operation can expand the string, `maxucs4len'
      indicate how large the buffer holding the string is.  This function
      will not read or write to code points outside that size.
 
      The `flags' are one of `Stringprep_profile_flags' values, or 0.
 
      The `profile' contain the `Stringprep_profile' instructions to
      perform.  Your application can define new profiles, possibly
      re-using the generic stringprep tables that always will be part of
      the library, or use one of the currently supported profiles.
 
      *Return value:* Returns `STRINGPREP_OK' iff successful, or an
      `Stringprep_rc' error code.
 
 stringprep
 ----------
 
  -- Function: int stringprep (char * IN, size_t MAXLEN,
           Stringprep_profile_flags FLAGS, const Stringprep_profile *
           PROFILE)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      FLAGS: a `Stringprep_profile_flags' value, or 0.
 
      PROFILE: pointer to `Stringprep_profile' to use.
 
      Prepare the input zero terminated UTF-8 string according to the
      stringprep profile, and write back the result to the input string.
 
      Note that you must convert strings entered in the systems locale
      into UTF-8 before using this function, see
      `stringprep_locale_to_utf8()'.
 
      Since the stringprep operation can expand the string, `maxlen'
      indicate how large the buffer holding the string is.  This function
      will not read or write to characters outside that size.
 
      The `flags' are one of `Stringprep_profile_flags' values, or 0.
 
      The `profile' contain the `Stringprep_profile' instructions to
      perform.  Your application can define new profiles, possibly
      re-using the generic stringprep tables that always will be part of
      the library, or use one of the currently supported profiles.
 
      *Return value:* Returns `STRINGPREP_OK' iff successful, or an
      error code.
 
 stringprep_profile
 ------------------
 
  -- Function: int stringprep_profile (const char * IN, char ** OUT,
           const char * PROFILE, Stringprep_profile_flags FLAGS)
      IN: input array with UTF-8 string to prepare.
 
      OUT: output variable with pointer to newly allocate string.
 
      PROFILE: name of stringprep profile to use.
 
      FLAGS: a `Stringprep_profile_flags' value, or 0.
 
      Prepare the input zero terminated UTF-8 string according to the
      stringprep profile, and return the result in a newly allocated
      variable.
 
      Note that you must convert strings entered in the systems locale
      into UTF-8 before using this function, see
      `stringprep_locale_to_utf8()'.
 
      The output `out' variable must be deallocated by the caller.
 
      The `flags' are one of `Stringprep_profile_flags' values, or 0.
 
      The `profile' specifies the name of the stringprep profile to use.
      It must be one of the internally supported stringprep profiles.
 
      *Return value:* Returns `STRINGPREP_OK' iff successful, or an
      error code.
 
 4.5 Error Handling
 ==================
 
 stringprep_strerror
 -------------------
 
  -- Function: const char * stringprep_strerror (Stringprep_rc RC)
      RC: a `Stringprep_rc' return code.
 
      Convert a return code integer to a text string.  This string can be
      used to output a diagnostic message to the user.
 
      *STRINGPREP_OK:* Successful operation.  This value is guaranteed to
      always be zero, the remaining ones are only guaranteed to hold
      non-zero values, for logical comparison purposes.
 
      *STRINGPREP_CONTAINS_UNASSIGNED:* String contain unassigned Unicode
      code points, which is forbidden by the profile.
 
      *STRINGPREP_CONTAINS_PROHIBITED:* String contain code points
      prohibited by the profile.
 
      *STRINGPREP_BIDI_BOTH_L_AND_RAL:* String contain code points with
      conflicting bidirection category.
 
      *STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:* Leading and trailing character
      in string not of proper bidirectional category.
 
      *STRINGPREP_BIDI_CONTAINS_PROHIBITED:* Contains prohibited code
      points detected by bidirectional code.
 
      *STRINGPREP_TOO_SMALL_BUFFER:* Buffer handed to function was too
      small.  This usually indicate a problem in the calling application.
 
      *STRINGPREP_PROFILE_ERROR:* The stringprep profile was
      inconsistent.  This usually indicate an internal error in the
      library.
 
      *STRINGPREP_FLAG_ERROR:* The supplied flag conflicted with profile.
      This usually indicate a problem in the calling application.
 
      *STRINGPREP_UNKNOWN_PROFILE:* The supplied profile name was not
      known to the library.
 
      *STRINGPREP_NFKC_FAILED:* The Unicode NFKC operation failed.  This
      usually indicate an internal error in the library.
 
      *STRINGPREP_MALLOC_ERROR:* The `malloc()' was out of memory.  This
      is usually a fatal error.
 
      *Return value:* Returns a pointer to a statically allocated string
      containing a description of the error with the return code `rc'.
 
 4.6 Stringprep Profile Macros
 =============================
 
  -- Function: int stringprep_nameprep_no_unassigned (char * IN, int
           MAXLEN)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      Prepare the input UTF-8 string according to the nameprep profile.
      The AllowUnassigned flag is false, use `stringprep_nameprep' for
      true AllowUnassigned.  Returns 0 iff successful, or an error code.
 
  -- Function: int stringprep_iscsi (char * IN, int MAXLEN)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      Prepare the input UTF-8 string according to the draft iSCSI
      stringprep profile.  Returns 0 iff successful, or an error code.
 
  -- Function: int stringprep_plain (char * IN, int MAXLEN)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      Prepare the input UTF-8 string according to the draft SASL
      ANONYMOUS profile.  Returns 0 iff successful, or an error code.
 
  -- Function: int stringprep_xmpp_nodeprep (char * IN, int MAXLEN)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      Prepare the input UTF-8 string according to the draft XMPP node
      identifier profile.  Returns 0 iff successful, or an error code.
 
  -- Function: int stringprep_xmpp_resourceprep (char * IN, int MAXLEN)
      IN: input/ouput array with string to prepare.
 
      MAXLEN: maximum length of input/output array.
 
      Prepare the input UTF-8 string according to the draft XMPP resource
      identifier profile.  Returns 0 iff successful, or an error code.
 
Info Catalog (libidn.info.gz) Utility Functions (libidn.info.gz) Top (libidn.info.gz) Punycode Functions
automatically generated by info2html