#include <stdlib.h>
#include <idn-int.h>
Go to the source code of this file.
Data Structures | |
struct | Tld_table_element |
struct | Tld_table |
Typedefs | |
typedef Tld_table_element | Tld_table_element |
typedef Tld_table | Tld_table |
Enumerations | |
enum | Tld_rc { TLD_SUCCESS = 0, TLD_INVALID = 1, TLD_NODATA = 2, TLD_MALLOC_ERROR = 3, TLD_ICONV_ERROR = 4, TLD_NO_TLD = 5, TLD_NOTLD = TLD_NO_TLD } |
Functions | |
const char * | tld_strerror (Tld_rc rc) |
int | tld_get_4 (const uint32_t *in, size_t inlen, char **out) |
int | tld_get_4z (const uint32_t *in, char **out) |
int | tld_get_z (const char *in, char **out) |
const Tld_table * | tld_get_table (const char *tld, const Tld_table **tables) |
const Tld_table * | tld_default_table (const char *tld, const Tld_table **overrides) |
int | tld_check_4t (const uint32_t *in, size_t inlen, size_t *errpos, const Tld_table *tld) |
int | tld_check_4tz (const uint32_t *in, size_t *errpos, const Tld_table *tld) |
int | tld_check_4 (const uint32_t *in, size_t inlen, size_t *errpos, const Tld_table **overrides) |
int | tld_check_4z (const uint32_t *in, size_t *errpos, const Tld_table **overrides) |
int | tld_check_8z (const char *in, size_t *errpos, const Tld_table **overrides) |
int | tld_check_lz (const char *in, size_t *errpos, const Tld_table **overrides) |
typedef struct Tld_table_element Tld_table_element |
enum Tld_rc |
int tld_check_4 | ( | const uint32_t * | in, | |
size_t | inlen, | |||
size_t * | errpos, | |||
const Tld_table ** | overrides | |||
) |
tld_check_4 - verify that characters are permitted
in | Array of unicode code points to process. Does not need to be zero terminated. | |
inlen | Number of unicode code points. | |
errpos | Position of offending character is returned here. | |
overrides | A Tld_table array of additional domain restriction structures that complement and supersede the built-in information. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all code points are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 348 of file tld.c.
References tld_check_4t(), tld_default_table(), tld_get_4(), TLD_NO_TLD, and TLD_SUCCESS.
Referenced by tld_check_4z(), and tld_check_8z().
int tld_check_4t | ( | const uint32_t * | in, | |
size_t | inlen, | |||
size_t * | errpos, | |||
const Tld_table * | tld | |||
) |
tld_check_4t - verify that characters are permitted
in | Array of unicode code points to process. Does not need to be zero terminated. | |
inlen | Number of unicode code points. | |
errpos | Position of offending character is returned here. | |
tld | A Tld_table data structure representing the restrictions for which the input should be tested. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all code points are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 269 of file tld.c.
References TLD_SUCCESS, and uint32_t.
Referenced by tld_check_4(), and tld_check_4tz().
int tld_check_4tz | ( | const uint32_t * | in, | |
size_t * | errpos, | |||
const Tld_table * | tld | |||
) |
tld_check_4tz - verify that characters are permitted
in | Zero terminated array of unicode code points to process. | |
errpos | Position of offending character is returned here. | |
tld | A Tld_table data structure representing the restrictions for which the input should be tested. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all code points are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 311 of file tld.c.
References tld_check_4t(), TLD_NODATA, and uint32_t.
int tld_check_4z | ( | const uint32_t * | in, | |
size_t * | errpos, | |||
const Tld_table ** | overrides | |||
) |
tld_check_4z - verify that characters are permitted
in | Zero-terminated array of unicode code points to process. | |
errpos | Position of offending character is returned here. | |
overrides | A Tld_table array of additional domain restriction structures that complement and supersede the built-in information. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all code points are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 398 of file tld.c.
References tld_check_4(), TLD_NODATA, and uint32_t.
int tld_check_8z | ( | const char * | in, | |
size_t * | errpos, | |||
const Tld_table ** | overrides | |||
) |
tld_check_8z - verify that characters are permitted
in | Zero-terminated UTF8 string to process. | |
errpos | Position of offending character is returned here. | |
overrides | A Tld_table array of additional domain restriction structures that complement and supersede the built-in information. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all characters are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 436 of file tld.c.
References stringprep_utf8_to_ucs4(), tld_check_4(), TLD_MALLOC_ERROR, TLD_NODATA, and uint32_t.
Referenced by tld_check_lz().
int tld_check_lz | ( | const char * | in, | |
size_t * | errpos, | |||
const Tld_table ** | overrides | |||
) |
tld_check_lz - verify that characters are permitted
in | Zero-terminated string in the current locales encoding to process. | |
errpos | Position of offending character is returned here. | |
overrides | A Tld_table array of additional domain restriction structures that complement and supersede the built-in information. |
Return value: Returns the Tld_rc value TLD_SUCCESS if all characters are valid or when is null, TLD_INVALID if a character is not allowed, or additional error codes on general failure conditions.
Definition at line 481 of file tld.c.
References stringprep_locale_to_utf8(), tld_check_8z(), TLD_ICONV_ERROR, and TLD_NODATA.
tld_default_table - get table for a TLD name
tld | TLD name (e.g. "com") as zero terminated ASCII byte string. | |
overrides | Additional zero terminated array of Tld_table info-structures for TLDs, or NULL to only use library deault tables. |
Return value: Return structure corresponding to TLD , first looking through then thru built-in list, or NULL if no such structure found.
Definition at line 79 of file tld.c.
References _tld_tables, and tld_get_table().
Referenced by tld_check_4().
int tld_get_4 | ( | const uint32_t * | in, | |
size_t | inlen, | |||
char ** | out | |||
) |
tld_get_4 - extract top level domain part in input Unicode string
in | Array of unicode code points to process. Does not need to be zero terminated. | |
inlen | Number of unicode code points. | |
out | Zero terminated ascii result string pointer. |
Return value: Return TLD_SUCCESS on success, or the corresponding Tld_rc error code otherwise.
Definition at line 112 of file tld.c.
References DOTP, TLD_MALLOC_ERROR, TLD_NO_TLD, TLD_NODATA, TLD_SUCCESS, and uint32_t.
Referenced by tld_check_4(), tld_get_4z(), and tld_get_z().
int tld_get_4z | ( | const uint32_t * | in, | |
char ** | out | |||
) |
tld_get_4z - extract top level domain part in input Unicode string
in | Zero terminated array of unicode code points to process. | |
out | Zero terminated ascii result string pointer. |
Return value: Return TLD_SUCCESS on success, or the corresponding Tld_rc error code otherwise.
Definition at line 160 of file tld.c.
References tld_get_4(), TLD_NODATA, and uint32_t.
tld_get_table - get table for a TLD name in table
tld | TLD name (e.g. "com") as zero terminated ASCII byte string. | |
tables | Zero terminated array of Tld_table info-structures for TLDs. |
Return value: Return structure corresponding to TLD by going thru , or return NULL if no such structure is found.
Definition at line 50 of file tld.c.
References Stringprep_profiles::tables.
Referenced by tld_default_table().
int tld_get_z | ( | const char * | in, | |
char ** | out | |||
) |
tld_get_z - extract top level domain part in input string
in | Zero terminated character array to process. | |
out | Zero terminated ascii result string pointer. |
Return value: Return TLD_SUCCESS on success, or the corresponding Tld_rc error code otherwise.
Definition at line 186 of file tld.c.
References tld_get_4(), TLD_MALLOC_ERROR, and uint32_t.
const char* tld_strerror | ( | Tld_rc | rc | ) |
tld_strerror - return string describing tld error code
rc | tld return code |
TLD_SUCCESS: 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. TLD_INVALID: Invalid character found. TLD_NODATA: No input data was provided. TLD_MALLOC_ERROR: Error during memory allocation. TLD_ICONV_ERROR: Error during iconv string conversion. TLD_NO_TLD: No top-level domain found in domain string.
Return value: Returns a pointer to a statically allocated string containing a description of the error with the return code .
Definition at line 51 of file strerror-tld.c.
References _, TLD_ICONV_ERROR, TLD_INVALID, TLD_MALLOC_ERROR, TLD_NO_TLD, TLD_NODATA, and TLD_SUCCESS.