projects/libpws

view pws_init.3.xml @ 13:2bb1bbac1d0a

Added tag version-1.0.0 for changeset 1926dfc9feb0
author Guido Berhoerster <guido+libpws@berhoerster.name>
date Sun Aug 04 21:37:56 2019 +0200 (2019-08-04)
parents e1309515d111
children
line source
1 <?xml version="1.0"?>
2 <!--
4 Copyright (C) 2015 Guido Berhoerster <guido+libpws@berhoerster.name>
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
14 The above copyright notice and this permission notice shall be included
15 in all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 -->
26 <refentry xmlns="http://docbook.org/ns/docbook" xml:lang="en">
27 <info>
28 <author>
29 <personname>
30 <firstname>Guido</firstname>
31 <surname>Berhoerster</surname>
32 </personname>
33 <email>guido+libpws@berhoerster.name</email>
34 <personblurb/>
35 </author>
36 <date>21 March, 2015</date>
37 </info>
38 <refmeta>
39 <refentrytitle>pws_init</refentrytitle>
40 <manvolnum>3</manvolnum>
41 <refmiscinfo class="source"/>
42 <refmiscinfo class="version"/>
43 <refmiscinfo class="manual">Library Functions</refmiscinfo>
44 </refmeta>
45 <refnamediv>
46 <refname>pws_init</refname>
47 <refname>pws_finalize</refname>
48 <refname>pws_set_alloc_functions</refname>
49 <refname>pws_generate_uuid</refname>
50 <refpurpose>initalize and deinitialize libpws</refpurpose>
51 </refnamediv>
52 <refsynopsisdiv>
53 <cmdsynopsis>
54 <command>cc</command>
55 <arg choice="opt" rep="repeat">
56 <option>flag</option>
57 </arg>
58 <arg choice="plain" rep="repeat">
59 <option>file</option>
60 </arg>
61 <arg choice="plain">
62 <option>-lpws</option>
63 </arg>
64 <arg choice="plain">
65 <option>-lnettle</option>
66 </arg>
67 <arg choice="opt" rep="repeat">
68 <option>library</option>
69 </arg>
70 </cmdsynopsis>
71 <funcsynopsis>
72 <funcsynopsisinfo>
73 #include &lt;pws.h&gt;
74 </funcsynopsisinfo>
75 <funcprototype>
76 <funcdef>int <function>pws_init</function></funcdef>
77 <void/>
78 </funcprototype>
79 <funcprototype>
80 <funcdef>void <function>pws_finalize</function></funcdef>
81 <void/>
82 </funcprototype>
83 <funcprototype>
84 <funcdef>void <function>pws_set_alloc_functions</function></funcdef>
85 <paramdef>void
86 *<funcparams>*<replaceable>alloc_function</replaceable></funcparams><funcparams>size_t</funcparams></paramdef>
87 <paramdef>void
88 *<funcparams>*<replaceable>realloc_function</replaceable></funcparams><funcparams>void *, size_t</funcparams></paramdef>
89 <paramdef>void <funcparams>*<replaceable>free_function</replaceable></funcparams><funcparams>void
90 *, size_t</funcparams></paramdef>
91 <paramdef>void
92 *<funcparams>*<replaceable>secure_alloc_function</replaceable></funcparams><funcparams>size_t</funcparams></paramdef>
93 <paramdef>void
94 *<funcparams>*<replaceable>secure_realloc_function</replaceable></funcparams><funcparams>void *, size_t</funcparams></paramdef>
95 <paramdef>void <funcparams>*<replaceable>secure_free_function</replaceable></funcparams><funcparams>void
96 *, size_t</funcparams></paramdef>
97 </funcprototype>
98 <funcprototype>
99 <funcdef>int <function>pws_generate_uuid</function></funcdef>
100 <paramdef>unsigned char [static PWS3_UUID_SIZE]</paramdef>
101 </funcprototype>
102 </funcsynopsis>
103 <synopsis>
104 <constant>LIBPWS_VERSION_MAJOR</constant>
106 <constant>LIBPWS_VERSION_MINOR</constant>
108 <constant>LIBPWS_VERSION_MICRO</constant>
109 </synopsis>
110 </refsynopsisdiv>
111 <refsect1>
112 <title>Description</title>
113 <para>The <function>pws_init()</function> function initializes
114 <citerefentry><refentrytitle>libpws</refentrytitle><manvolnum>3</manvolnum></citerefentry>
115 and must be called before any other function from this library.</para>
116 <para>The <function>pws_finalize()</function> function deinitializes
117 <citerefentry><refentrytitle>libpws</refentrytitle><manvolnum>3</manvolnum></citerefentry>
118 after which no other function from this library may be called.</para>
119 <para>The <function>pws_set_alloc_functions()</function> function specifies
120 the functions which are used by
121 <citerefentry><refentrytitle>libpws</refentrytitle><manvolnum>3</manvolnum></citerefentry>
122 to allocate, reallocate or free memory allowing for the use of custom
123 allocators. <function>pws_secure_alloc</function>,
124 <function>pws_secure_realloc</function>, and
125 <function>pws_secure_free</function> are used to allocate, reallocate, and
126 free memory containing potentially sensitive information such as passwords,
127 this e.g. allows for wrapping the acutal allocation using operating system
128 specific facilities to prevent memory from being paged to the swap area or
129 to overwrite memory before deallocating it. Any argument set to
130 <constant>NULL</constant> will result in the default function being used,
131 these are <function>malloc</function>, <function>realloc</function>, and a
132 wrapper around <function>free</function>. This function must be called
133 after <function>pws_init</function> and before calling any other function
134 from this library. It is not reentrant.</para>
135 <para>The <function>pws_uuid_create()</function> function generates a new
136 random UUID following RFC4122 and places it in the array passed to
137 it.</para>
138 <para>The macros <constant>LIBPWS_VERSION_MAJOR</constant>,
139 <constant>LIBPWS_VERSION_MINOR</constant>, and
140 <constant>LIBPWS_VERSION_MICRO</constant> can be used to check the major,
141 minor, and micro version of the library.</para>
142 </refsect1>
143 <refsect1>
144 <title>Return Values</title>
145 <para>The <function>pws_init()</function> function returns
146 <returnvalue>0</returnvalue> if the library was initialized successfully and
147 <returnvalue>-1</returnvalue> on failure.</para>
148 <para>The <function>pws_generate_uuid()</function> returns
149 <returnvalue>0</returnvalue> if a new random UUID has been generated and
150 <returnvalue>-1</returnvalue> on failure.</para>
151 </refsect1>
152 <refsect1>
153 <title>See Also</title>
154 <para><citerefentry><refentrytitle>libpws</refentrytitle>
155 <manvolnum>3</manvolnum></citerefentry>,
156 <citerefentry><refentrytitle>pws3_file_create</refentrytitle>
157 <manvolnum>3</manvolnum></citerefentry>, RFC4122</para>
158 </refsect1>
159 </refentry>