<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>tld</title> <meta name="generator" content="DocBook XSL Stylesheets V1.71.0"> <link rel="start" href="index.html" title="GNU Libidn API Reference Manual"> <link rel="up" href="ch01.html" title="GNU Libidn API Reference Manual"> <link rel="prev" href="libidn-punycode.html" title="punycode"> <link rel="next" href="libidn-stringprep.html" title="stringprep"> <meta name="generator" content="GTK-Doc V1.7 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="chapter" href="ch01.html" title="GNU Libidn API Reference Manual"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> <tr valign="middle"> <td><a accesskey="p" href="libidn-punycode.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">GNU Libidn API Reference Manual</th> <td><a accesskey="n" href="libidn-stringprep.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr> <tr><td colspan="5" class="shortcuts"><nobr><a href="#id2571468" class="shortcut">Top</a>  |  <a href="#id2554327" class="shortcut">Description</a></nobr></td></tr> </table> <div class="refentry" lang="en"> <a name="libidn-tld"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2> <a name="id2571468"></a><span class="refentrytitle">tld</span> </h2> <p>tld</p> </td> <td valign="top" align="right"></td> </tr></table></div> <div class="refsynopsisdiv"> <h2>Synopsis</h2> <pre class="synopsis"> struct <a href="libidn-tld.html#Tld-table-element">Tld_table_element</a>; struct <a href="libidn-tld.html#Tld-table">Tld_table</a>; enum <a href="libidn-tld.html#Tld-rc">Tld_rc</a>; const char* <a href="libidn-tld.html#tld-strerror">tld_strerror</a> (<a href="libidn-tld.html#Tld-rc">Tld_rc</a> rc); int <a href="libidn-tld.html#tld-get-4">tld_get_4</a> (const uint32_t *in, size_t inlen, char **out); int <a href="libidn-tld.html#tld-get-4z">tld_get_4z</a> (const uint32_t *in, char **out); int <a href="libidn-tld.html#tld-get-z">tld_get_z</a> (const char *in, char **out); const <a href="libidn-tld.html#Tld-table">Tld_table</a>* <a href="libidn-tld.html#tld-get-table">tld_get_table</a> (const char *tld, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **tables); const <a href="libidn-tld.html#Tld-table">Tld_table</a>* <a href="libidn-tld.html#tld-default-table">tld_default_table</a> (const char *tld, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides); int <a href="libidn-tld.html#tld-check-4t">tld_check_4t</a> (const uint32_t *in, size_t inlen, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> *tld); int <a href="libidn-tld.html#tld-check-4tz">tld_check_4tz</a> (const uint32_t *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> *tld); int <a href="libidn-tld.html#tld-check-4">tld_check_4</a> (const uint32_t *in, size_t inlen, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides); int <a href="libidn-tld.html#tld-check-4z">tld_check_4z</a> (const uint32_t *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides); int <a href="libidn-tld.html#tld-check-8z">tld_check_8z</a> (const char *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides); int <a href="libidn-tld.html#tld-check-lz">tld_check_lz</a> (const char *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides); </pre> </div> <div class="refsect1" lang="en"> <a name="id2554327"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> <a name="id2554343"></a><h2>Details</h2> <div class="refsect2" lang="en"> <a name="id2554354"></a><h3> <a name="Tld-table-element"></a>struct Tld_table_element</h3> <a class="indexterm" name="id2554366"></a><pre class="programlisting">struct Tld_table_element { uint32_t start; /* Start of range. */ uint32_t end; /* End of range, end == start if single. */ }; </pre> <p> </p> </div> <hr> <div class="refsect2" lang="en"> <a name="id2554384"></a><h3> <a name="Tld-table"></a>struct Tld_table</h3> <a class="indexterm" name="id2554396"></a><pre class="programlisting">struct Tld_table { const char *name; /* TLD name, e.g., "no". */ const char *version; /* Version string from TLD file. */ size_t nvalid; /* Number of entries in data. */ const Tld_table_element *valid; /* Sorted array of valid code points. */ }; </pre> <p> </p> </div> <hr> <div class="refsect2" lang="en"> <a name="id2554416"></a><h3> <a name="Tld-rc"></a>enum Tld_rc</h3> <a class="indexterm" name="id2554428"></a><pre class="programlisting"> typedef enum { TLD_SUCCESS = 0, TLD_INVALID = 1, /* Invalid character found. */ TLD_NODATA = 2, /* Char, domain or inlen = 0. */ TLD_MALLOC_ERROR = 3, TLD_ICONV_ERROR = 4, TLD_NO_TLD = 5, /* Workaround typo in earlier versions. */ TLD_NOTLD = TLD_NO_TLD } Tld_rc; </pre> <p> Enumerated return codes of the TLD checking functions. The value 0 is guaranteed to always correspond to success.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><a name="TLD-SUCCESS:CAPS"></a><code class="literal">TLD_SUCCESS</code></span></td> <td> 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. </td> </tr> <tr> <td><span class="term"><a name="TLD-INVALID:CAPS"></a><code class="literal">TLD_INVALID</code></span></td> <td> Invalid character found. </td> </tr> <tr> <td><span class="term"><a name="TLD-NODATA:CAPS"></a><code class="literal">TLD_NODATA</code></span></td> <td> No input data was provided. </td> </tr> <tr> <td><span class="term"><a name="TLD-MALLOC-ERROR:CAPS"></a><code class="literal">TLD_MALLOC_ERROR</code></span></td> <td> Error during memory allocation. </td> </tr> <tr> <td><span class="term"><a name="TLD-ICONV-ERROR:CAPS"></a><code class="literal">TLD_ICONV_ERROR</code></span></td> <td> Error during iconv string conversion. </td> </tr> <tr> <td><span class="term"><a name="TLD-NO-TLD:CAPS"></a><code class="literal">TLD_NO_TLD</code></span></td> <td> No top-level domain found in domain string. </td> </tr> <tr> <td><span class="term"><a name="TLD-NOTLD:CAPS"></a><code class="literal">TLD_NOTLD</code></span></td> <td> </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2555965"></a><h3> <a name="tld-strerror"></a>tld_strerror ()</h3> <a class="indexterm" name="id2555977"></a><pre class="programlisting">const char* tld_strerror (<a href="libidn-tld.html#Tld-rc">Tld_rc</a> rc);</pre> <p> Convert a return code integer to a text string. This string can be used to output a diagnostic message to the user. </p> <p> 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.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>rc</code></em> :</span></td> <td> tld return code </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns a pointer to a statically allocated string containing a description of the error with the return code <em class="parameter"><code>rc</code></em>. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2556058"></a><h3> <a name="tld-get-4"></a>tld_get_4 ()</h3> <a class="indexterm" name="id2556071"></a><pre class="programlisting">int tld_get_4 (const uint32_t *in, size_t inlen, char **out);</pre> <p> Isolate the top-level domain of <em class="parameter"><code>in</code></em> and return it as an ASCII string in <em class="parameter"><code>out</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Array of unicode code points to process. Does not need to be zero terminated. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>inlen</code></em> :</span></td> <td> Number of unicode code points. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>out</code></em> :</span></td> <td> Zero terminated ascii result string pointer. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Return <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> on success, or the corresponding <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> error code otherwise. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2595680"></a><h3> <a name="tld-get-4z"></a>tld_get_4z ()</h3> <a class="indexterm" name="id2595691"></a><pre class="programlisting">int tld_get_4z (const uint32_t *in, char **out);</pre> <p> Isolate the top-level domain of <em class="parameter"><code>in</code></em> and return it as an ASCII string in <em class="parameter"><code>out</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero terminated array of unicode code points to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>out</code></em> :</span></td> <td> Zero terminated ascii result string pointer. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Return <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> on success, or the corresponding <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> error code otherwise. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2595790"></a><h3> <a name="tld-get-z"></a>tld_get_z ()</h3> <a class="indexterm" name="id2595800"></a><pre class="programlisting">int tld_get_z (const char *in, char **out);</pre> <p> Isolate the top-level domain of <em class="parameter"><code>in</code></em> and return it as an ASCII string in <em class="parameter"><code>out</code></em>. The input string <em class="parameter"><code>in</code></em> may be UTF-8, ISO-8859-1 or any ASCII compatible character encoding.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero terminated character array to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>out</code></em> :</span></td> <td> Zero terminated ascii result string pointer. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Return <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> on success, or the corresponding <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> error code otherwise. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2595918"></a><h3> <a name="tld-get-table"></a>tld_get_table ()</h3> <a class="indexterm" name="id2595931"></a><pre class="programlisting">const <a href="libidn-tld.html#Tld-table">Tld_table</a>* tld_get_table (const char *tld, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **tables);</pre> <p> Get the TLD table for a named TLD by searching through the given TLD table array.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>tld</code></em> :</span></td> <td> TLD name (e.g. "com") as zero terminated ASCII byte string. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>tables</code></em> :</span></td> <td> Zero terminated array of <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> info-structures for TLDs. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Return structure corresponding to TLD <em class="parameter"><code>tld</code></em> by going thru <em class="parameter"><code>tables</code></em>, or return <code class="literal">NULL</code> if no such structure is found. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596045"></a><h3> <a name="tld-default-table"></a>tld_default_table ()</h3> <a class="indexterm" name="id2596058"></a><pre class="programlisting">const <a href="libidn-tld.html#Tld-table">Tld_table</a>* tld_default_table (const char *tld, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides);</pre> <p> Get the TLD table for a named TLD, using the internal defaults, possibly overrided by the (optional) supplied tables.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>tld</code></em> :</span></td> <td> TLD name (e.g. "com") as zero terminated ASCII byte string. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>overrides</code></em> :</span></td> <td> Additional zero terminated array of <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> info-structures for TLDs, or <code class="literal">NULL</code> to only use library deault tables. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Return structure corresponding to TLD <em class="parameter"><code>tld_str</code></em>, first looking through <em class="parameter"><code>overrides</code></em> then thru built-in list, or <code class="literal">NULL</code> if no such structure found. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596183"></a><h3> <a name="tld-check-4t"></a>tld_check_4t ()</h3> <a class="indexterm" name="id2596196"></a><pre class="programlisting">int tld_check_4t (const uint32_t *in, size_t inlen, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> *tld);</pre> <p> Test each of the code points in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the data structure in <em class="parameter"><code>tld</code></em>, return the position of the first character for which this is not the case in <em class="parameter"><code>errpos</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Array of unicode code points to process. Does not need to be zero terminated. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>inlen</code></em> :</span></td> <td> Number of unicode code points. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>tld</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> data structure representing the restrictions for which the input should be tested. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all code points are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596360"></a><h3> <a name="tld-check-4tz"></a>tld_check_4tz ()</h3> <a class="indexterm" name="id2596370"></a><pre class="programlisting">int tld_check_4tz (const uint32_t *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> *tld);</pre> <p> Test each of the code points in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the data structure in <em class="parameter"><code>tld</code></em>, return the position of the first character for which this is not the case in <em class="parameter"><code>errpos</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero terminated array of unicode code points to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>tld</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> data structure representing the restrictions for which the input should be tested. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all code points are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596521"></a><h3> <a name="tld-check-4"></a>tld_check_4 ()</h3> <a class="indexterm" name="id2596531"></a><pre class="programlisting">int tld_check_4 (const uint32_t *in, size_t inlen, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides);</pre> <p> Test each of the code points in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the information in <em class="parameter"><code>overrides</code></em> or by the built-in TLD restriction data. When data for the same TLD is available both internally and in <em class="parameter"><code>overrides</code></em>, the information in <em class="parameter"><code>overrides</code></em> takes precedence. If several entries for a specific TLD are found, the first one is used. If <em class="parameter"><code>overrides</code></em> is <code class="literal">NULL</code>, only the built-in information is used. The position of the first offending character is returned in <em class="parameter"><code>errpos</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Array of unicode code points to process. Does not need to be zero terminated. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>inlen</code></em> :</span></td> <td> Number of unicode code points. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>overrides</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> array of additional domain restriction structures that complement and supersede the built-in information. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all code points are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596730"></a><h3> <a name="tld-check-4z"></a>tld_check_4z ()</h3> <a class="indexterm" name="id2596740"></a><pre class="programlisting">int tld_check_4z (const uint32_t *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides);</pre> <p> Test each of the code points in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the information in <em class="parameter"><code>overrides</code></em> or by the built-in TLD restriction data. When data for the same TLD is available both internally and in <em class="parameter"><code>overrides</code></em>, the information in <em class="parameter"><code>overrides</code></em> takes precedence. If several entries for a specific TLD are found, the first one is used. If <em class="parameter"><code>overrides</code></em> is <code class="literal">NULL</code>, only the built-in information is used. The position of the first offending character is returned in <em class="parameter"><code>errpos</code></em>.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero-terminated array of unicode code points to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>overrides</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> array of additional domain restriction structures that complement and supersede the built-in information. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all code points are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2596919"></a><h3> <a name="tld-check-8z"></a>tld_check_8z ()</h3> <a class="indexterm" name="id2596930"></a><pre class="programlisting">int tld_check_8z (const char *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides);</pre> <p> Test each of the characters in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the information in <em class="parameter"><code>overrides</code></em> or by the built-in TLD restriction data. When data for the same TLD is available both internally and in <em class="parameter"><code>overrides</code></em>, the information in <em class="parameter"><code>overrides</code></em> takes precedence. If several entries for a specific TLD are found, the first one is used. If <em class="parameter"><code>overrides</code></em> is <code class="literal">NULL</code>, only the built-in information is used. The position of the first offending character is returned in <em class="parameter"><code>errpos</code></em>. Note that the error position refers to the decoded character offset rather than the byte position in the string.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero-terminated UTF8 string to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>overrides</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> array of additional domain restriction structures that complement and supersede the built-in information. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all characters are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> <a name="id2597110"></a><h3> <a name="tld-check-lz"></a>tld_check_lz ()</h3> <a class="indexterm" name="id2597120"></a><pre class="programlisting">int tld_check_lz (const char *in, size_t *errpos, const <a href="libidn-tld.html#Tld-table">Tld_table</a> **overrides);</pre> <p> Test each of the characters in <em class="parameter"><code>in</code></em> for whether or not they are allowed by the information in <em class="parameter"><code>overrides</code></em> or by the built-in TLD restriction data. When data for the same TLD is available both internally and in <em class="parameter"><code>overrides</code></em>, the information in <em class="parameter"><code>overrides</code></em> takes precedence. If several entries for a specific TLD are found, the first one is used. If <em class="parameter"><code>overrides</code></em> is <code class="literal">NULL</code>, only the built-in information is used. The position of the first offending character is returned in <em class="parameter"><code>errpos</code></em>. Note that the error position refers to the decoded character offset rather than the byte position in the string.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> <tbody> <tr> <td><span class="term"><em class="parameter"><code>in</code></em> :</span></td> <td> Zero-terminated string in the current locales encoding to process. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>errpos</code></em> :</span></td> <td> Position of offending character is returned here. </td> </tr> <tr> <td><span class="term"><em class="parameter"><code>overrides</code></em> :</span></td> <td> A <a href="libidn-tld.html#Tld-table"><span class="type">Tld_table</span></a> array of additional domain restriction structures that complement and supersede the built-in information. </td> </tr> <tr> <td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> Returns the <a href="libidn-tld.html#Tld-rc"><span class="type">Tld_rc</span></a> value <a href="libidn-tld.html#TLD-SUCCESS:CAPS"><code class="literal">TLD_SUCCESS</code></a> if all characters are valid or when <em class="parameter"><code>tld</code></em> is null, <a href="libidn-tld.html#TLD-INVALID:CAPS"><code class="literal">TLD_INVALID</code></a> if a character is not allowed, or additional error codes on general failure conditions. </td> </tr> </tbody> </table></div> </div> </div> </div> </body> </html>