Update to upstream 1.0.1
[profile/ivi/gsignond.git] / docs / html / gsignond-Utility-functions.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>gsignond API Reference Manual: Utility functions</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="index.html" title="gsignond API Reference Manual">
8 <link rel="up" href="ch07.html" title="Miscellaneous">
9 <link rel="prev" href="gsignond-Logging.html" title="Logging">
10 <link rel="next" href="object-tree.html" title="Object Hierarchy">
11 <meta name="generator" content="GTK-Doc V1.20 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="10"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 
18                   <a href="#gsignond-Utility-functions.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 
19                   <a href="#gsignond-Utility-functions.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
20 </td>
21 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
22 <td><a accesskey="u" href="ch07.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
23 <td><a accesskey="p" href="gsignond-Logging.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
24 <td><a accesskey="n" href="object-tree.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25 </tr></table>
26 <div class="refentry">
27 <a name="gsignond-Utility-functions"></a><div class="titlepage"></div>
28 <div class="refnamediv"><table width="100%"><tr>
29 <td valign="top">
30 <h2><span class="refentrytitle"><a name="gsignond-Utility-functions.top_of_page"></a>Utility functions</span></h2>
31 <p>Utility functions — miscellaneous utility functions</p>
32 </td>
33 <td class="gallery_image" valign="top" align="right"></td>
34 </tr></table></div>
35 <div class="refsect1">
36 <a name="gsignond-Utility-functions.functions"></a><h2>Functions</h2>
37 <div class="informaltable"><table width="100%" border="0">
38 <colgroup>
39 <col width="150px" class="functions_return">
40 <col class="functions_name">
41 </colgroup>
42 <tbody>
43 <tr>
44 <td class="function_type">
45 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
46 </td>
47 <td class="function_name">
48 <a class="link" href="gsignond-Utility-functions.html#gsignond-wipe-file" title="gsignond_wipe_file ()">gsignond_wipe_file</a> <span class="c_punctuation">()</span>
49 </td>
50 </tr>
51 <tr>
52 <td class="function_type">
53 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
54 </td>
55 <td class="function_name">
56 <a class="link" href="gsignond-Utility-functions.html#gsignond-wipe-directory" title="gsignond_wipe_directory ()">gsignond_wipe_directory</a> <span class="c_punctuation">()</span>
57 </td>
58 </tr>
59 <tr>
60 <td class="function_type">
61 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
62 </td>
63 <td class="function_name">
64 <a class="link" href="gsignond-Utility-functions.html#gsignond-generate-nonce" title="gsignond_generate_nonce ()">gsignond_generate_nonce</a> <span class="c_punctuation">()</span>
65 </td>
66 </tr>
67 <tr>
68 <td class="function_type">
69 <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *
70 </td>
71 <td class="function_name">
72 <a class="link" href="gsignond-Utility-functions.html#gsignond-sequence-to-variant" title="gsignond_sequence_to_variant ()">gsignond_sequence_to_variant</a> <span class="c_punctuation">()</span>
73 </td>
74 </tr>
75 <tr>
76 <td class="function_type">
77 <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
78 </td>
79 <td class="function_name">
80 <a class="link" href="gsignond-Utility-functions.html#gsignond-variant-to-sequence" title="gsignond_variant_to_sequence ()">gsignond_variant_to_sequence</a> <span class="c_punctuation">()</span>
81 </td>
82 </tr>
83 <tr>
84 <td class="function_type">
85 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> **
86 </td>
87 <td class="function_name">
88 <a class="link" href="gsignond-Utility-functions.html#gsignond-sequence-to-array" title="gsignond_sequence_to_array ()">gsignond_sequence_to_array</a> <span class="c_punctuation">()</span>
89 </td>
90 </tr>
91 <tr>
92 <td class="function_type">
93 <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
94 </td>
95 <td class="function_name">
96 <a class="link" href="gsignond-Utility-functions.html#gsignond-array-to-sequence" title="gsignond_array_to_sequence ()">gsignond_array_to_sequence</a> <span class="c_punctuation">()</span>
97 </td>
98 </tr>
99 <tr>
100 <td class="function_type">
101 <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
102 </td>
103 <td class="function_name">
104 <a class="link" href="gsignond-Utility-functions.html#gsignond-copy-array-to-sequence" title="gsignond_copy_array_to_sequence ()">gsignond_copy_array_to_sequence</a> <span class="c_punctuation">()</span>
105 </td>
106 </tr>
107 <tr>
108 <td class="function_type">
109 <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
110 </td>
111 <td class="function_name">
112 <a class="link" href="gsignond-Utility-functions.html#gsignond-is-host-in-domain" title="gsignond_is_host_in_domain ()">gsignond_is_host_in_domain</a> <span class="c_punctuation">()</span>
113 </td>
114 </tr>
115 </tbody>
116 </table></div>
117 </div>
118 <div class="refsect1">
119 <a name="gsignond-Utility-functions.object-hierarchy"></a><h2>Object Hierarchy</h2>
120 <pre class="screen">
121 </pre>
122 </div>
123 <div class="refsect1">
124 <a name="gsignond-Utility-functions.includes"></a><h2>Includes</h2>
125 <pre class="synopsis">#include &lt;gsignond/gsignond-utils.h&gt;
126 </pre>
127 </div>
128 <div class="refsect1">
129 <a name="gsignond-Utility-functions.description"></a><h2>Description</h2>
130 <p>Miscellaneous utility functions are described below.</p>
131 </div>
132 <div class="refsect1">
133 <a name="gsignond-Utility-functions.functions_details"></a><h2>Functions</h2>
134 <div class="refsect2">
135 <a name="gsignond-wipe-file"></a><h3>gsignond_wipe_file ()</h3>
136 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
137 gsignond_wipe_file (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *filename</code></em>);</pre>
138 <p>This function securely wipes the contents of the file, by overwriting it with
139 0's, then 1's, then random data. The file is then removed.</p>
140 <div class="refsect3">
141 <a name="id-1.8.4.7.2.5"></a><h4>Parameters</h4>
142 <div class="informaltable"><table width="100%" border="0">
143 <colgroup>
144 <col width="150px" class="parameters_name">
145 <col class="parameters_description">
146 <col width="200px" class="parameters_annotations">
147 </colgroup>
148 <tbody><tr>
149 <td class="parameter_name"><p>filename</p></td>
150 <td class="parameter_description"><p>filename to wipe</p></td>
151 <td class="parameter_annotations"> </td>
152 </tr></tbody>
153 </table></div>
154 </div>
155 <div class="refsect3">
156 <a name="id-1.8.4.7.2.6"></a><h4>Returns</h4>
157 <p> TRUE if wiping and removal was successful.</p>
158 <p></p>
159 </div>
160 </div>
161 <hr>
162 <div class="refsect2">
163 <a name="gsignond-wipe-directory"></a><h3>gsignond_wipe_directory ()</h3>
164 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
165 gsignond_wipe_directory (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *dirname</code></em>);</pre>
166 <p>This function securely wipes the contents of the directory by calling
167 <a class="link" href="gsignond-Utility-functions.html#gsignond-wipe-file" title="gsignond_wipe_file ()"><code class="function">gsignond_wipe_file()</code></a> on each file. It also removes links and empty directories but 
168 does not recursively wipe them.</p>
169 <div class="refsect3">
170 <a name="id-1.8.4.7.3.5"></a><h4>Parameters</h4>
171 <div class="informaltable"><table width="100%" border="0">
172 <colgroup>
173 <col width="150px" class="parameters_name">
174 <col class="parameters_description">
175 <col width="200px" class="parameters_annotations">
176 </colgroup>
177 <tbody><tr>
178 <td class="parameter_name"><p>dirname</p></td>
179 <td class="parameter_description"><p>directory to wipe</p></td>
180 <td class="parameter_annotations"> </td>
181 </tr></tbody>
182 </table></div>
183 </div>
184 <div class="refsect3">
185 <a name="id-1.8.4.7.3.6"></a><h4>Returns</h4>
186 <p> TRUE if wiping and removal was successful.</p>
187 <p></p>
188 </div>
189 </div>
190 <hr>
191 <div class="refsect2">
192 <a name="gsignond-generate-nonce"></a><h3>gsignond_generate_nonce ()</h3>
193 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
194 gsignond_generate_nonce ();</pre>
195 <p>This function generates a random secure nonce using SHA1 HMAC.</p>
196 <div class="refsect3">
197 <a name="id-1.8.4.7.4.5"></a><h4>Returns</h4>
198 <p> the nonce in lowercase hexadecimal format, 40 bytes long. </p>
199 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
200 </div>
201 </div>
202 <hr>
203 <div class="refsect2">
204 <a name="gsignond-sequence-to-variant"></a><h3>gsignond_sequence_to_variant ()</h3>
205 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *
206 gsignond_sequence_to_variant (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="type">GSequence</span></a> *seq</code></em>);</pre>
207 <p>Convert a string sequence to a variant.</p>
208 <div class="refsect3">
209 <a name="id-1.8.4.7.5.5"></a><h4>Parameters</h4>
210 <div class="informaltable"><table width="100%" border="0">
211 <colgroup>
212 <col width="150px" class="parameters_name">
213 <col class="parameters_description">
214 <col width="200px" class="parameters_annotations">
215 </colgroup>
216 <tbody><tr>
217 <td class="parameter_name"><p>seq</p></td>
218 <td class="parameter_description"><p>Sequence of strings to convert</p></td>
219 <td class="parameter_annotations"> </td>
220 </tr></tbody>
221 </table></div>
222 </div>
223 <div class="refsect3">
224 <a name="id-1.8.4.7.5.6"></a><h4>Returns</h4>
225 <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> of type "as". </p>
226 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
227 </div>
228 </div>
229 <hr>
230 <div class="refsect2">
231 <a name="gsignond-variant-to-sequence"></a><h3>gsignond_variant_to_sequence ()</h3>
232 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
233 gsignond_variant_to_sequence (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *var</code></em>);</pre>
234 <p>Convert variant containing string array to sequence.</p>
235 <div class="refsect3">
236 <a name="id-1.8.4.7.6.5"></a><h4>Parameters</h4>
237 <div class="informaltable"><table width="100%" border="0">
238 <colgroup>
239 <col width="150px" class="parameters_name">
240 <col class="parameters_description">
241 <col width="200px" class="parameters_annotations">
242 </colgroup>
243 <tbody><tr>
244 <td class="parameter_name"><p>var</p></td>
245 <td class="parameter_description"><p>Variant of "as" to convert</p></td>
246 <td class="parameter_annotations"> </td>
247 </tr></tbody>
248 </table></div>
249 </div>
250 <div class="refsect3">
251 <a name="id-1.8.4.7.6.6"></a><h4>Returns</h4>
252 <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="type">GSequence</span></a> of strings. </p>
253 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
254 </div>
255 </div>
256 <hr>
257 <div class="refsect2">
258 <a name="gsignond-sequence-to-array"></a><h3>gsignond_sequence_to_array ()</h3>
259 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> **
260 gsignond_sequence_to_array (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="type">GSequence</span></a> *seq</code></em>);</pre>
261 <p>Convert sequence of strings to null-terminated string array.</p>
262 <div class="refsect3">
263 <a name="id-1.8.4.7.7.5"></a><h4>Parameters</h4>
264 <div class="informaltable"><table width="100%" border="0">
265 <colgroup>
266 <col width="150px" class="parameters_name">
267 <col class="parameters_description">
268 <col width="200px" class="parameters_annotations">
269 </colgroup>
270 <tbody><tr>
271 <td class="parameter_name"><p>seq</p></td>
272 <td class="parameter_description"><p>Sequence of strings to convert</p></td>
273 <td class="parameter_annotations"> </td>
274 </tr></tbody>
275 </table></div>
276 </div>
277 <div class="refsect3">
278 <a name="id-1.8.4.7.7.6"></a><h4>Returns</h4>
279 <p> Null-terminated array of strings. </p>
280 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
281 </div>
282 </div>
283 <hr>
284 <div class="refsect2">
285 <a name="gsignond-array-to-sequence"></a><h3>gsignond_array_to_sequence ()</h3>
286 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
287 gsignond_array_to_sequence (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **items</code></em>);</pre>
288 <p>Convert null-terminated array of strings to a sequence.</p>
289 <div class="refsect3">
290 <a name="id-1.8.4.7.8.5"></a><h4>Parameters</h4>
291 <div class="informaltable"><table width="100%" border="0">
292 <colgroup>
293 <col width="150px" class="parameters_name">
294 <col class="parameters_description">
295 <col width="200px" class="parameters_annotations">
296 </colgroup>
297 <tbody><tr>
298 <td class="parameter_name"><p>items</p></td>
299 <td class="parameter_description"><p> Null-terminated array of strings to convert. </p></td>
300 <td class="parameter_annotations"><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></td>
301 </tr></tbody>
302 </table></div>
303 </div>
304 <div class="refsect3">
305 <a name="id-1.8.4.7.8.6"></a><h4>Returns</h4>
306 <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="type">GSequence</span></a> of strings. </p>
307 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
308 </div>
309 </div>
310 <hr>
311 <div class="refsect2">
312 <a name="gsignond-copy-array-to-sequence"></a><h3>gsignond_copy_array_to_sequence ()</h3>
313 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="returnvalue">GSequence</span></a> *
314 gsignond_copy_array_to_sequence (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> **items</code></em>);</pre>
315 <p>Copy null-terminated array of strings to a sequence.</p>
316 <div class="refsect3">
317 <a name="id-1.8.4.7.9.5"></a><h4>Parameters</h4>
318 <div class="informaltable"><table width="100%" border="0">
319 <colgroup>
320 <col width="150px" class="parameters_name">
321 <col class="parameters_description">
322 <col width="200px" class="parameters_annotations">
323 </colgroup>
324 <tbody><tr>
325 <td class="parameter_name"><p>items</p></td>
326 <td class="parameter_description"><p>Null-terminated array of strings to copy</p></td>
327 <td class="parameter_annotations"> </td>
328 </tr></tbody>
329 </table></div>
330 </div>
331 <div class="refsect3">
332 <a name="id-1.8.4.7.9.6"></a><h4>Returns</h4>
333 <p> <a href="http://library.gnome.org/devel/glib/unstable/glib-Sequences.html#GSequence"><span class="type">GSequence</span></a> of strings. </p>
334 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
335 </div>
336 </div>
337 <hr>
338 <div class="refsect2">
339 <a name="gsignond-is-host-in-domain"></a><h3>gsignond_is_host_in_domain ()</h3>
340 <pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
341 gsignond_is_host_in_domain (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *host</code></em>,
342                             <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *domain</code></em>);</pre>
343 <p>Checks if <em class="parameter"><code>host</code></em>
344  belongs to <em class="parameter"><code>domain</code></em>
345 .</p>
346 <div class="refsect3">
347 <a name="id-1.8.4.7.10.5"></a><h4>Parameters</h4>
348 <div class="informaltable"><table width="100%" border="0">
349 <colgroup>
350 <col width="150px" class="parameters_name">
351 <col class="parameters_description">
352 <col width="200px" class="parameters_annotations">
353 </colgroup>
354 <tbody>
355 <tr>
356 <td class="parameter_name"><p>domain</p></td>
357 <td class="parameter_description"><p>a domain name</p></td>
358 <td class="parameter_annotations"> </td>
359 </tr>
360 <tr>
361 <td class="parameter_name"><p>host</p></td>
362 <td class="parameter_description"><p>a host name</p></td>
363 <td class="parameter_annotations"> </td>
364 </tr>
365 </tbody>
366 </table></div>
367 </div>
368 <div class="refsect3">
369 <a name="id-1.8.4.7.10.6"></a><h4>Returns</h4>
370 <p> the result</p>
371 <p></p>
372 </div>
373 </div>
374 </div>
375 <div class="refsect1">
376 <a name="gsignond-Utility-functions.other_details"></a><h2>Types and Values</h2>
377 </div>
378 </div>
379 <div class="footer">
380 <hr>
381           Generated by GTK-Doc V1.20</div>
382 </body>
383 </html>