libpsl/libpsl-Public-Suffix-List-f...

732 lines
34 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 V1.78.1">
<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="object-tree.html" title="Object Hierarchy">
<meta name="generator" content="GTK-Doc V1.24 (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="object-tree.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 width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_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">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">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">time_t</span>
</td>
<td class="function_name">
<a class="link" href="libpsl-Public-Suffix-List-functions.html#psl-builtin-compile-time" title="psl_builtin_compile_time ()">psl_builtin_compile_time</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-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-get-version" title="psl_get_version ()">psl_get_version</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>
</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 width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<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 &lt;libpsl.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libpsl-Public-Suffix-List-functions.description"></a><h2>Description</h2>
<p><a class="ulink" href="http://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 lowercase UTF-8 encoded if they are international.</p>
<div class="refsect3">
<a name="id-1.2.3.8.2.6"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.2.7"></a><h4>Returns</h4>
<p> Pointer to a PSL context or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.</p>
</div>
<p class="since">Since: 0.1</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 FILE 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 lowercase UTF-8 encoded if they are international.</p>
<div class="refsect3">
<a name="id-1.2.3.8.3.6"></a><h4>Parameters</h4>
<div class="informaltable"><table 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>FILE pointer</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.3.8.3.7"></a><h4>Returns</h4>
<p> Pointer to a PSL context or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.</p>
</div>
<p class="since">Since: 0.1</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 explicitely.</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, <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned.
So if using the builtin psl context, you can provide UTF-8 or 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="id-1.2.3.8.4.7"></a><h4>Returns</h4>
<p> Pointer to the built in PSL data or NULL if this data is not available.</p>
</div>
<p class="since">Since: 0.1</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>
</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="http://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 lowercase UTF-8 or in ASCII form (punycode).
Other encodings result in unexpected behavior.</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="id-1.2.3.8.6.8"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.6.9"></a><h4>Returns</h4>
<p> 1 if domain is a public suffix, 0 if not.</p>
</div>
<p class="since">Since: 0.1</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 publix suffix part of <em class="parameter"><code>domain</code></em>
by the means
of the <a class="ulink" href="http://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 lowercase UTF-8 or in ASCII form (punycode).
Other encodings result in unexpected behavior.</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="id-1.2.3.8.7.7"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.7.8"></a><h4>Returns</h4>
<p> Pointer to longest public suffix part of <em class="parameter"><code>domain</code></em>
or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>domain</code></em>
does not contain a public suffix (or if <em class="parameter"><code>psl</code></em>
is <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</p>
</div>
<p class="since">Since: 0.1</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="http://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 lowercase UTF-8 or in ASCII form (punycode).
Other encodings result in unexpected behavior.</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="id-1.2.3.8.8.7"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.8.8"></a><h4>Returns</h4>
<p> Pointer to shortest private suffix part of <em class="parameter"><code>domain</code></em>
or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>domain</code></em>
does not contain a private suffix (or if <em class="parameter"><code>psl</code></em>
is <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</p>
</div>
<p class="since">Since: 0.1</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 generation of built-in data has been disabled during compilation, 0 will be returned.</p>
<div class="refsect3">
<a name="id-1.2.3.8.9.6"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.9.7"></a><h4>Returns</h4>
<p> Number of public suffixes entries in PSL context.</p>
</div>
<p class="since">Since: 0.1</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 generation of built-in data has been disabled during compilation, 0 will be returned.</p>
<div class="refsect3">
<a name="id-1.2.3.8.10.6"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.10.7"></a><h4>Returns</h4>
<p> Number of public suffix exceptions in PSL context.</p>
</div>
<p class="since">Since: 0.1</p>
</div>
<hr>
<div class="refsect2">
<a name="psl-builtin-compile-time"></a><h3>psl_builtin_compile_time ()</h3>
<pre class="programlisting"><span class="returnvalue">time_t</span>
psl_builtin_compile_time (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>This function returns the time when the Publix Suffix List has been compiled into C code (by psl2c).</p>
<p>If the generation of built-in data has been disabled during compilation, 0 will be returned.</p>
<div class="refsect3">
<a name="id-1.2.3.8.11.6"></a><h4>Returns</h4>
<p> time_t value or 0.</p>
</div>
<p class="since">Since: 0.1</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 Publix 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="id-1.2.3.8.12.6"></a><h4>Returns</h4>
<p> time_t value or 0.</p>
</div>
<p class="since">Since: 0.1</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 Publix 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="id-1.2.3.8.13.6"></a><h4>Returns</h4>
<p> String containing SHA1 checksum or an empty string.</p>
</div>
<p class="since">Since: 0.1</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 Publix 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="id-1.2.3.8.14.6"></a><h4>Returns</h4>
<p> String containing the PSL file name or an empty string.</p>
</div>
<p class="since">Since: 0.1</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 lowercase UTF-8
or in ASCII form (punycode). Other encodings or mixing UTF-8 and punycode result in unexpected behavior.</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="id-1.2.3.8.15.8"></a><h4>Parameters</h4>
<div class="informaltable"><table 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="id-1.2.3.8.15.9"></a><h4>Returns</h4>
<p> 1 if acceptable, 0 if not acceptable.</p>
</div>
<p class="since">Since: 0.1</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="id-1.2.3.8.16.5"></a><h4>Returns</h4>
<p> String containing version of libpsl.</p>
</div>
<p class="since">Since: 0.2.5</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 lowercase UTF-8 representation.
Lowercase UTF-8 is needed as input to the domain checking functions.</p>
<p><em class="parameter"><code>lower</code></em>
is set to <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</p>
<p>The return value 'lower' must be freed after usage.</p>
<div class="refsect3">
<a name="id-1.2.3.8.17.7"></a><h4>Parameters</h4>
<div class="informaltable"><table 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 <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></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 <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></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="id-1.2.3.8.17.8"></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 <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 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</p>
</div>
<p class="since">Since: 0.4</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-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="id-1.2.3.9.2.4"></a><h4>Members</h4>
<div class="informaltable"><table 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>
</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.24</div>
</body>
</html>