stringprep

stringprep

Synopsis

#define             IDNA_API
#define             STRINGPREP_VERSION
enum                Stringprep_rc;
enum                Stringprep_profile_flags;
enum                Stringprep_profile_steps;
#define             STRINGPREP_MAX_MAP_CHARS
typedef             Stringprep_table_element;
typedef             Stringprep_profile;
typedef             Stringprep_profiles;
#define             stringprep_nameprep                 (in, maxlen)
#define             stringprep_nameprep_no_unassigned   (in, maxlen)
#define             stringprep_plain                    (in, maxlen)
#define             stringprep_kerberos5                (in, maxlen)
#define             stringprep_xmpp_nodeprep            (in, maxlen)
#define             stringprep_xmpp_resourceprep        (in, maxlen)
#define             stringprep_iscsi                    (in, maxlen)

Description

A longer description goes here.

Details

IDNA_API

#define             IDNA_API

STRINGPREP_VERSION

# define STRINGPREP_VERSION "1.11"

String defined via CPP denoting the header file version number. Used together with stringprep_check_version() to verify header file and run-time library consistency.


enum Stringprep_rc

  typedef enum
  {
    STRINGPREP_OK = 0,
    /* Stringprep errors. */
    STRINGPREP_CONTAINS_UNASSIGNED = 1,
    STRINGPREP_CONTAINS_PROHIBITED = 2,
    STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
    STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4,
    STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5,
    /* Error in calling application. */
    STRINGPREP_TOO_SMALL_BUFFER = 100,
    STRINGPREP_PROFILE_ERROR = 101,
    STRINGPREP_FLAG_ERROR = 102,
    STRINGPREP_UNKNOWN_PROFILE = 103,
    /* Internal errors. */
    STRINGPREP_NFKC_FAILED = 200,
    STRINGPREP_MALLOC_ERROR = 201
  } Stringprep_rc;

Enumerated return codes of stringprep(), stringprep_profile() functions (and macros using those functions). The value 0 is guaranteed to always correspond to success.

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.

enum Stringprep_profile_flags

  typedef enum
  {
    STRINGPREP_NO_NFKC = 1,
    STRINGPREP_NO_BIDI = 2,
    STRINGPREP_NO_UNASSIGNED = 4
  } Stringprep_profile_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_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_NO_UNASSIGNED

Make the library return with an error if string contains unassigned characters according to profile.

enum Stringprep_profile_steps

  typedef enum
  {
    STRINGPREP_NFKC = 1,
    STRINGPREP_BIDI = 2,
    STRINGPREP_MAP_TABLE = 3,
    STRINGPREP_UNASSIGNED_TABLE = 4,
    STRINGPREP_PROHIBIT_TABLE = 5,
    STRINGPREP_BIDI_PROHIBIT_TABLE = 6,
    STRINGPREP_BIDI_RAL_TABLE = 7,
    STRINGPREP_BIDI_L_TABLE = 8
  } Stringprep_profile_steps;

Various steps in the stringprep algorithm. You really want to study the source code to understand this one. Only useful if you want to add another profile.


STRINGPREP_MAX_MAP_CHARS

# define STRINGPREP_MAX_MAP_CHARS 4

Maximum number of code points that can replace a single code point, during stringprep mapping.


Stringprep_table_element

  typedef struct Stringprep_table_element Stringprep_table_element;

Stringprep_profile

  typedef struct Stringprep_table Stringprep_profile;

Stringprep_profiles

  typedef struct Stringprep_profiles Stringprep_profiles;

stringprep_nameprep()

#define             stringprep_nameprep(in, maxlen)

Prepare the input UTF-8 string according to the nameprep profile. The AllowUnassigned flag is true, use stringprep_nameprep_no_unassigned() if you want a false AllowUnassigned. Returns 0 iff successful, or an error code.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.

stringprep_nameprep_no_unassigned()

#define             stringprep_nameprep_no_unassigned(in, maxlen)

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.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.

stringprep_plain()

#define             stringprep_plain(in, maxlen)

Prepare the input UTF-8 string according to the draft SASL ANONYMOUS profile. Returns 0 iff successful, or an error code.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.

stringprep_kerberos5()

#define             stringprep_kerberos5(in, maxlen)

stringprep_xmpp_nodeprep()

#define             stringprep_xmpp_nodeprep(in, maxlen)

Prepare the input UTF-8 string according to the draft XMPP node identifier profile. Returns 0 iff successful, or an error code.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.

stringprep_xmpp_resourceprep()

#define             stringprep_xmpp_resourceprep(in, maxlen)

Prepare the input UTF-8 string according to the draft XMPP resource identifier profile. Returns 0 iff successful, or an error code.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.

stringprep_iscsi()

#define             stringprep_iscsi(in, maxlen)

Prepare the input UTF-8 string according to the draft iSCSI stringprep profile. Returns 0 iff successful, or an error code.

in :

input/ouput array with string to prepare.

maxlen :

maximum length of input/output array.