Add pwmd_passwd().
[libpwmd.git] / doc / libpwmd.3
blob2550ea5e09d2455ff7699585cf5fcb07afd53445
1 .TH "libpwmd.h" 3 "Sun Jul 7 2013" "Version 7.0.2" "libpwmd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 libpwmd.h - an API for accessing pwmd
6 .SH "Description"
7 .PP 
8 libpwmd is a library making it easy for applications to use the pwmd server\&. Pwmd version 3\&.0 or later is required; either locally or remotely\&.
9 .SH "Threads"
10 .PP
11 \fBlibpwmd\fP should be thread-safe on a per handle bases\&. Meaning that only one thread should access a \fBpwm_t\fP handle at a time\&.
12 .SH "Remote Connection Details"
13 .PP
14 There are two methods of connecting to a remote pwmd server: over SSH and over TLS\&.
15 .PP
16 Connections over SSH are done by creating an SSH channel to spawn a shell that executes a proxy server to connect to the pwmd local Unix Domain Socket\&. Authentication is done by using SSH public key (see \fBssh-keygen(1)\fP) authentication and verifying the host key against a local OpenSSH known hosts formatted file\&.
17 .PP
18 An unknown servers public key can be added to a known hosts file after user confirmation by setting the callback function \fBpwmd_knownhost_cb_t\fP before connecting to the unknown host\&.
19 .PP
20 On the server side you'll need a proxy server to connect to the pwmd server\&. Below is an example of an \fBauthorized_keys(5)\fP entry that will do this\&. The \fIpublic_key\fP portion should be the same as the contents of the \fBssh-keygen(1)\fP \fIidentity\&.pub\fP file generated on the client machine\&. The private key should be passed as the \fIidentity\fP parameter to \fBpwmd_connect()\fP:
21 .PP
22 .PP
23 .nf
24 command="socat UNIX-CONNECT:$HOME/\&.pwmd/socket -" <public_key> \&.\&.\&.
25 .fi
26 .PP
27 .PP
28 \fBNote:\fP
29 .RS 4
30 Only an SSH identity without a passphrase is supported\&. For now anyway\&. This is a limitation of libssh2 (version 1\&.2\&.8 as of this writing)\&.
31 .RE
32 .PP
33 \fBVersion:\fP
34 .RS 4
35 6\&.0\&.3 The first version to use the OpenSSH known hosts file format exclusively\&. Earlier versions used only an SHA1 hash of the host key\&.
36 .RE
37 .PP
38 Pwmd itself can accept TLS connections so no proxy program is needed as is when using SSH\&. Like SSH connections, TLS connections are created with \fBpwmd_connect()\fP\&. You will need to generate a client key and X509 certificate and then sign it with the same certificate authority (CA) that the pwmd server certificate was signed with\&.
39 .PP
40 Certificates are similar to SSH public and private keys but a little harder to setup correctly\&. See the \fBcerttool(1)\fP (recommended) and \fBopenssl(1)\fP manual pages for details\&.
41 .SH "Pinentry Details"
42 .PP
43 \fBpinentry(1)\fP is a program that prompts the user for input which is normally a passphrase or a confirmation\&. libpwmd can use this program either locally (X11 forwarding is not yet supported) or have the pwmd server or gpg-agent use it's pinentry to retrieve a passphrase when needed\&.
44 .PP
45 There are a few options that tell pinentry how and where to prompt for a needed passphrase\&. See the \fBpwmd_option_t\fP section for details\&. These options are only sent to pwmd in \fBpwmd_open()\fP and only when pinentry use has not been disabled and when not over an remote connnection\&.
46 .PP
47 Some pinentry options may also be specified in the local configuration file \fI'~/\&.pwmd/pinentry\&.conf'\fP\&. These options are initial values for each pinentry invokation (not retries) and may be changed by setting the appropriate \fBpwmd_option_t\fP\&. Options and values are separated with a '=' on a single line\&. Unrecognized options are ignored\&. Here are the recognized options:
48 .PP
49 \fBParameters:\fP
50 .RS 4
51 \fIPATH\fP The full path to the location of the pinentry binary\&. Only useful for the local pinentry\&. 
52 .br
53 \fIDISPLAY\fP The X11 display to use\&. 
54 .br
55 \fITTYNAME\fP The full path to the tty that pinentry should prompt on\&. 
56 .br
57 \fITTYTYPE\fP The terminal type of the tty which is required if DISPLAY is not set\&. 
58 .br
59 \fILC_MESSAGES\fP Adjust for the current locale\&. 
60 .br
61 \fILC_CTYPE\fP Adjust for the current locale\&.
62 .RE
63 .PP
64 \fBNote:\fP
65 .RS 4
66 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user\&.
67 .PP
68 The initial values for the pinentry TTY, TERM and DISPLAY are set during \fBpwmd_new()\fP depending on the current environment\&. They can be reset or changed as needed\&.
69 .PP
70 After establishing a remote connection, pwmd's pinentry is disabled by passing the '--no-pinentry' option to the OPEN protocol command during \fBpwmd_open()\fP since X11 forwarding has not been implemented\&. A local pinentry will be used in the case of a remote connection\&.
71 .RE
72 .PP
73 \fBSee Also:\fP
74 .RS 4
75 \fBRemote Connection Details\fP
76 .RE
77 .PP
78 .SH "Errors"
79 .PP
80 libpwmd uses libgpg-error for all error codes\&. Error codes can be described by using \fBgpg_strerror()\fP, or the thread-safe \fBgpg_strerror_r()\fP\&.
81 .PP
82 \fBNote:\fP
83 .RS 4
84 libgpg-error returns an error code as a bitmask of an error source and the error code\&. Determining the error source can help you find where the error occured, beit from \fBpinentry(1)\fP, \fBgpg-agent(1)\fP, \fBlibgcrypt\fP, \fBpwmd(1)\fP or \fBlibpwmd(3)\fP\&. pwmd uses the \fBGPG_ERR_SOURCE_USER_1\fP error source and libpwmd uses \fBGPG_ERR_SOURCE_USER_2\fP\&. To find the error source of an error code the \fBgpg-error(1)\fP command line utility may be of use\&. Also see the \fBlibgpg-error\fP documentation for error code manipulation\&. 
85 .RE
86 .PP
88 .SH SYNOPSIS
89 .br
90 .PP
91 .SS "Constants"
93 .in +1c
94 .ti -1c
95 .RI "#define \fBLIBPWMD_API\fP"
96 .br
97 .ti -1c
98 .RI "#define \fBGPG_ERR_SOURCE_DEFAULT\fP   GPG_ERR_SOURCE_USER_2"
99 .br
100 .ti -1c
101 .RI "#define \fBLIBPWMD_VERSION\fP   0x070002"
103 .ti -1c
104 .RI "#define \fBLIBPWMD_VERSION_MAJOR\fP   7"
106 .ti -1c
107 .RI "#define \fBLIBPWMD_VERSION_MINOR\fP   0"
109 .ti -1c
110 .RI "#define \fBLIBPWMD_VERSION_PATCH\fP   2"
112 .ti -1c
113 .RI "#define \fBLIBPWMD_VERSION_STR\fP   '7\&.0\&.2-dev'"
115 .ti -1c
116 .RI "#define \fBPWMD_FEATURE_PINENTRY\fP"
118 .ti -1c
119 .RI "#define \fBPWMD_FEATURE_CRACK\fP"
121 .ti -1c
122 .RI "#define \fBPWMD_FEATURE_SSH\fP"
124 .ti -1c
125 .RI "#define \fBPWMD_FEATURE_GNUTLS\fP"
127 .in -1c
128 .SS "Typedefs"
130 .in +1c
131 .ti -1c
132 .RI "typedef struct pwm_s \fBpwm_t\fP"
134 .ti -1c
135 .RI "typedef gpg_error_t(* \fBpwmd_status_cb_t\fP )(void *user, const char *line)"
137 .ti -1c
138 .RI "typedef gpg_error_t(* \fBpwmd_inquire_cb_t\fP )(void *user, const char *keyword, gpg_error_t rc, char **data, size_t *len)"
140 .ti -1c
141 .RI "typedef gpg_error_t(* \fBpwmd_knownhost_cb_t\fP )(void *user, const char *host, const char *hostkey, size_t len)"
143 .in -1c
144 .SS "Enumerations"
146 .in +1c
147 .ti -1c
148 .RI "enum \fBpwmd_socket_t\fP { \fBPWMD_SOCKET_LOCAL\fP, \fBPWMD_SOCKET_SSH\fP, \fBPWMD_SOCKET_TLS\fP }"
150 .ti -1c
151 .RI "enum \fBpwmd_pinentry_t\fP { \fBPWMD_PINENTRY_OPEN\fP, \fBPWMD_PINENTRY_OPEN_FAILED\fP, \fBPWMD_PINENTRY_SAVE\fP, \fBPWMD_PINENTRY_SAVE_CONFIRM\fP, \fBPWMD_PINENTRY_SAVE_FAILED\fP, \fBPWMD_PINENTRY_CONFIRM\fP, \fBPWMD_PINENTRY_USER\fP, \fBPWMD_PINENTRY_CLOSE\fP }"
153 .ti -1c
154 .RI "enum \fBpwmd_option_t\fP { \fBPWMD_OPTION_PINENTRY_PATH\fP, \fBPWMD_OPTION_PINENTRY_TTY\fP, \fBPWMD_OPTION_PINENTRY_TERM\fP, \fBPWMD_OPTION_PINENTRY_DISPLAY\fP, \fBPWMD_OPTION_PINENTRY_ERROR\fP, \fBPWMD_OPTION_PINENTRY_PROMPT\fP, \fBPWMD_OPTION_PINENTRY_DESC\fP, \fBPWMD_OPTION_PINENTRY_LC_CTYPE\fP, \fBPWMD_OPTION_PINENTRY_LC_MESSAGES\fP, \fBPWMD_OPTION_PINENTRY_TIMEOUT\fP, \fBPWMD_OPTION_PINENTRY_TRIES\fP, \fBPWMD_OPTION_STATUS_CB\fP, \fBPWMD_OPTION_STATUS_DATA\fP, \fBPWMD_OPTION_KNOWNHOST_CB\fP, \fBPWMD_OPTION_KNOWNHOST_DATA\fP, \fBPWMD_OPTION_INQUIRE_TOTAL\fP, \fBPWMD_OPTION_LOCK_ON_OPEN\fP, \fBPWMD_OPTION_SSH_AGENT\fP, \fBPWMD_OPTION_NO_PINENTRY\fP, \fBPWMD_OPTION_LOCAL_PINENTRY\fP, \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP, \fBPWMD_OPTION_SOCKET_TIMEOUT\fP, \fBPWMD_OPTION_TLS_VERIFY\fP }"
156 .in -1c
157 .SS "Functions"
159 .in +1c
160 .ti -1c
161 .RI "LIBPWMD_API const char * \fBpwmd_version\fP ()"
163 .ti -1c
164 .RI "LIBPWMD_API unsigned int \fBpwmd_features\fP ()"
166 .ti -1c
167 .RI "LIBPWMD_API gpg_error_t \fBpwmd_init\fP (void)"
169 .ti -1c
170 .RI "LIBPWMD_API void \fBpwmd_deinit\fP (void)"
172 .ti -1c
173 .RI "LIBPWMD_API gpg_error_t \fBpwmd_new\fP (const char *name, \fBpwm_t\fP **pwm)"
175 .ti -1c
176 .RI "LIBPWMD_API void \fBpwmd_set_pointer\fP (\fBpwm_t\fP *pwm, void *data)"
178 .ti -1c
179 .RI "LIBPWMD_API void * \fBpwmd_get_pointer\fP (\fBpwm_t\fP *pwm)"
181 .ti -1c
182 .RI "LIBPWMD_API gpg_error_t \fBpwmd_connect\fP (\fBpwm_t\fP *pwm, const char *url,\&.\&.\&.)"
184 .ti -1c
185 .RI "LIBPWMD_API gpg_error_t \fBpwmd_setopt\fP (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fP opt,\&.\&.\&.)"
187 .ti -1c
188 .RI "LIBPWMD_API gpg_error_t \fBpwmd_getopt\fP (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fP opt,\&.\&.\&.)"
190 .ti -1c
191 .RI "LIBPWMD_API gpg_error_t \fBpwmd_getpin\fP (\fBpwm_t\fP *pwm, const char *filename, char **result, size_t *len, \fBpwmd_pinentry_t\fP which)"
193 .ti -1c
194 .RI "LIBPWMD_API gpg_error_t \fBpwmd_password\fP (\fBpwm_t\fP *pwm, const char *keyword, char **data, size_t *size)"
196 .ti -1c
197 .RI "LIBPWMD_API gpg_error_t \fBpwmd_open\fP (\fBpwm_t\fP *pwm, const char *filename, \fBpwmd_inquire_cb_t\fP callback, void *data)"
199 .ti -1c
200 .RI "LIBPWMD_API gpg_error_t \fBpwmd_process\fP (\fBpwm_t\fP *pwm)"
202 .ti -1c
203 .RI "LIBPWMD_API gpg_error_t \fBpwmd_save\fP (\fBpwm_t\fP *pwm, const char *args, \fBpwmd_inquire_cb_t\fP callback, void *user)"
205 .ti -1c
206 .RI "LIBPWMD_API gpg_error_t \fBpwmd_passwd\fP (\fBpwm_t\fP *pwm, const char *args, \fBpwmd_inquire_cb_t\fP callback, void *user)"
208 .ti -1c
209 .RI "LIBPWMD_API gpg_error_t \fBpwmd_command\fP (\fBpwm_t\fP *pwm, char **result, size_t *len, \fBpwmd_inquire_cb_t\fP callback, void *user, const char *cmd,\&.\&.\&.)"
211 .ti -1c
212 .RI "LIBPWMD_API gpg_error_t \fBpwmd_command_ap\fP (\fBpwm_t\fP *pwm, char **result, size_t *len, \fBpwmd_inquire_cb_t\fP callback, void *user, const char *cmd, va_list ap)"
214 .ti -1c
215 .RI "LIBPWMD_API gpg_error_t \fBpwmd_disconnect\fP (\fBpwm_t\fP *pwm)"
217 .ti -1c
218 .RI "LIBPWMD_API void \fBpwmd_close\fP (\fBpwm_t\fP *pwm)"
220 .ti -1c
221 .RI "LIBPWMD_API gpg_error_t \fBpwmd_socket_type\fP (\fBpwm_t\fP *pwm, \fBpwmd_socket_t\fP *type)"
223 .ti -1c
224 .RI "LIBPWMD_API gpg_error_t \fBpwmd_fd\fP (\fBpwm_t\fP *pwm, int *fd)"
226 .ti -1c
227 .RI "LIBPWMD_API void \fBpwmd_free\fP (void *ptr)"
229 .ti -1c
230 .RI "LIBPWMD_API void * \fBpwmd_malloc\fP (size_t size)"
232 .ti -1c
233 .RI "LIBPWMD_API void * \fBpwmd_calloc\fP (size_t nmemb, size_t size)"
235 .ti -1c
236 .RI "LIBPWMD_API void * \fBpwmd_realloc\fP (void *ptr, size_t size)"
238 .ti -1c
239 .RI "LIBPWMD_API char * \fBpwmd_strdup\fP (const char *str)"
241 .ti -1c
242 .RI "LIBPWMD_API char * \fBpwmd_strdup_printf\fP (const char *fmt,\&.\&.\&.)"
244 .ti -1c
245 .RI "void \fBgnutls_global_set_mem_functions\fP (void *(*)(size_t), void *(*)(size_t), int(*)(const void *), void *(*)(void *, size_t), void(*)(void *))"
247 .in -1c
248 .SH "Constant Details"
249 .PP 
250 .SS "#define LIBPWMD_VERSION   0x070002"
253 Version information\&. The version of this library\&. 
254 .SS "#define LIBPWMD_VERSION_MAJOR   7"
257 Version information\&. The major release number of this library\&. 
258 .SS "#define LIBPWMD_VERSION_MINOR   0"
261 Version information\&. The minor release number of this library\&. 
262 .SS "#define LIBPWMD_VERSION_PATCH   2"
265 Version information\&. The patch level of this library\&. 
266 .SS "#define LIBPWMD_VERSION_STR   '7\&.0\&.2-dev'"
269 Version information\&. A string representation of the version of this library\&. 
270 .SS "#define PWMD_FEATURE_CRACK"
273 Password quality checking\&. A password quality meter is shown when the pinentry supports it\&. 
274 .SS "#define PWMD_FEATURE_GNUTLS"
277 Remote connections over TLS\&. 
279 \fBSee Also:\fP
280 .RS 4
281 \fBRemote Connection Details\fP 
285 .SS "#define PWMD_FEATURE_PINENTRY"
288 Pinentry support\&. This is for a local or fork()'ed pinentry\&. 
289 .SS "#define PWMD_FEATURE_SSH"
292 Remote connections over an SSH channel\&. 
294 \fBSee Also:\fP
295 .RS 4
296 \fBRemote Connection Details\fP 
300 .SH "Typedef Details"
301 .PP 
302 .SS "\fBpwm_t\fP"
305 A libpwmd handle\&. When a pwmd handle or context is mentioned in this documentation it is a pointer of this type\&. A new handle is created with \fBpwmd_new()\fP\&. 
306 .SS "pwmd_inquire_cb_t"
309 Send data to the pwmd server\&. This is a callback function that is used for sending data to the server for commands that need to reply to an INQUIRE server response\&. The reason for this callback is to let the client send as many bytes as it wants rather than the entire data at once\&. It gets called during an internal \fBassuan_transact()\fP from an internal inquire callback function which in turn calls this function by looping over its return value\&.
311 \fBParameters:\fP
312 .RS 4
313 \fIuser\fP The user data pointer passed to the libpwmd function specifying this callback\&. 
315 \fIkeyword\fP The name of this inquire\&. Could be a command name or some keyword describing what needs to be sent\&. See the pwmd and \fBgpg-agent(1)\fP documentation for details\&. 
317 \fIrc\fP The result of the last internal call to \fBassuan_send_data()\fP which did the sending of the data to the pwmd server\&. On the first call to this callback it's value will always be 0 since no data has been sent yet\&. This should be checked during each call to this function and should return the same error code when set\&. Its purpose is to let the client clean up before letting the command fail\&. 
319 \fIdata\fP The next chunk of data to send or NULL\&. 
321 \fIlen\fP The length of \fIdata\fP or 0\&.
324 \fBReturn values:\fP
325 .RS 4
326 \fI0\fP There is more data to be sent\&. 
328 \fIGPG_ERR_EOF\fP No need to call this function again, the current \fIdata\fP is the last to send\&. 
330 \fIcode\fP Any other error code which will cancel the INQUIRE\&.
333 \fBNote:\fP
334 .RS 4
335 The sent data is processed line-per-line\&. The line is either newline terminated or is buffered until ASSUAN_LINELENGTH bytes have been allocated\&. Any remaining bytes are sent after the INQUIRE has finished\&. 
339 .SS "pwmd_knownhost_cb_t"
342 Verify a remote SSH connection\&. When \fBPWMD_OPTION_KNOWNHOST_CB\fP is set and a the current connections host key was not found in the known hosts file, then this callback function can be used to confirm the addition of the new host key to the known_hosts file\&.
344 \fBParameters:\fP
345 .RS 4
346 \fIuser\fP User data which was set with \fBPWMD_OPTION_KNOWNHOST_DATA\fP\&. 
348 \fIhost\fP The hostname as passed to \fBpwmd_connect()\fP\&. 
350 \fIhostkey\fP The raw binary data of the host key\&. 
352 \fIlen\fP The length of \fIhostkey\fP\&. 
355 \fBReturn values:\fP
356 .RS 4
357 \fI0\fP Add the host key to the known hosts file\&. 
359 \fIGPG_ERR_NOT_CONFIRMED\fP Do not add the host key and abort the connection\&. This is the recommended error code although any other non-zero return value will also abort the connection\&.
362 \fBNote:\fP
363 .RS 4
364 If the known hosts file cannot be modified do to filesystem restrictions when trying to add the new host key, no error is returned\&. Instead, the host key is added to the current connections host key cache and the connection is accepted\&.
367 \fBSee Also:\fP
368 .RS 4
369 \fBRemote Connection Details\fP 
373 .SS "pwmd_status_cb_t"
376 Process status messages\&. The value of the option \fBPWMD_OPTION_STATUS_CB\fP which is set with \fBpwmd_setopt()\fP\&.
378 \fBParameters:\fP
379 .RS 4
380 \fIuser\fP A user data pointer which is set with \fBPWMD_OPTION_STATUS_DATA\fP\&. 
382 \fIline\fP The status message line received from the server\&. 
385 \fBReturns:\fP
386 .RS 4
387 0 on success or an error code which will cause a command to fail\&. 
391 .SH "Enumeration Details"
392 .PP 
393 .SS "enum \fBpwmd_option_t\fP"
396 libpwmd options\&. Options are set with \fBpwmd_setopt()\fP\&. Some options must be set before a connection is made to have any effect\&.
398 \fBNote:\fP
399 .RS 4
400 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user\&. 
405 \fBEnumerator\fP
406 .in +1c
408 \fB\fIPWMD_OPTION_PINENTRY_PATH \fP\fP
409 A string value which specifies the full path of the \fBpinentry(1)\fP binary\&. The default is specified at compile time\&.
411 \fBNote:\fP
412 .RS 4
413 This only affects the local pinentry\&. 
416 \fBSee Also:\fP
417 .RS 4
418 \fBPinentry Details\fP 
423 \fB\fIPWMD_OPTION_PINENTRY_TTY \fP\fP
424 A string value which specifies the full path to the TTY that \fBpinentry(1)\fP will use to prompt on\&. When set and no DISPLAY is available, \fBPWMD_OPTION_PINENTRY_TERM\fP must also be set\&.
426 \fBSee Also:\fP
427 .RS 4
428 \fBPinentry Details\fP 
433 \fB\fIPWMD_OPTION_PINENTRY_TERM \fP\fP
434 A string value which specifies the terminal type (i\&.e\&., vt100) that \fBpinentry(1)\fP will use when no X11 display is available\&.
436 \fBSee Also:\fP
437 .RS 4
438 \fBPinentry Details\fP 
443 \fB\fIPWMD_OPTION_PINENTRY_DISPLAY \fP\fP
444 A string value which specifies the X11 display that \fBpinentry(1)\fP will use\&. \fBpinentry(1)\fP seems to make DISPLAY have a higher priority than \fBPWMD_OPTION_PINENTRY_TTY\fP\&.
446 \fBSee Also:\fP
447 .RS 4
448 \fBPinentry Details\fP 
453 \fB\fIPWMD_OPTION_PINENTRY_ERROR \fP\fP
454 A character string that \fBpinentry(1)\fP will use in it's dialog window\&. 
456 \fB\fIPWMD_OPTION_PINENTRY_PROMPT \fP\fP
457 A character string that \fBpinentry(1)\fP will use in it's dialog window\&. 
459 \fB\fIPWMD_OPTION_PINENTRY_DESC \fP\fP
460 A character string that \fBpinentry(1)\fP will use in it's dialog window\&. 
462 \fB\fIPWMD_OPTION_PINENTRY_LC_CTYPE \fP\fP
463 For \fBpinentry(1)\fP localization\&. 
465 \fB\fIPWMD_OPTION_PINENTRY_LC_MESSAGES \fP\fP
466 For \fBpinentry(1)\fP localization\&. 
468 \fB\fIPWMD_OPTION_PINENTRY_TIMEOUT \fP\fP
469 An integer value that specifies the number of seconds \fBpinentry(1)\fP will wait for input before timing out and aborting the current command\&. If 0, then no timeout will be used\&. The default is 30\&.
471 \fBNote:\fP
472 .RS 4
473 This only affects the local pinentry\&. 
478 \fB\fIPWMD_OPTION_PINENTRY_TRIES \fP\fP
479 An integer value that specifies the number of times to prompt for a passphrase before returning an error\&.
481 \fBNote:\fP
482 .RS 4
483 This only affects the local pinentry\&. 
488 \fB\fIPWMD_OPTION_STATUS_CB \fP\fP
489 A function of type \fBpwmd_status_cb_t\fP that will process status messages received from the pwmd server\&. 
491 \fB\fIPWMD_OPTION_STATUS_DATA \fP\fP
492 A user data pointer which is passed to the status message function \fBPWMD_OPTION_STATUS_CB\fP\&. 
494 \fB\fIPWMD_OPTION_KNOWNHOST_CB \fP\fP
495 A function of type \fBpwmd_knownhost_cb_t\fP that will be used to confirm a host key that was not found in the known hosts file\&.
497 \fBSee Also:\fP
498 .RS 4
499 \fBRemote Connection Details\fP 
504 \fB\fIPWMD_OPTION_KNOWNHOST_DATA \fP\fP
505 User supplied data which is passed to the known host function \fBPWMD_OPTION_KNOWNHOST_CB\fP\&.
507 \fBSee Also:\fP
508 .RS 4
509 \fBRemote Connection Details\fP 
514 \fB\fIPWMD_OPTION_INQUIRE_TOTAL \fP\fP
515 When the total number of bytes to be sent via an INQUIRE is known, this should be set so XFER status messages can be parsed correctly\&. When not known or unset, 0 is used as the total argument to the XFER status message\&. This option should be reset in every function that uses an \fBpwmd_inquire_cb_t\fP\&.
517 \fBNote:\fP
518 .RS 4
519 During the INQUIRE, \fBPWMD_OPTION_STATUS_CB\fP is called, when set, after every iteration of the \fBpwmd_inquire_cb_t\fP\&.
521 This is a libpwmd feature\&. pwmd itself does not send XFER status messages during an INQUIRE\&. Status messages can be parsed only when \fBPWMD_OPTION_STATUS_CB\fP is set\&. 
526 \fB\fIPWMD_OPTION_LOCK_ON_OPEN \fP\fP
527 When set to 1, lock the file mutex after opening a file as if the LOCK command had been sent\&. 
529 \fB\fIPWMD_OPTION_SSH_AGENT \fP\fP
530 Use ssh-agent to retrieve the private key to authenticate when connecting to a remote pwmd server\&. 
532 \fB\fIPWMD_OPTION_NO_PINENTRY \fP\fP
533 When 1, disable pinentry use\&. This will prevent both pwmd and libpwmd from using a pinentry program and will prompt from a terminal if available\&.
535 \fBNote:\fP
536 .RS 4
537 This must be set before calling \fBpwmd_open()\fP\&. 
540 \fBSee Also:\fP
541 .RS 4
542 \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP\&. 
547 \fB\fIPWMD_OPTION_LOCAL_PINENTRY \fP\fP
548 When 1, libpwmd will disable pwmd's pinentry and use it's own fork(2)'ed pinentry\&.
550 \fBNote:\fP
551 .RS 4
552 This must be set before calling \fBpwmd_open()\fP\&. 
557 \fB\fIPWMD_OPTION_OVERRIDE_INQUIRE \fP\fP
558 When set, override libpwmd's handling of server inquires with the PASSPHRASE and NEW_PASSPHRASE keywords\&. Handling of these keywords is done automatically when \fBPWMD_OPTION_NO_PINENTRY\fP or \fBPWMD_OPTION_LOCAL_PINENTRY\fP is set or when the connection is a remote one\&.
560 \fBSee Also:\fP
561 .RS 4
562 \fBRemote Connection Details\fP, \fBPWMD_OPTION_LOCAL_PINENTRY\fP, \fBpwmd_password()\fP 
567 \fB\fIPWMD_OPTION_SOCKET_TIMEOUT \fP\fP
568 An int specifying a timeout in seconds before a TCP connection or transfer function will timeout causing a connection or command to fail\&. This option can be specified both before and after a connection has been established\&. When 0, no timeout is used\&. 
570 \fB\fIPWMD_OPTION_TLS_VERIFY \fP\fP
571 An int specifying whether to enable TLS hostname verification on the server certificate chain\&. Default is 0 or disabled\&. 
572 .SS "enum \fBpwmd_pinentry_t\fP"
575 Local pinentry commands and not pwmd pinentry\&. These determine what prompt a local or fork()'ed pinentry uses\&. For use with \fBpwmd_getpin()\fP\&. 
577 \fBEnumerator\fP
578 .in +1c
580 \fB\fIPWMD_PINENTRY_OPEN \fP\fP
581 When opening a file\&. 
583 \fB\fIPWMD_PINENTRY_OPEN_FAILED \fP\fP
584 When opening a file failed due to a bad passphrase\&. 
586 \fB\fIPWMD_PINENTRY_SAVE \fP\fP
587 When saving a file\&. 
589 \fB\fIPWMD_PINENTRY_SAVE_CONFIRM \fP\fP
590 For passphrase confirmation\&. 
592 \fB\fIPWMD_PINENTRY_SAVE_FAILED \fP\fP
593 When saving a file and passphrase confirmation failed\&. 
595 \fB\fIPWMD_PINENTRY_CONFIRM \fP\fP
596 For confirmation of a user-defined prompt\&. 
598 \fB\fIPWMD_PINENTRY_USER \fP\fP
599 For the default or user defined string set with \fBPWMD_OPTION_PINENTRY_DESC\fP\&. 
601 \fB\fIPWMD_PINENTRY_CLOSE \fP\fP
602 To terminate the pinentry process created with \fBpwmd_getpin()\fP\&. 
603 .SS "enum \fBpwmd_socket_t\fP"
606 The type of socket a handle is connected to\&. For use with \fBpwmd_socket_type()\fP\&. 
608 \fBEnumerator\fP
609 .in +1c
611 \fB\fIPWMD_SOCKET_LOCAL \fP\fP
612 A local UNIX domain socket\&. 
614 \fB\fIPWMD_SOCKET_SSH \fP\fP
615 An SSH channel over a TCP socket\&. 
617 \fB\fIPWMD_SOCKET_TLS \fP\fP
618 A TLS connection over a TCP socket\&. 
619 .SH "Function Details"
620 .PP 
621 .SS "void gnutls_global_set_mem_functions (void **)(size_t, void **)(size_t, int(*)(const void *), void **)(void *, size_t, void(*)(void *))"
624 Convenience declaration\&. This allows an application wanting both a TLS connection and libpwmd secure memory management in GnuTLS, not needing to have the GnuTLS development files installed\&. This function should be called before \fBpwmd_init()\fP\&.
626 It is not done in \fBpwmd_init()\fP itself since the application may have already initialized GnuTLS by some other means\&. 
627 .SS "LIBPWMD_API void* pwmd_calloc (size_tnmemb, size_tsize)"
630 A wrapper around calloc()\&. Like calloc(), but lets libpwmd keep track of the pointer\&.
632 \fBParameters:\fP
633 .RS 4
634 \fInmemb\fP The number of elements to allocate\&. 
636 \fIsize\fP The number of bytes to allocate\&. 
639 \fBReturns:\fP
640 .RS 4
641 A newly allocated pointer or NULL if there wasn't enough memory\&. 
644 \fBSee Also:\fP
645 .RS 4
646 calloc(3), \fBpwmd_free()\fP 
650 .SS "LIBPWMD_API void pwmd_close (\fBpwm_t\fP *pwm)"
653 Close a handle\&. This will close the connection to a pwmd server and free any resources associated with it\&.
655 \fBParameters:\fP
656 .RS 4
657 \fIpwm\fP A handle\&. 
660 \fBReturns:\fP
661 .RS 4
662 Nothing\&. 
665 \fBSee Also:\fP
666 .RS 4
667 \fBpwmd_disconnect()\fP, \fBpwmd_new()\fP 
671 .SS "LIBPWMD_API gpg_error_t pwmd_command (\fBpwm_t\fP *pwm, char **result, size_t *len, \fBpwmd_inquire_cb_t\fPcallback, void *user, const char *cmd, \&.\&.\&.)"
674 Send a command to the pwmd server\&. You should avoid sending the BYE command here because the assuan context will be freed and bad things will happen\&. Use \fBpwmd_close()\fP instead\&.
676 For pwmd commands that use an INQUIRE to retrieve data from a client, the \fIcallback\fP parameter must be non-NULL and will be used to send the data to pwmd\&.
678 \fBParameters:\fP
679 .RS 4
680 \fIpwm\fP A handle\&. 
682 \fIresult\fP The result of the command when successful which must be freed with \fBpwmd_free()\fP\&. 
684 \fIlen\fP The length of \fIresult\fP\&. 
686 \fIcallback\fP A callback function to invoke when pwmd inquires data from the client\&. 
688 \fIuser\fP User data passed to the \fIcallback\fP function\&. 
690 \fIcmd\fP The command to send and any following arguments\&. 
693 \fBReturns:\fP
694 .RS 4
695 0 on success or an error code\&.
698 \fBNote:\fP
699 .RS 4
700 Not all commands return a \fIresult\fP\&. 
704 .SS "LIBPWMD_API gpg_error_t pwmd_command_ap (\fBpwm_t\fP *pwm, char **result, size_t *len, \fBpwmd_inquire_cb_t\fPcallback, void *user, const char *cmd, va_listap)"
707 Send a command to the pwmd server\&. Like \fBpwmd_command()\fP but uses an argument pointer instead\&.
709 \fBParameters:\fP
710 .RS 4
711 \fIpwm\fP A handle\&. 
713 \fIresult\fP The result of the command when successful which must be freed with \fBpwmd_free()\fP\&. 
715 \fIlen\fP The length of \fIresult\fP\&. 
717 \fIcallback\fP A callback function to invoke when pwmd inquires data from the client\&. 
719 \fIuser\fP User data passed to the \fIcallback\fP function\&. 
721 \fIcmd\fP The command to send\&. 
723 \fIap\fP The arguments to \fIcmd\fP\&. 
726 \fBReturns:\fP
727 .RS 4
728 0 on success or an error code\&.
731 \fBNote:\fP
732 .RS 4
733 Not all commands return a \fIresult\fP\&. 
737 .SS "LIBPWMD_API gpg_error_t pwmd_connect (\fBpwm_t\fP *pwm, const char *url, \&.\&.\&.)"
740 Establish a connection to a pwmd server\&. Connects to the pwmd server specified in \fIurl\fP\&. The format of \fIurl\fP is: 
742 \fB\fP
743 .RS 4
744 file:///path/to/socket, or 
747 \fB\fP
748 .RS 4
749 ssh[46]://[username@]hostname[:port], or 
752 \fB\fP
753 .RS 4
754 tls[46]://hostname[:port]
757 If \fIurl\fP is NULL then the default local pwmd socket \fI~/\fP\&.pwmd/socket will be used\&.
759 The remaining arguments are parameters for the \fIurl\fP\&.
761 For SSH connections, the first of the positional parameters should be the identity file to use and is required to be non-NULL unless \fBPWMD_OPTION_SSH_AGENT\fP is set\&. The final parameter is the known hosts file to use or NULL to use a default of \fI~/\fP\&.ssh/knownhosts\&.
763 For TLS connections, the first positional parameter should be the client certificate filename\&. The second parameter should be the client certificate key filename\&. The third parameter should be the Certificate Authority (CA) file that was used to sign the server certificate\&. The fourth parameter should be a TLS cipher priority string or NULL to use the default of 'SECURE256'\&. The final parameter is an SHA-1 hash of the server fingerprint or NULL\&.
765 For local connections, any remaining parameters are ignored\&.
767 \fBParameters:\fP
768 .RS 4
769 \fIpwm\fP A handle\&. 
771 \fIurl\fP The socket to connect to\&. 
773 \fI\&.\&.\&.\fP Remaining parameters for the \fIurl\fP\&. 
776 \fBReturns:\fP
777 .RS 4
778 0 on success or an error code\&. 
781 \fBNote:\fP
782 .RS 4
783 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user\&. 
786 \fBSee Also:\fP
787 .RS 4
788 \fBPWMD_OPTION_SSH_AGENT\fP, \fBPWMD_OPTION_SOCKET_TIMEOUT\fP, \fBpwmd_socket_type()\fP, \fBpwmd_disconnect()\fP, \fBRemote Connection Details\fP 
792 .SS "LIBPWMD_API void pwmd_deinit (void)"
795 Deinitialize the library\&. This function is mainly for cleaning up other libraries that libpwmd links with to prevent memory and other leaks showing up in a debugger\&. It should be the final libpwmd function call before your app exits\&. 
796 .SS "LIBPWMD_API gpg_error_t pwmd_disconnect (\fBpwm_t\fP *pwm)"
799 Close a connection to the pwmd server\&. This will close the connection but keep any previously set options for the specified handle\&. Calling \fBpwmd_connect()\fP will re-acquire an libassuan context\&.
801 \fBParameters:\fP
802 .RS 4
803 \fIpwm\fP A handle\&. 
806 \fBReturns:\fP
807 .RS 4
808 0 on success or an error code\&. 
811 \fBSee Also:\fP
812 .RS 4
813 \fBpwmd_close()\fP 
817 .SS "LIBPWMD_API gpg_error_t pwmd_fd (\fBpwm_t\fP *pwm, int *fd)"
820 Get the file descriptor associated with a handle\&. May be useful to determine whether a handle is ready for reading or writing by using select(2) or poll(2)\&.
822 \fBParameters:\fP
823 .RS 4
824 \fIpwm\fP A handle\&. 
826 \fIfd\fP Set to the file descriptor associated with \fIpwm\fP\&. 
829 \fBReturns:\fP
830 .RS 4
831 0 on success or an error code\&. 
835 .SS "LIBPWMD_API unsigned int pwmd_features ()"
838 libpwmd compile time features\&. Useful for clients to determine what features are compiled into libpwmd at runtime\&.
840 \fBReturns:\fP
841 .RS 4
842 A bitmask of features\&. 
846 .SS "LIBPWMD_API void pwmd_free (void *ptr)"
849 Free a previously allocated pointer\&. Use this function to free resources allocated by the other libpwmd memory functions\&. Do not use it to free allocations made by other allocators\&.
851 The difference between the standard free() and this function is that this one will zero out the contents of the pointer before freeing it\&.
853 \fBParameters:\fP
854 .RS 4
855 \fIptr\fP The pointer to deallocate\&. 
858 \fBReturns:\fP
859 .RS 4
860 Nothing\&. 
863 \fBSee Also:\fP
864 .RS 4
865 \fBpwmd_malloc()\fP, \fBpwmd_calloc()\fP, \fBpwmd_realloc()\fP, \fBpwmd_strdup()\fP, \fBpwmd_command()\fP 
869 .SS "LIBPWMD_API void* pwmd_get_pointer (\fBpwm_t\fP *pwm)"
872 Get user data for a handle\&. Return the user data pointer previously set with \fBpwmd_set_pointer()\fP\&.
874 \fBParameters:\fP
875 .RS 4
876 \fIpwm\fP A handle\&. 
879 \fBReturns:\fP
880 .RS 4
881 A pointer to the user data\&. 
885 .SS "LIBPWMD_API gpg_error_t pwmd_getopt (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fPopt, \&.\&.\&.)"
888 Get the value for a handle option\&. Retrieves the default or previously set value for a handle option\&. See \fBpwmd_option_t\fP for option specific details\&.
890 \fBParameters:\fP
891 .RS 4
892 \fIpwm\fP A handle\&. 
894 \fIopt\fP The option\&. 
896 \fI\&.\&.\&.\fP A pointer to the option value type to store the value\&. 
899 \fBReturns:\fP
900 .RS 4
901 0 on success or an error code\&. 
904 \fBNote:\fP
905 .RS 4
906 The value is returned as a pointer and not duplicated\&. 
910 .SS "LIBPWMD_API gpg_error_t pwmd_getpin (\fBpwm_t\fP *pwm, const char *filename, char **result, size_t *len, \fBpwmd_pinentry_t\fPwhich)"
913 Launch a local pinentry\&. Does not send any command to the pwmd server\&. This maybe useful if a passphrase is needed while opening a file over a remote connection and during an \fBpwmd_open()\fP server inquire\&.
915 This function may also be used to display a user confirmation dialog with pinentry when \fIwhich\fP is \fBPWMD_PINENTRY_CONFIRM\fP\&. The text to prompt with is set with \fBPWMD_OPTION_PINENTRY_DESC\fP\&.
917 \fBParameters:\fP
918 .RS 4
919 \fIpwm\fP A handle\&. 
921 \fIfilename\fP The filename to use in the pinentry dialog strings\&. 
923 \fIresult\fP The entered value in the pinentry dialog which should be freed with \fBpwmd_free()\fP\&. 
925 \fIlen\fP The length of \fIresult\fP\&. 
927 \fIwhich\fP Determines the default strings shown in the pinentry dialog\&. \fBpwmd_setopt()\fP may also be used to override the defaults\&. In this case \fBPWMD_PINENTRY_USER\fP should be used\&. \fBPWMD_PINENTRY_CLOSE\fP should be used to terminate the pinentry process when the pinentry is no longer needed\&.
930 \fBReturns:\fP
931 .RS 4
932 0 on success or an error\&.
935 \fBSee Also:\fP
936 .RS 4
937 \fBpwmd_password()\fP 
941 .SS "LIBPWMD_API gpg_error_t pwmd_init (void)"
944 Initialize the library\&. This function must be the first function called in the library before any others\&. It sets up the memory allocators and internationalization among other things\&.
946 \fBReturns:\fP
947 .RS 4
948 0 on success or an error code\&. 
952 .SS "LIBPWMD_API void* pwmd_malloc (size_tsize)"
955 A wrapper around malloc\&. Like malloc(), but lets libpwmd keep track of the pointer\&.
957 \fBParameters:\fP
958 .RS 4
959 \fIsize\fP The number of bytes to allocate\&. 
962 \fBReturns:\fP
963 .RS 4
964 A newly allocated pointer or NULL if there wasn't enough memory\&. 
967 \fBSee Also:\fP
968 .RS 4
969 malloc(3), \fBpwmd_free()\fP 
973 .SS "LIBPWMD_API gpg_error_t pwmd_new (const char *name, \fBpwm_t\fP **pwm)"
976 Creates a new handle\&. Creates a new handle for use with the other functions\&.
978 \fBParameters:\fP
979 .RS 4
980 \fIname\fP If not NULL, the name of the application\&. The application name is sent to the pwmd server after successfully connecting and is used in pwmd logging\&. 
982 \fIpwm\fP A new handle for use with the other functions\&.
985 \fBReturns:\fP
986 .RS 4
987 0 on success or an error code\&. 
991 .SS "LIBPWMD_API gpg_error_t pwmd_open (\fBpwm_t\fP *pwm, const char *filename, \fBpwmd_inquire_cb_t\fPcallback, void *data)"
994 Open a file on the pwmd server\&. This will send the OPEN command to the server\&.
996 The inquire \fIcallback\fP function should be used when \fBPWMD_OPTION_NO_PINENTRY\fP is set and is used to send the passphrase when needed\&.
998 \fBParameters:\fP
999 .RS 4
1000 \fIpwm\fP A handle\&. 
1002 \fIfilename\fP The filename to open\&. The \fIfilename\fP is not a full path but the data filename only\&. 
1004 \fIcallback\fP A callback function to invoke when pwmd inquires data from the client\&. 
1006 \fIdata\fP User data passed to the \fIcallback\fP function\&. 
1009 \fBReturns:\fP
1010 .RS 4
1011 0 on success or an error code\&. 
1014 \fBSee Also:\fP
1015 .RS 4
1016 \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP, \fBPinentry Details\fP, \fBpwmd_password()\fP 
1020 .SS "LIBPWMD_API gpg_error_t pwmd_passwd (\fBpwm_t\fP *pwm, const char *args, \fBpwmd_inquire_cb_t\fPcallback, void *user)"
1023 Change the passphrase for a data file\&. This will send the PASSWD command to the server taking care of pinentry settings\&.
1025 The inquire \fIcallback\fP function should be used when \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP is set\&. This function will disable the pwmd pinentry when \fBPWMD_OPTION_NO_PINENTRY\fP or \fBPWMD_OPTION_LOCAL_PINENTRY\fP is set\&. It will not restore the pwmd pinentry mode that was previously set before calling this function\&.
1027 \fBParameters:\fP
1028 .RS 4
1029 \fIpwm\fP A handle\&. 
1031 \fIargs\fP Any PASSWD protocol command options or NULL\&. 
1033 \fIcallback\fP A callback function to invoke when pwmd inquires data from the client\&. 
1035 \fIuser\fP User data passed to the \fIcallback\fP function\&. 
1038 \fBReturns:\fP
1039 .RS 4
1040 0 on success or an error code\&. 
1043 \fBSee Also:\fP
1044 .RS 4
1045 \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP, \fBPWMD_OPTION_NO_PINENTRY\fP, \fBPWMD_OPTION_LOCAL_PINENTRY\fP, \fBpwmd_command()\fP, \fBPinentry Details\fP 
1049 .SS "LIBPWMD_API gpg_error_t pwmd_password (\fBpwm_t\fP *pwm, const char *keyword, char **data, size_t *size)"
1052 Obtain a passphrase from a local pinentry\&. This is the same function that libpwmd uses during an inquire when using the local pinentry and the inquire keyword is either PASSPHRASE or NEW_PASSPHRASE\&. Provided for convenience since it sets proper pinentry strings and handles new passphrase confirmation\&.
1054 \fBParameters:\fP
1055 .RS 4
1056 \fIpwm\fP A handle\&. 
1058 \fIkeyword\fP The keyword to determine pinentry strings\&. Usually PASSPHRASE or NEW_PASSPHRASE\&. 
1060 \fIdata\fP The obtained passphrase which should be freed with \fBpwmd_free()\fP\&. 
1062 \fIsize\fP The length of \fIdata\fP\&.
1065 \fBReturns:\fP
1066 .RS 4
1067 0 on success or an error\&. 
1071 .SS "LIBPWMD_API gpg_error_t pwmd_process (\fBpwm_t\fP *pwm)"
1074 Check for socket activity\&. This function should be called periodically to check for any pending status messages sent from the server and when \fInot\fP in a command\&.
1076 \fBParameters:\fP
1077 .RS 4
1078 \fIpwm\fP A handle\&. 
1081 \fBReturns:\fP
1082 .RS 4
1083 0 on success or an error code\&.
1086 \fBNote:\fP
1087 .RS 4
1088 This function makes use of \fBpwmd_status_cb_t\fP\&. 
1092 .SS "LIBPWMD_API void* pwmd_realloc (void *ptr, size_tsize)"
1095 A wrapper around realloc()\&. Like realloc(), but lets libpwmd keep track of the pointer\&.
1097 \fBParameters:\fP
1098 .RS 4
1099 \fIptr\fP The pointer to reallocate\&. 
1101 \fIsize\fP The new number of bytes to allocate\&. 
1104 \fBReturns:\fP
1105 .RS 4
1106 A newly allocated pointer or NULL if there wasn't enough memory\&. 
1109 \fBSee Also:\fP
1110 .RS 4
1111 realloc(3), \fBpwmd_free()\fP 
1115 .SS "LIBPWMD_API gpg_error_t pwmd_save (\fBpwm_t\fP *pwm, const char *args, \fBpwmd_inquire_cb_t\fPcallback, void *user)"
1118 Save a file on the pwmd server\&. This will send the SAVE command and write any changes to the document to disk\&.
1120 The inquire \fIcallback\fP function should be used when \fBPWMD_OPTION_NO_PINENTRY\fP is set or when a SAVE option specified in \fIargs\fP inquires more data\&. This function will also disable the pwmd pinentry when \fBPWMD_OPTION_NO_PINENTRY\fP or \fBPWMD_OPTION_LOCAL_PINENTRY\fP is set\&. It will not restore the pwmd pinentry mode that was previously set before calling this function\&.
1122 \fBParameters:\fP
1123 .RS 4
1124 \fIpwm\fP A handle\&. 
1126 \fIargs\fP Any SAVE protocol command options or NULL\&. 
1128 \fIcallback\fP A callback function to invoke when pwmd inquires data from the client\&. 
1130 \fIuser\fP User data passed to the \fIcallback\fP function\&. 
1133 \fBReturns:\fP
1134 .RS 4
1135 0 on success or an error code\&. 
1138 \fBSee Also:\fP
1139 .RS 4
1140 \fBPWMD_OPTION_OVERRIDE_INQUIRE\fP, \fBPWMD_OPTION_NO_PINENTRY\fP, \fBPWMD_OPTION_LOCAL_PINENTRY\fP, \fBpwmd_command()\fP, \fBPinentry Details\fP 
1144 .SS "LIBPWMD_API void pwmd_set_pointer (\fBpwm_t\fP *pwm, void *data)"
1147 Set user data for a handle\&. Use this function to associate user data with a handle that can later be retrieved with \fBpwmd_get_pointer()\fP\&.
1149 \fBParameters:\fP
1150 .RS 4
1151 \fIpwm\fP A handle\&. 
1153 \fIdata\fP A pointer to the user data\&. 
1156 \fBReturns:\fP
1157 .RS 4
1158 Nothing\&. 
1162 .SS "LIBPWMD_API gpg_error_t pwmd_setopt (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fPopt, \&.\&.\&.)"
1165 Set handle options\&. See \fBpwmd_option_t\fP for option specific details\&.
1167 \fBParameters:\fP
1168 .RS 4
1169 \fIpwm\fP A handle\&. 
1171 \fIopt\fP The option\&. 
1173 \fI\&.\&.\&.\fP The option value\&. 
1176 \fBReturns:\fP
1177 .RS 4
1178 0 on success or an error code\&. 
1182 .SS "LIBPWMD_API gpg_error_t pwmd_socket_type (\fBpwm_t\fP *pwm, \fBpwmd_socket_t\fP *type)"
1185 The type of connection a handle has\&. Useful when you want to know what kind of connection a handle has\&.
1187 \fBParameters:\fP
1188 .RS 4
1189 \fIpwm\fP A handle\&. 
1191 \fItype\fP The type of socket\&. 
1194 \fBReturns:\fP
1195 .RS 4
1196 0 on success or an error code\&.
1199 \fBSee Also:\fP
1200 .RS 4
1201 \fBpwmd_socket_t\fP 
1205 .SS "LIBPWMD_API char* pwmd_strdup (const char *str)"
1208 A wrapper around strdup()\&. Like strdup(), but lets libpwmd keep track of the pointer\&.
1210 \fBParameters:\fP
1211 .RS 4
1212 \fIstr\fP The string to duplicate\&. 
1215 \fBReturns:\fP
1216 .RS 4
1217 A newly allocated character pointer or NULL if there wasn't enough memory\&. 
1220 \fBSee Also:\fP
1221 .RS 4
1222 strdup(3), \fBpwmd_free()\fP 
1226 .SS "LIBPWMD_API char* pwmd_strdup_printf (const char *fmt, \&.\&.\&.)"
1229 Duplicate a formatted string\&. Like \fBasprintf(3)\fP, but lets libpwmd keep track of the pointer\&.
1231 \fBParameters:\fP
1232 .RS 4
1233 \fIfmt\fP The formatted string and any following arguments\&. 
1236 \fBReturns:\fP
1237 .RS 4
1238 A newly allocated character pointer or NULL if there wasn't enough memory\&. 
1241 \fBSee Also:\fP
1242 .RS 4
1243 \fBpwmd_free()\fP 
1247 .SS "LIBPWMD_API const char* pwmd_version ()"
1250 Returns this version of libpwmd\&. As a string\&. 
1252 \fBReturns:\fP
1253 .RS 4
1254 A string\&. 
1258 .SH "Author"
1259 .PP 
1260 Generated automatically by Doxygen for libpwmd from the source code\&.