Libstringprep README -- important introductory notes
See the end for copying conditions.

Libstringprep is an implementation of the IETF stringprep
specification, licensed under the LGPL.

Libstringprep is unstable and in its early steps of development.  You
should expect it to not work as well as having security problems.

Currently the API include the following definitions and functions:

Header file: #include <stringprep.h>

     Main API header file.

Header file: #include <stringprep_nameprep.h>
Header file: #include <stringprep_kerbero5.h>

     Convenience header files for stringprep_nameprep* and
     stringprep_kerberos5 macros (see below).

Function: int stringprep (char *in, int maxlen, int flags,
                          stringprep_profile * profile);

     Perform stringprep on a zero terminated UTF-8 string.  Since the
     stringprep operation can expand the string, maxlen indicate how
     large the buffer holding the string is.  See below for valid
     flags options.  The profile indicates processing details, see the
     profile header files, such as stringprep_generic.h and
     stringprep_nameprep.h for two examples.  Your application can
     define new profiles, possibly re-using the generic stringprep
     tables that always will be part of the library.  Note that you
     must convert strings entered in the systems locale into UTF-8
     before using this function.

Macro: int stringprep_nameprep(char *in, int maxlen)
Macro: int stringprep_nameprep_no_unassigned(char *in, int maxlen)
Macro: int stringprep_kerberos5(char *in, int maxlen)

     Short-hand macros for applying Nameprep with
     AllowUnassigned=TRUE, Nameprep with AllowUnassigned=FALSE and
     Kerberos 5 stringprep profiles to strings, respectively.

Type: STRINGPREP_NO_NFKC
Type: STRINGPREP_NO_BIDI
Type: STRINGPREP_NO_UNASSIGNED

     Valid options to the FLAGS parameter of stringprep().
     STRINGPREP_NO_NFKC disables the NFKC normalization, as well as
     selecting the non-NFKC case folding tables. STRINGPREP_NO_BIDI
     disables the BIDI step.  STRINGPREP_NO_UNASSIGNED causes
     stringprep() abort with an error if string contains unassigned
     characters according to profile.  Usually the profile specifies
     BIDI and NFKC settings.

The library also contains the following utility functions:

Function: int stringprep_unichar_to_utf8 (long c, char *outbuf);
Function: long stringprep_utf8_to_unichar (const char *p);

     Convert between Unicode (UCS4) and UTF-8, one character only.

Function: long *stringprep_utf8_to_ucs4 (const char *str, int  len,
				      int *items_written);
Function: char *stringprep_ucs4_to_utf8 (const long * str, int len,
				      int * items_read, int * items_written);

     Convert between Unicode (UCS4) and UTF-8, zero-terminated strings.

Function: char *stringprep_utf8_nfkc_normalize (const char *str, int len);
Function: long *stringprep_ucs4_nfkc_normalize (long *str, int len);

     Perform NFKC normalization on strings.

Function: const char *stringprep_locale_charset ();
Function: char *stringprep_convert (const char *str,
				 const char *to_codeset,
				 const char *from_codeset);
Function: char *stringprep_locale_to_utf8 (const char *str);

     Convert strings between character sets.

Macro: STRINGPREP_VERSION

     CPP definition, a string with version of the stringprep header file.

Function: extern char *stringprep_check_version (char *req_version);

     Check that the the version of the library is at minimum the one
     given as a string in REQ_VERSION and return the actual version
     string of the library; return NULL if the condition is not met.
     If `NULL' is passed to this function no check is done and only the
     version string is returned.

Libstringprep has at some point in time passed the self tests on the
following systems, but no guarantees.

  - alphaev67-dec-osf5.0 (Tru64 UNIX C, Tru64 make -- iconv failed!)
  - i686-pc-linux-gnu (Debian Sid, iconv ok)
  - i686-pc-linux-gnu (RedHat 7.2, iconv ok)
  - mips-sgi-irix6.5 (MIPS C compiler, IRIX make, iconv ok)
  - rs6000-ibm-aix4.3.2.0 (GCC 2.9-aix43-000718, GNU make, iconv failed!)
  - rs6000-ibm-aix4.3.2.0 (IBM C for AIX compiler, AIX make, iconv failed!)
  - sparc-sun-solaris2.6 (Sun WorkShop Compiler C 5.0, non-GNU make)
  - sparc-sun-solaris2.8 (Sun WorkShop Compiler C 6.0U2, SUN make, iconv ok)
  - sparc-sun-solaris2.8 (GCC 3.1, GNU make, iconv ok)
  - ... and over 10 other unix systems.

Things left to do below.  If you like to start working on anything,
please let me know so work duplication can be avoided.

  - Optimize it, the table searching is slow (but does it matter?).
  - Port applications to use libstringprep.
  - Include tables for more stringprep profiles.
  - Add texi documentation.
  - Implement rest of IDN?  Possibly separate project.

Before it becomes a FAQ: This library do not link with GLIB for the
UTF-8 functions for two reasons.  First, GLIB does not provide
versioning of the Unicode tables (and the developers said it will not
be added either) and this package must know the Unicode version used.
Secondly, GLIB requires some things (e.g., threads) that would make
this package less portable.

For more information see <URL:http://josefsson.org/libstringprep/>.

Send all bug reports by electronic mail to bug-libstringprep@josefsson.org.

----------------------------------------------------------------------
Copyright information:

Copyright (C) 2002 Simon Josefsson

   Permission is granted to anyone to make or distribute verbatim copies
   of this document as received, in any medium, provided that the
   copyright notice and this permission notice are preserved,
   thus giving the recipient permission to redistribute in turn.

   Permission is granted to distribute modified versions
   of this document, or of portions of it,
   under the above conditions, provided also that they
   carry prominent notices stating who last changed them.
