keyhole logo

Functions
Heimdal wind library

Functions

int wind_punycode_label_toascii (const uint32_t *in, size_t in_len, char *out, size_t *out_len)
 
int wind_stringprep (const uint32_t *in, size_t in_len, uint32_t *out, size_t *out_len, wind_profile_flags flags)
 
int wind_profile (const char *name, wind_profile_flags *flags)
 
int wind_utf8ucs4 (const char *in, uint32_t *out, size_t *out_len)
 
int wind_utf8ucs4_length (const char *in, size_t *out_len)
 
int wind_ucs4utf8 (const uint32_t *in, size_t in_len, char *out, size_t *out_len)
 
int wind_ucs4utf8_length (const uint32_t *in, size_t in_len, size_t *out_len)
 
int wind_ucs2read (const void *ptr, size_t len, unsigned int *flags, uint16_t *out, size_t *out_len)
 
int wind_ucs2write (const uint16_t *in, size_t in_len, unsigned int *flags, void *ptr, size_t *out_len)
 
int wind_utf8ucs2 (const char *in, uint16_t *out, size_t *out_len)
 
int wind_utf8ucs2_length (const char *in, size_t *out_len)
 
int wind_ucs2utf8 (const uint16_t *in, size_t in_len, char *out, size_t *out_len)
 
int wind_ucs2utf8_length (const uint16_t *in, size_t in_len, size_t *out_len)
 

Detailed Description

Function Documentation

◆ wind_profile()

int wind_profile ( const char *  name,
wind_profile_flags *  flags 
)

Try to find the profile given a name.

Parameters
namename of the profile.
flagsthe resulting profile.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_punycode_label_toascii()

int wind_punycode_label_toascii ( const uint32_t *  in,
size_t  in_len,
char *  out,
size_t *  out_len 
)

Convert an UCS4 string to a puny-coded DNS label string suitable when combined with delimiters and other labels for DNS lookup.

Parameters
inan UCS4 string to convert
in_lenthe length of in.
outthe resulting puny-coded string. The string is not NUL terminatied.
out_lenbefore processing out_len should be the length of the out variable, after processing it will be the length of the out string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_stringprep()

int wind_stringprep ( const uint32_t *  in,
size_t  in_len,
uint32_t *  out,
size_t *  out_len,
wind_profile_flags  flags 
)

Process a input UCS4 string according a string-prep profile.

Parameters
ininput UCS4 string to process
in_lenlength of the input string
outoutput UCS4 string
out_lenlength of the output string.
flagsstringprep profile.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_ucs2read()

int wind_ucs2read ( const void *  ptr,
size_t  len,
unsigned int *  flags,
uint16_t *  out,
size_t *  out_len 
)

Read in an UCS2 from a buffer.

Parameters
ptrThe input buffer to read from.
lenthe length of the input buffer.
flagsFlags to control the behavior of the function.
outthe output UCS2, the array must be at least out/2 long.
out_lenthe output length
Returns
returns 0 on success, an wind error code otherwise.

if len is zero, flags are unchanged

if len is odd, WIND_ERR_LENGTH_NOT_MOD2 is returned

If the flags WIND_RW_BOM is set, check for BOM. If not BOM is found, check is LE/BE flag is already and use that otherwise fail with WIND_ERR_NO_BOM. When done, clear WIND_RW_BOM and the LE/BE flag and set the resulting LE/BE flag.

◆ wind_ucs2utf8()

int wind_ucs2utf8 ( const uint16_t *  in,
size_t  in_len,
char *  out,
size_t *  out_len 
)

Convert an UCS2 string to a UTF-8 string.

Parameters
inan UCS2 string to convert.
in_lenthe length of the in UCS2 string.
outthe resulting UTF-8 strint, must be at least wind_ucs2utf8_length() long. If out is NULL, the function will calculate the needed space for the out variable (just like wind_ucs2utf8_length()).
out_lenbefore processing out_len should be the length of the out variable, after processing it will be the length of the out string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_ucs2utf8_length()

int wind_ucs2utf8_length ( const uint16_t *  in,
size_t  in_len,
size_t *  out_len 
)

Calculate the length of from converting a UCS2 string to an UTF-8 string.

Parameters
inan UCS2 string to convert.
in_lenan UCS2 string length to convert.
out_lenthe length of the resulting UTF-8 string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_ucs2write()

int wind_ucs2write ( const uint16_t *  in,
size_t  in_len,
unsigned int *  flags,
void *  ptr,
size_t *  out_len 
)

Write an UCS2 string to a buffer.

Parameters
inThe input UCS2 string.
in_lenthe length of the input buffer.
flagsFlags to control the behavior of the function.
ptrThe input buffer to write to, the array must be at least (in + 1) * 2 bytes long.
out_lenthe output length
Returns
returns 0 on success, an wind error code otherwise.

If in buffer is not of length be mod 2, WIND_ERR_LENGTH_NOT_MOD2 is returned

On zero input length, flags are preserved

If flags have WIND_RW_BOM set, the byte order mark is written first to the output data

If the output wont fit into out_len, WIND_ERR_OVERRUN is returned

◆ wind_ucs4utf8()

int wind_ucs4utf8 ( const uint32_t *  in,
size_t  in_len,
char *  out,
size_t *  out_len 
)

Convert an UCS4 string to a UTF-8 string.

Parameters
inan UCS4 string to convert.
in_lenthe length input array.
outthe resulting UTF-8 strint, must be at least wind_ucs4utf8_length() + 1 long (the extra char for the NUL). If out is NULL, the function will calculate the needed space for the out variable (just like wind_ucs4utf8_length()).
out_lenbefore processing out_len should be the length of the out variable, after processing it will be the length of the out string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_ucs4utf8_length()

int wind_ucs4utf8_length ( const uint32_t *  in,
size_t  in_len,
size_t *  out_len 
)

Calculate the length of from converting a UCS4 string to an UTF-8 string.

Parameters
inan UCS4 string to convert.
in_lenthe length of UCS4 string to convert.
out_lenthe length of the resulting UTF-8 string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_utf8ucs2()

int wind_utf8ucs2 ( const char *  in,
uint16_t *  out,
size_t *  out_len 
)

Convert an UTF-8 string to an UCS2 string.

Parameters
inan UTF-8 string to convert.
outthe resulting UCS2 strint, must be at least wind_utf8ucs2_length() long. If out is NULL, the function will calculate the needed space for the out variable (just like wind_utf8ucs2_length()).
out_lenbefore processing out_len should be the length of the out variable, after processing it will be the length of the out string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_utf8ucs2_length()

int wind_utf8ucs2_length ( const char *  in,
size_t *  out_len 
)

Calculate the length of from converting a UTF-8 string to a UCS2 string.

Parameters
inan UTF-8 string to convert.
out_lenthe length of the resulting UCS4 string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_utf8ucs4()

int wind_utf8ucs4 ( const char *  in,
uint32_t *  out,
size_t *  out_len 
)

Convert an UTF-8 string to an UCS4 string.

Parameters
inan UTF-8 string to convert.
outthe resulting UCS4 strint, must be at least wind_utf8ucs4_length() long. If out is NULL, the function will calculate the needed space for the out variable (just like wind_utf8ucs4_length()).
out_lenbefore processing out_len should be the length of the out variable, after processing it will be the length of the out string.
Returns
returns 0 on success, an wind error code otherwise

◆ wind_utf8ucs4_length()

int wind_utf8ucs4_length ( const char *  in,
size_t *  out_len 
)

Calculate the length of from converting a UTF-8 string to a UCS4 string.

Parameters
inan UTF-8 string to convert.
out_lenthe length of the resulting UCS4 string.
Returns
returns 0 on success, an wind error code otherwise

Generated on Tue Nov 15 2022 14:04:26 for Heimdal wind library by doxygen 1.9.1