⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.220
Server IP:
104.21.48.1
Server:
Linux vmi2315822.contaboserver.net 5.15.0-134-generic #145-Ubuntu SMP Wed Feb 12 20:08:39 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.3.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
gtk-doc
/
html
/
libpsl
/
View File Name :
libpsl-Public-Suffix-List-functions.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>libpsl: Libpsl Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"> <link rel="home" href="index.html" title="Libpsl Reference Manual"> <link rel="up" href="libpsl.html" title="Libpsl Overview"> <link rel="prev" href="libpsl.html" title="Libpsl Overview"> <link rel="next" href="api-index-full.html" title="API Index"> <meta name="generator" content="GTK-Doc V1.33.1 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </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="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> <a href="#libpsl-Public-Suffix-List-functions.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="libpsl.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="libpsl.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="libpsl-Public-Suffix-List-functions"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="libpsl-Public-Suffix-List-functions.top_of_page"></a>libpsl</span></h2> <p>libpsl — Public Suffix List library functions</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.stability-level"></a><h2>Stability Level</h2> <a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.functions"></a><h2>Functions</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="functions_proto_type"> <col class="functions_proto_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()">psl_load_file</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()">psl_load_fp</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-latest" title="psl_latest ()">psl_latest</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin" title="psl_builtin ()">psl_builtin</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-free" title="psl_free ()">psl_free</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-is-public-suffix" title="psl_is_public_suffix ()">psl_is_public_suffix</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-is-public-suffix2" title="psl_is_public_suffix2 ()">psl_is_public_suffix2</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-unregistrable-domain" title="psl_unregistrable_domain ()">psl_unregistrable_domain</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-registrable-domain" title="psl_registrable_domain ()">psl_registrable_domain</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-suffix-count" title="psl_suffix_count ()">psl_suffix_count</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-suffix-exception-count" title="psl_suffix_exception_count ()">psl_suffix_exception_count</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-suffix-wildcard-count" title="psl_suffix_wildcard_count ()">psl_suffix_wildcard_count</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">time_t</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin-file-time" title="psl_builtin_file_time ()">psl_builtin_file_time</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin-sha1sum" title="psl_builtin_sha1sum ()">psl_builtin_sha1sum</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin-filename" title="psl_builtin_filename ()">psl_builtin_filename</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin-outdated" title="psl_builtin_outdated ()">psl_builtin_outdated</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-is-cookie-domain-acceptable" title="psl_is_cookie_domain_acceptable ()">psl_is_cookie_domain_acceptable</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-dist-filename" title="psl_dist_filename ()">psl_dist_filename</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type">const <span class="returnvalue">char</span> * </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-get-version" title="psl_get_version ()">psl_get_version</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">int</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-check-version-number" title="psl_check_version_number ()">psl_check_version_number</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-error-t" title="enum psl_error_t"><span class="returnvalue">psl_error_t</span></a> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()">psl_str_to_utf8lower</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-free-string" title="psl_free_string ()">psl_free_string</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.other"></a><h2>Types and Values</h2> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="other_proto_type"> <col class="other_proto_name"> </colgroup> <tbody> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-API:CAPS" title="PSL_API">PSL_API</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-VERSION:CAPS" title="PSL_VERSION">PSL_VERSION</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-VERSION-MAJOR:CAPS" title="PSL_VERSION_MAJOR">PSL_VERSION_MAJOR</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-VERSION-MINOR:CAPS" title="PSL_VERSION_MINOR">PSL_VERSION_MINOR</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-VERSION-NUMBER:CAPS" title="PSL_VERSION_NUMBER">PSL_VERSION_NUMBER</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-VERSION-PATCH:CAPS" title="PSL_VERSION_PATCH">PSL_VERSION_PATCH</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-ICANN:CAPS" title="PSL_TYPE_ICANN">PSL_TYPE_ICANN</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-PRIVATE:CAPS" title="PSL_TYPE_PRIVATE">PSL_TYPE_PRIVATE</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-NO-STAR-RULE:CAPS" title="PSL_TYPE_NO_STAR_RULE">PSL_TYPE_NO_STAR_RULE</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-ANY:CAPS" title="PSL_TYPE_ANY">PSL_TYPE_ANY</a></td> </tr> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-error-t" title="enum psl_error_t">psl_error_t</a></td> </tr> <tr> <td class="typedef_keyword">typedef</td> <td class="function_name"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t">psl_ctx_t</a></td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.includes"></a><h2>Includes</h2> <pre class="synopsis">#include <libpsl.h> </pre> </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.description"></a><h2>Description</h2> <p><a class="ulink" href="https://publicsuffix.org/" target="_top">Public Suffix List</a> library functions.</p> </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="psl-load-file"></a><h3>psl_load_file ()</h3> <pre class="programlisting"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * psl_load_file (<em class="parameter"><code>const <span class="type">char</span> *fname</code></em>);</pre> <p>This function loads the public suffixes file named <em class="parameter"><code>fname</code></em> . To free the allocated resources, call <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-free" title="psl_free ()"><code class="function">psl_free()</code></a>.</p> <p>The suffixes are expected to be UTF-8 encoded (lowercase + NFKC) if they are international.</p> <div class="refsect3"> <a name="psl-load-file.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>fname</p></td> <td class="parameter_description"><p>Name of PSL file</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-load-file.returns"></a><h4>Returns</h4> <p> Pointer to a PSL context or <code class="literal">NULL</code> on failure.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-load-fp"></a><h3>psl_load_fp ()</h3> <pre class="programlisting"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * psl_load_fp (<em class="parameter"><code><span class="type">FILE</span> *fp</code></em>);</pre> <p>This function loads the public suffixes from a <code class="literal">FILE</code> pointer. To free the allocated resources, call <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-free" title="psl_free ()"><code class="function">psl_free()</code></a>.</p> <p>The suffixes are expected to be UTF-8 encoded (lowercase + NFKC) if they are international.</p> <div class="refsect3"> <a name="psl-load-fp.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>fp</p></td> <td class="parameter_description"><p><code class="literal">FILE</code> pointer</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-load-fp.returns"></a><h4>Returns</h4> <p> Pointer to a PSL context or <code class="literal">NULL</code> on failure.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-latest"></a><h3>psl_latest ()</h3> <pre class="programlisting"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * psl_latest (<em class="parameter"><code>const <span class="type">char</span> *fname</code></em>);</pre> <p>This function loads the the latest available PSL data from either</p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p><em class="parameter"><code>fname</code></em> (application specific filename, may be <code class="literal">NULL</code>)</p></li> <li class="listitem"><p>location specified during built-time (filename from ./configure --with-psl-distfile)</p></li> <li class="listitem"><p>built-in PSL data (generated from ./configure --with-psl-file)</p></li> <li class="listitem"><p>location of built-in data (filename from ./configure --with-psl-file)</p></li> </ul></div> <p>If none of the above is available, the function returns <code class="literal">NULL</code>.</p> <p>To free the allocated resources, call <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-free" title="psl_free ()"><code class="function">psl_free()</code></a>.</p> <div class="refsect3"> <a name="psl-latest.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>fname</p></td> <td class="parameter_description"><p>Name of PSL file or <code class="literal">NULL</code></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-latest.returns"></a><h4>Returns</h4> <p> Pointer to a PSL context or <code class="literal">NULL</code> on failure.</p> </div> <p class="since">Since: <a class="link" href="ix08.html#api-index-0.16">0.16</a></p> </div> <hr> <div class="refsect2"> <a name="psl-builtin"></a><h3>psl_builtin ()</h3> <pre class="programlisting">const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="returnvalue">psl_ctx_t</span></a> * psl_builtin (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function returns the PSL context that has been generated and built in at compile-time. You don't have to free the returned context explicitly.</p> <p>The builtin data also contains punycode entries, one for each international domain name.</p> <p>If the generation of built-in data has been disabled during compilation, <code class="literal">NULL</code> will be returned. When using the builtin psl context, you can provide UTF-8 (lowercase + NFKC) or ASCII/ACE (punycode) representations of domains to functions like <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-is-public-suffix" title="psl_is_public_suffix ()"><code class="function">psl_is_public_suffix()</code></a>.</p> <div class="refsect3"> <a name="psl-builtin.returns"></a><h4>Returns</h4> <p> Pointer to the built in PSL data or <code class="literal">NULL</code> if this data is not available.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-free"></a><h3>psl_free ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> psl_free (<em class="parameter"><code><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>);</pre> <p>This function frees the the PSL context that has been retrieved via <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()"><code class="function">psl_load_fp()</code></a> or <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()"><code class="function">psl_load_file()</code></a>.</p> <div class="refsect3"> <a name="psl-free.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context pointer</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-is-public-suffix"></a><h3>psl_is_public_suffix ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_is_public_suffix (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>, <em class="parameter"><code>const <span class="type">char</span> *domain</code></em>);</pre> <p>This function checks if <em class="parameter"><code>domain</code></em> is a public suffix by the means of the <a class="ulink" href="https://publicsuffix.org" target="_top">Mozilla Public Suffix List</a>.</p> <p>For cookie domain checking see <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-is-cookie-domain-acceptable" title="psl_is_cookie_domain_acceptable ()"><code class="function">psl_is_cookie_domain_acceptable()</code></a>.</p> <p>International <em class="parameter"><code>domain</code></em> names have to be either in UTF-8 (lowercase + NFKC) or in ASCII/ACE format (punycode). Other encodings likely result in incorrect return values. Use helper function <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> for normalization <em class="parameter"><code>domain</code></em> .</p> <p><em class="parameter"><code>psl</code></em> is a context returned by either <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()"><code class="function">psl_load_file()</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()"><code class="function">psl_load_fp()</code></a> or <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin" title="psl_builtin ()"><code class="function">psl_builtin()</code></a>.</p> <div class="refsect3"> <a name="psl-is-public-suffix.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>domain</p></td> <td class="parameter_description"><p>Domain string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-is-public-suffix.returns"></a><h4>Returns</h4> <p> 1 if domain is a public suffix, 0 if not.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-is-public-suffix2"></a><h3>psl_is_public_suffix2 ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_is_public_suffix2 (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>, <em class="parameter"><code>const <span class="type">char</span> *domain</code></em>, <em class="parameter"><code><span class="type">int</span> type</code></em>);</pre> <p>This function checks if <em class="parameter"><code>domain</code></em> is a public suffix by the means of the <a class="ulink" href="https://publicsuffix.org" target="_top">Mozilla Public Suffix List</a>.</p> <p><em class="parameter"><code>type</code></em> specifies the PSL section where to perform the lookup. Valid values are <a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-PRIVATE:CAPS" title="PSL_TYPE_PRIVATE"><code class="literal">PSL_TYPE_PRIVATE</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-ICANN:CAPS" title="PSL_TYPE_ICANN"><code class="literal">PSL_TYPE_ICANN</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-NO-STAR-RULE:CAPS" title="PSL_TYPE_NO_STAR_RULE"><code class="literal">PSL_TYPE_NO_STAR_RULE</code></a>, and <a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-ANY:CAPS" title="PSL_TYPE_ANY"><code class="literal">PSL_TYPE_ANY</code></a>.</p> <p><a class="link" href="libpsl-Public-Suffix-List-functions.html#PSL-TYPE-NO-STAR-RULE:CAPS" title="PSL_TYPE_NO_STAR_RULE"><code class="literal">PSL_TYPE_NO_STAR_RULE</code></a> switches of the 'prevailing star rule' (see <a class="ulink" href="https://publicsuffix.org/list" target="_top">List</a> under 'Algorithm' 2.). Applying the flag means that TLDs not explicitly listed in the PSL are *not* treated as public suffixes.</p> <p>International <em class="parameter"><code>domain</code></em> names have to be either in UTF-8 (lowercase + NFKC) or in ASCII/ACE format (punycode). Other encodings likely result in incorrect return values. Use helper function <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> for normalization <em class="parameter"><code>domain</code></em> .</p> <p><em class="parameter"><code>psl</code></em> is a context returned by either <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()"><code class="function">psl_load_file()</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()"><code class="function">psl_load_fp()</code></a> or <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin" title="psl_builtin ()"><code class="function">psl_builtin()</code></a>.</p> <div class="refsect3"> <a name="psl-is-public-suffix2.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>domain</p></td> <td class="parameter_description"><p>Domain string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>type</p></td> <td class="parameter_description"><p>Domain type</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-is-public-suffix2.returns"></a><h4>Returns</h4> <p> 1 if domain is a public suffix, 0 if not.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-unregistrable-domain"></a><h3>psl_unregistrable_domain ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_unregistrable_domain (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>, <em class="parameter"><code>const <span class="type">char</span> *domain</code></em>);</pre> <p>This function finds the longest public suffix part of <em class="parameter"><code>domain</code></em> by the means of the <a class="ulink" href="https://publicsuffix.org" target="_top">Mozilla Public Suffix List</a>.</p> <p>International <em class="parameter"><code>domain</code></em> names have to be either in UTF-8 (lowercase + NFKC) or in ASCII/ACE format (punycode). Other encodings likely result in incorrect return values. Use helper function <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> for normalization <em class="parameter"><code>domain</code></em> .</p> <p><em class="parameter"><code>psl</code></em> is a context returned by either <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()"><code class="function">psl_load_file()</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()"><code class="function">psl_load_fp()</code></a> or <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin" title="psl_builtin ()"><code class="function">psl_builtin()</code></a>.</p> <div class="refsect3"> <a name="psl-unregistrable-domain.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>domain</p></td> <td class="parameter_description"><p>Domain string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-unregistrable-domain.returns"></a><h4>Returns</h4> <p> Pointer to longest public suffix part of <em class="parameter"><code>domain</code></em> or <code class="literal">NULL</code> if <em class="parameter"><code>domain</code></em> does not contain a public suffix (or if <em class="parameter"><code>psl</code></em> is <code class="literal">NULL</code>).</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-registrable-domain"></a><h3>psl_registrable_domain ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_registrable_domain (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>, <em class="parameter"><code>const <span class="type">char</span> *domain</code></em>);</pre> <p>This function finds the shortest private suffix part of <em class="parameter"><code>domain</code></em> by the means of the <a class="ulink" href="https://publicsuffix.org" target="_top">Mozilla Public Suffix List</a>.</p> <p>International <em class="parameter"><code>domain</code></em> names have to be either in UTF-8 (lowercase + NFKC) or in ASCII/ACE format (punycode). Other encodings likely result in incorrect return values. Use helper function <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> for normalization <em class="parameter"><code>domain</code></em> .</p> <p><em class="parameter"><code>psl</code></em> is a context returned by either <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-file" title="psl_load_file ()"><code class="function">psl_load_file()</code></a>, <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-load-fp" title="psl_load_fp ()"><code class="function">psl_load_fp()</code></a> or <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin" title="psl_builtin ()"><code class="function">psl_builtin()</code></a>.</p> <div class="refsect3"> <a name="psl-registrable-domain.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>domain</p></td> <td class="parameter_description"><p>Domain string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-registrable-domain.returns"></a><h4>Returns</h4> <p> Pointer to shortest private suffix part of <em class="parameter"><code>domain</code></em> or <code class="literal">NULL</code> if <em class="parameter"><code>domain</code></em> does not contain a private suffix (or if <em class="parameter"><code>psl</code></em> is <code class="literal">NULL</code>).</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-suffix-count"></a><h3>psl_suffix_count ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_suffix_count (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>);</pre> <p>This function returns number of public suffixes maintained by <em class="parameter"><code>psl</code></em> . The number of exceptions within the Public Suffix List are not included.</p> <p>If the information is not available, the return value is -1 (since 0.19). This is the case with DAFSA blobs or if <em class="parameter"><code>psl</code></em> is <code class="literal">NULL</code>.</p> <div class="refsect3"> <a name="psl-suffix-count.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context pointer</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-suffix-count.returns"></a><h4>Returns</h4> <p> Number of public suffixes entries in PSL context or -1 if this information is not available.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-suffix-exception-count"></a><h3>psl_suffix_exception_count ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_suffix_exception_count (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>);</pre> <p>This function returns number of public suffix exceptions maintained by <em class="parameter"><code>psl</code></em> .</p> <p>If the information is not available, the return value is -1 (since 0.19). This is the case with DAFSA blobs or if <em class="parameter"><code>psl</code></em> is <code class="literal">NULL</code>.</p> <div class="refsect3"> <a name="psl-suffix-exception-count.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context pointer</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-suffix-exception-count.returns"></a><h4>Returns</h4> <p> Number of public suffix exceptions in PSL context or -1 if this information is not available.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-suffix-wildcard-count"></a><h3>psl_suffix_wildcard_count ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_suffix_wildcard_count (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>);</pre> <p>This function returns number of public suffix wildcards maintained by <em class="parameter"><code>psl</code></em> .</p> <p>If the information is not available, the return value is -1 (since 0.19). This is the case with DAFSA blobs or if <em class="parameter"><code>psl</code></em> is <code class="literal">NULL</code>.</p> <div class="refsect3"> <a name="psl-suffix-wildcard-count.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context pointer</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-suffix-wildcard-count.returns"></a><h4>Returns</h4> <p> Number of public suffix wildcards in PSL context or -1 if this information is not available.</p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10.0">0.10.0</a></p> </div> <hr> <div class="refsect2"> <a name="psl-builtin-file-time"></a><h3>psl_builtin_file_time ()</h3> <pre class="programlisting"><span class="returnvalue">time_t</span> psl_builtin_file_time (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function returns the mtime of the Public Suffix List file that has been built in.</p> <p>If the generation of built-in data has been disabled during compilation, 0 will be returned.</p> <div class="refsect3"> <a name="psl-builtin-file-time.returns"></a><h4>Returns</h4> <p> time_t value or 0.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-builtin-sha1sum"></a><h3>psl_builtin_sha1sum ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_builtin_sha1sum (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function returns the SHA1 checksum of the Public Suffix List file that has been built in. The returned string is in lowercase hex encoding, e.g. "2af1e9e3044eda0678bb05949d7cca2f769901d8".</p> <p>If the generation of built-in data has been disabled during compilation, an empty string will be returned.</p> <div class="refsect3"> <a name="psl-builtin-sha1sum.returns"></a><h4>Returns</h4> <p> String containing SHA1 checksum or an empty string.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-builtin-filename"></a><h3>psl_builtin_filename ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_builtin_filename (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function returns the file name of the Public Suffix List file that has been built in.</p> <p>If the generation of built-in data has been disabled during compilation, an empty string will be returned.</p> <div class="refsect3"> <a name="psl-builtin-filename.returns"></a><h4>Returns</h4> <p> String containing the PSL file name or an empty string.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-builtin-outdated"></a><h3>psl_builtin_outdated ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_builtin_outdated (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function checks if the built-in data is older than the file it has been created from. If it is, it might be a good idea for the application to reload the PSL. The mtime is taken as reference.</p> <p>If the PSL file does not exist, it is assumed that the built-in data is not outdated.</p> <div class="refsect3"> <a name="psl-builtin-outdated.returns"></a><h4>Returns</h4> <p> 1 if the built-in is outdated, 0 otherwise.</p> </div> <p class="since">Since: <a class="link" href="ix06.html#api-index-0.10.0">0.10.0</a></p> </div> <hr> <div class="refsect2"> <a name="psl-is-cookie-domain-acceptable"></a><h3>psl_is_cookie_domain_acceptable ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_is_cookie_domain_acceptable (<em class="parameter"><code>const <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-ctx-t" title="psl_ctx_t"><span class="type">psl_ctx_t</span></a> *psl</code></em>, <em class="parameter"><code>const <span class="type">char</span> *hostname</code></em>, <em class="parameter"><code>const <span class="type">char</span> *cookie_domain</code></em>);</pre> <p>This helper function checks whether <em class="parameter"><code>cookie_domain</code></em> is an acceptable cookie domain value for the request <em class="parameter"><code>hostname</code></em> .</p> <p>For international domain names both, <em class="parameter"><code>hostname</code></em> and <em class="parameter"><code>cookie_domain</code></em> , have to be either in UTF-8 (lowercase + NFKC) or in ASCII/ACE (punycode) format. Other encodings or mixing UTF-8 and punycode likely result in incorrect return values.</p> <p>Use helper function <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> for normalization of <em class="parameter"><code>hostname</code></em> and <em class="parameter"><code>cookie_domain</code></em> .</p> <p>Examples:</p> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"><p>Cookie domain 'example.com' would be acceptable for hostname 'www.example.com', but '.com' or 'com' would NOT be acceptable since 'com' is a public suffix.</p></li> <li class="listitem"><p>Cookie domain 'his.name' would be acceptable for hostname 'remember.his.name', but NOT for 'forgot.his.name' since 'forgot.his.name' is a public suffix.</p></li> </ol></div> <div class="refsect3"> <a name="psl-is-cookie-domain-acceptable.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>psl</p></td> <td class="parameter_description"><p>PSL context pointer</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>hostname</p></td> <td class="parameter_description"><p>The request hostname.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>cookie_domain</p></td> <td class="parameter_description"><p>The domain value from a cookie</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-is-cookie-domain-acceptable.returns"></a><h4>Returns</h4> <p> 1 if acceptable, 0 if not acceptable.</p> </div> <p class="since">Since: <a class="link" href="ix03.html#api-index-0.1">0.1</a></p> </div> <hr> <div class="refsect2"> <a name="psl-dist-filename"></a><h3>psl_dist_filename ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_dist_filename (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>This function returns the file name of the distribution/system PSL data file. This file will be considered by <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-latest" title="psl_latest ()"><code class="function">psl_latest()</code></a>.</p> <p>Return the filename that is set by ./configure --with-psl-distfile, or an empty string.</p> <div class="refsect3"> <a name="psl-dist-filename.returns"></a><h4>Returns</h4> <p> String containing a PSL file name or an empty string.</p> </div> <p class="since">Since: <a class="link" href="ix08.html#api-index-0.16">0.16</a></p> </div> <hr> <div class="refsect2"> <a name="psl-get-version"></a><h3>psl_get_version ()</h3> <pre class="programlisting">const <span class="returnvalue">char</span> * psl_get_version (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> <p>Get libpsl version.</p> <div class="refsect3"> <a name="psl-get-version.returns"></a><h4>Returns</h4> <p> String containing version of libpsl.</p> </div> <p class="since">Since: <a class="link" href="ix04.html#api-index-0.2.5">0.2.5</a></p> </div> <hr> <div class="refsect2"> <a name="psl-check-version-number"></a><h3>psl_check_version_number ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> psl_check_version_number (<em class="parameter"><code><span class="type">int</span> version</code></em>);</pre> <p>Check the given version number is at minimum the current library version number. The version number must be a hexadecimal number like 0x000a01 (V0.10.1).</p> <div class="refsect3"> <a name="psl-check-version-number.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>version</p></td> <td class="parameter_description"><p>Version number (hex) to check against.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="psl-check-version-number.returns"></a><h4>Returns</h4> <p> Returns the library version number if the given version number is at least the version of the library, else return 0; If the argument is 0, the function returns the library version number without performing a check.</p> </div> <p class="since">Since: <a class="link" href="ix07.html#api-index-0.11.0">0.11.0</a></p> </div> <hr> <div class="refsect2"> <a name="psl-str-to-utf8lower"></a><h3>psl_str_to_utf8lower ()</h3> <pre class="programlisting"><a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-error-t" title="enum psl_error_t"><span class="returnvalue">psl_error_t</span></a> psl_str_to_utf8lower (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>, <em class="parameter"><code>const <span class="type">char</span> *encoding</code></em>, <em class="parameter"><code>const <span class="type">char</span> *locale</code></em>, <em class="parameter"><code><span class="type">char</span> **lower</code></em>);</pre> <p>This helper function converts a string to UTF-8 lowercase + NFKC representation. Lowercase + NFKC UTF-8 is needed as input to the domain checking functions.</p> <p><em class="parameter"><code>lower</code></em> stays unchanged on error.</p> <p>When returning PSL_SUCCESS, the return value 'lower' must be freed after usage.</p> <div class="refsect3"> <a name="psl-str-to-utf8lower.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>string to convert</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>encoding</p></td> <td class="parameter_description"><p>charset encoding of <em class="parameter"><code>str</code></em> , e.g. 'iso-8859-1' or <code class="literal">NULL</code></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>locale</p></td> <td class="parameter_description"><p>locale of <em class="parameter"><code>str</code></em> for to lowercase conversion, e.g. 'de' or <code class="literal">NULL</code></p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>lower</p></td> <td class="parameter_description"><p>return value containing the converted string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="psl-str-to-utf8lower.returns"></a><h4>Returns</h4> <p> psl_error_t value. PSL_SUCCESS: Success PSL_ERR_INVALID_ARG: <em class="parameter"><code>str</code></em> is a <code class="literal">NULL</code> value. PSL_ERR_CONVERTER: Failed to open the unicode converter with name <em class="parameter"><code>encoding</code></em> PSL_ERR_TO_UTF16: Failed to convert <em class="parameter"><code>str</code></em> to unicode PSL_ERR_TO_LOWER: Failed to convert unicode to lowercase PSL_ERR_TO_UTF8: Failed to convert unicode to UTF-8 PSL_ERR_NO_MEM: Failed to allocate memory</p> </div> <p class="since">Since: <a class="link" href="ix05.html#api-index-0.4">0.4</a></p> </div> <hr> <div class="refsect2"> <a name="psl-free-string"></a><h3>psl_free_string ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> psl_free_string (<em class="parameter"><code><span class="type">char</span> *str</code></em>);</pre> <p>This function <code class="function">free()</code>'s the memory allocated by <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a> when returning a lowercase string</p> <div class="refsect3"> <a name="psl-free-string.parameters"></a><h4>Parameters</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>pointer to lowercase string returned by <a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-str-to-utf8lower" title="psl_str_to_utf8lower ()"><code class="function">psl_str_to_utf8lower()</code></a></p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <p class="since">Since: <a class="link" href="ix09.html#api-index-0.19">0.19</a></p> </div> </div> <div class="refsect1"> <a name="libpsl-Public-Suffix-List-functions.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="PSL-API:CAPS"></a><h3>PSL_API</h3> <pre class="programlisting"># define PSL_API __attribute__ ((__visibility__("default"))) </pre> </div> <hr> <div class="refsect2"> <a name="PSL-VERSION:CAPS"></a><h3>PSL_VERSION</h3> <pre class="programlisting">#define PSL_VERSION "0.21.0" </pre> </div> <hr> <div class="refsect2"> <a name="PSL-VERSION-MAJOR:CAPS"></a><h3>PSL_VERSION_MAJOR</h3> <pre class="programlisting">#define PSL_VERSION_MAJOR 0 </pre> </div> <hr> <div class="refsect2"> <a name="PSL-VERSION-MINOR:CAPS"></a><h3>PSL_VERSION_MINOR</h3> <pre class="programlisting">#define PSL_VERSION_MINOR 21 </pre> </div> <hr> <div class="refsect2"> <a name="PSL-VERSION-NUMBER:CAPS"></a><h3>PSL_VERSION_NUMBER</h3> <pre class="programlisting">#define PSL_VERSION_NUMBER 0x001500 </pre> </div> <hr> <div class="refsect2"> <a name="PSL-VERSION-PATCH:CAPS"></a><h3>PSL_VERSION_PATCH</h3> <pre class="programlisting">#define PSL_VERSION_PATCH 0 </pre> </div> <hr> <div class="refsect2"> <a name="PSL-TYPE-ICANN:CAPS"></a><h3>PSL_TYPE_ICANN</h3> <pre class="programlisting">#define PSL_TYPE_ICANN (1<<0) </pre> </div> <hr> <div class="refsect2"> <a name="PSL-TYPE-PRIVATE:CAPS"></a><h3>PSL_TYPE_PRIVATE</h3> <pre class="programlisting">#define PSL_TYPE_PRIVATE (1<<1) </pre> </div> <hr> <div class="refsect2"> <a name="PSL-TYPE-NO-STAR-RULE:CAPS"></a><h3>PSL_TYPE_NO_STAR_RULE</h3> <pre class="programlisting">#define PSL_TYPE_NO_STAR_RULE (1<<2) </pre> </div> <hr> <div class="refsect2"> <a name="PSL-TYPE-ANY:CAPS"></a><h3>PSL_TYPE_ANY</h3> <pre class="programlisting">#define PSL_TYPE_ANY (PSL_TYPE_ICANN | PSL_TYPE_PRIVATE) </pre> </div> <hr> <div class="refsect2"> <a name="psl-error-t"></a><h3>enum psl_error_t</h3> <p>Return codes for PSL functions. Negative return codes mean failure. Positive values are reserved for non-error return codes.</p> <div class="refsect3"> <a name="psl-error-t.members"></a><h4>Members</h4> <div class="informaltable"><table class="informaltable" width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="PSL-SUCCESS:CAPS"></a>PSL_SUCCESS</p></td> <td class="enum_member_description"> <p>Successful return.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-INVALID-ARG:CAPS"></a>PSL_ERR_INVALID_ARG</p></td> <td class="enum_member_description"> <p>Invalid argument.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-CONVERTER:CAPS"></a>PSL_ERR_CONVERTER</p></td> <td class="enum_member_description"> <p>Failed to open libicu utf-16 converter.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-TO-UTF16:CAPS"></a>PSL_ERR_TO_UTF16</p></td> <td class="enum_member_description"> <p>Failed to convert to utf-16.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-TO-LOWER:CAPS"></a>PSL_ERR_TO_LOWER</p></td> <td class="enum_member_description"> <p>Failed to convert utf-16 to lowercase.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-TO-UTF8:CAPS"></a>PSL_ERR_TO_UTF8</p></td> <td class="enum_member_description"> <p>Failed to convert utf-16 to utf-8.</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="PSL-ERR-NO-MEM:CAPS"></a>PSL_ERR_NO_MEM</p></td> <td class="enum_member_description"> <p>Failed to allocate memory.</p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="psl-ctx-t"></a><h3>psl_ctx_t</h3> <pre class="programlisting">typedef struct psl_ctx_st psl_ctx_t; </pre> </div> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.33.1</div> </body> </html>