pwmc: #include <fcntl.h>, usage text cleanup.
[libpwmd.git] / doc / libpwmd.3
blob89446d4232f099aabef9bfd0f25133850e1c9869
1 .TH "libpwmd.h" 3 "12 Apr 2009" "Version 6.0.0" "libpwmd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 libpwmd.h \- 
6 .SH "Detailed Description"
7 .PP 
8 libpwmd is a library making it easy for applications to use the pwmd server.
9 .SH "SSH Details"
10 .PP
11 A remote connection to a pwmd server is possible by using an SSH channel which spawns a shell and executes a proxy server that connects 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 file containing SHA1 hashes of known hosts. It's a lot like how the standard OpenSSH does things only the known_hosts file is in a different format.
12 .PP
13 The server hash can be had by using \fBpwmd_get_hostkey()\fP and storing the result in a file. This file is then used as the \fIknown_hosts\fP argument to the SSH connection functions.
14 .PP
15 Here's an example \fBauthorized_keys(5)\fP entry. The hash portion should be the same as the contents of the \fIidentity.pub\fP file which is passed as a parameter to the SSH connection functions:
16 .PP
17 .PP
18 .nf
19  command='socat gopen:$HOME/.pwmd/socket -' <hash> ...
20 .fi
21 .PP
22 .PP
23 \fBNote:\fP
24 .RS 4
25 Only an SSH identity without a passphrase is supported. For now anyway.
26 .RE
27 .PP
28 \fBTodo\fP
29 .RS 4
30 X11 port forwarding so a remote pinentry can use the local display. 
31 .RE
32 .PP
33 .SH "Pinentry Details"
34 .PP
35 \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 use it's pinentry to retrieve a passphrase when needed. How this is done depends what function gets called and whether the pwmd connection is over an SSH channel.
36 .PP
37 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 not sent (when using pwmd's pinentry, not the local one) until the pinentry is needed.
38 .PP
39 If using a local pinentry by calling \fBpwmd_open2()\fP, \fBpwmd_save2()\fP, \fBpwmd_open_async2()\fP or \fBpwmd_save_async2()\fP, libpwmd will send the command 'OPTION PINENTRY=0' to the pwmd server. This is needed so pwmd wont try to launch it's own pinentry on passphrase or confirmation failure. So you may need to reset this option manually depending on your needs.
40 .PP
41 Some pinentry options can also be specified in a local configuration file \fI'~/.pwmd/pinentry.conf'\fP. These options are initial values for each pinentry invokation and may be changed by setting the appropriate \fBpwmd_option_t\fP. Each option and value is separated with a '=' on a single line. Unrecognized options are ignored. Here are the recognized options:
42 .PP
43 \fBParameters:\fP
44 .RS 4
45 \fIPATH\fP The full path to the location of the pinentry binary. 
46 .br
47 \fIDISPLAY\fP The X11 display to use. 
48 .br
49 \fITTYNAME\fP The full path to the tty that pinentry should prompt on. 
50 .br
51 \fITTYTYPE\fP The terminal type of the tty which is required if DISPLAY is not set.
52 .RE
53 .PP
54 \fBNote:\fP
55 .RS 4
56 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user.
57 .PP
58 The initial values for the pinentry TTY, TERM and DISPLAY are set during \fBpwmd_new()\fP depending on the current environment. They may need to be reset as needed.
59 .PP
60 After establishing an SSH connection, the pwmd pinentry is disabled by sending the command 'OPTION PINENTRY=0'. This is needed because there currently isn't a way to have the remote pinentry use the local display. You must be careful to use either a local pinentry or set a passphrase manually with \fBpwmd_setopt()\fP when a passphrase is required or needed.
61 .RE
62 .PP
63 \fBTodo\fP
64 .RS 4
65 X11 port forwarding so a remote pinentry can use the local display.
66 .RE
67 .PP
68 \fBSee also:\fP
69 .RS 4
70 \fBSSH Details\fP
71 .RE
72 .PP
73 .SH "Errors"
74 .PP
75 libpwmd uses libgpg-error for all error codes. Some are user defined GPG_ERR_USER_N codes, but most are reused from the existing ones. Error codes can be described by using \fBpwmd_strerror()\fP, or the thread-safe \fBpwmd_strerror_r()\fP.
76 .PP
77 \fBNote:\fP
78 .RS 4
79 Internally, some error codes are a bitmask of an error source. In order to simplify the result codes, libpwmd strips any error source from the error code before returning it.
80 .RE
81 .PP
82 .SH "Example Client"
83 .PP
84 The following example will list the element tree of the data file specified in the first command line argument.
85 .PP
86 .PP
87 .nf
88  #include <stdio.h>
89  #include <stdlib.h>
90  #include <libpwmd.h>
92  int main(int argc, char **argv)
93  {
94      pwm_t *pwm = pwmd_new(NULL);
95      gpg_error_t rc = pwmd_connect(pwm, NULL);
96      char *result;
97      
98      if (!rc) {
99          rc = pwmd_open(pwm, argv[1]);
101          if (!rc) {
102              rc = pwmd_command(pwm, &result, '%s', 'LIST');
104              if (!rc) {
105                  printf('%s', result);
106                  pwmd_free(result);
107              }
108          }
109      }
111      pwmd_close(pwm);
112      
113      if (rc)
114          fprintf(stderr, 'ERR: %s\n', pwmd_strerror(rc));
116      exit(rc ? 1 : 0);
121 .SH SYNOPSIS
124 .SS "Data Structures"
126 .in +1c
127 .ti -1c
128 .RI "struct \fBpwmd_fd_t\fP"
130 .in -1c
131 .SS "Defines"
133 .in +1c
134 .ti -1c
135 .RI "#define \fBLIBPWMD_VERSION\fP"
137 .ti -1c
138 .RI "#define \fBPWMD_FD_READABLE\fP"
140 .ti -1c
141 .RI "#define \fBPWMD_FD_WRITABLE\fP"
143 .ti -1c
144 .RI "#define \fBEPWMD_ERROR\fP"
146 .ti -1c
147 .RI "#define \fBEPWMD_MAX_SLOTS\fP"
149 .ti -1c
150 .RI "#define \fBEPWMD_LOOP\fP"
152 .ti -1c
153 .RI "#define \fBEPWMD_NO_FILE\fP"
155 .ti -1c
156 .RI "#define \fBEPWMD_LIBXML_ERROR\fP"
158 .ti -1c
159 .RI "#define \fBEPWMD_FILE_MODIFIED\fP"
161 .ti -1c
162 .RI "#define \fBEPWMD_MAX\fP"
164 .in -1c
165 .SS "Typedefs"
167 .in +1c
168 .ti -1c
169 .RI "typedef struct pwm_s \fBpwm_t\fP"
171 .ti -1c
172 .RI "typedef gpg_error_t(* \fBpwmd_passphrase_cb_t\fP )(void *user, char **passphrase)"
174 .ti -1c
175 .RI "typedef int(* \fBpwmd_status_cb_t\fP )(void *user, const char *line)"
177 .ti -1c
178 .RI "typedef gpg_error_t(* \fBpwmd_inquire_cb_t\fP )(void *user, const char *cmd, gpg_error_t rc, char **data, size_t *len)"
180 .in -1c
181 .SS "Enumerations"
183 .in +1c
184 .ti -1c
185 .RI "enum \fBpwmd_async_t\fP { \fBASYNC_INIT\fP, \fBASYNC_PROCESS\fP, \fBASYNC_DONE\fP }"
187 .ti -1c
188 .RI "enum \fBpwmd_ip_version_t\fP { \fBPWMD_IP_ANY\fP, \fBPWMD_IPV4\fP, \fBPWMD_IPV6\fP }"
190 .ti -1c
191 .RI "enum \fBpwmd_socket_t\fP { \fBPWMD_SOCKET_UDS\fP, \fBPWMD_SOCKET_SSH\fP }"
193 .ti -1c
194 .RI "enum \fBpwmd_option_t\fP { \fBPWMD_OPTION_PASSPHRASE_CB\fP, \fBPWMD_OPTION_PASSPHRASE_DATA\fP, \fBPWMD_OPTION_PASSPHRASE\fP, \fBPWMD_OPTION_PINENTRY_TRIES\fP, \fBPWMD_OPTION_PINENTRY_PATH\fP, \fBPWMD_OPTION_PINENTRY_TTY\fP, \fBPWMD_OPTION_PINENTRY_TERM\fP, \fBPWMD_OPTION_PINENTRY_DISPLAY\fP, \fBPWMD_OPTION_PINENTRY_TITLE\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_STATUS_CB\fP, \fBPWMD_OPTION_STATUS_DATA\fP, \fBPWMD_OPTION_IP_VERSION\fP }"
196 .in -1c
197 .SS "Functions"
199 .in +1c
200 .ti -1c
201 .RI "gpg_error_t \fBpwmd_init\fP (void)"
203 .ti -1c
204 .RI "\fBpwm_t\fP * \fBpwmd_new\fP (const char *name)"
206 .ti -1c
207 .RI "gpg_error_t \fBpwmd_connect\fP (\fBpwm_t\fP *pwm, const char *path)"
209 .ti -1c
210 .RI "gpg_error_t \fBpwmd_ssh_connect\fP (\fBpwm_t\fP *pwm, const char *host, int port, const char *identity, const char *user, const char *known_hosts)"
212 .ti -1c
213 .RI "gpg_error_t \fBpwmd_ssh_connect_async\fP (\fBpwm_t\fP *pwm, const char *host, int port, const char *identity, const char *user, const char *known_hosts)"
215 .ti -1c
216 .RI "gpg_error_t \fBpwmd_connect_url\fP (\fBpwm_t\fP *pwm, const char *url)"
218 .ti -1c
219 .RI "gpg_error_t \fBpwmd_connect_url_async\fP (\fBpwm_t\fP *pwm, const char *url)"
221 .ti -1c
222 .RI "gpg_error_t \fBpwmd_get_hostkey\fP (\fBpwm_t\fP *pwm, const char *host, int port, char **result)"
224 .ti -1c
225 .RI "gpg_error_t \fBpwmd_get_hostkey_async\fP (\fBpwm_t\fP *pwm, const char *host, int port)"
227 .ti -1c
228 .RI "gpg_error_t \fBpwmd_get_fds\fP (\fBpwm_t\fP *pwm, pwmd_fd_t *fds, int *n_fds)"
230 .ti -1c
231 .RI "gpg_error_t \fBpwmd_pending_line\fP (\fBpwm_t\fP *pwm)"
233 .ti -1c
234 .RI "gpg_error_t \fBpwmd_setopt\fP (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fP opt,...)"
236 .ti -1c
237 .RI "gpg_error_t \fBpwmd_open\fP (\fBpwm_t\fP *pwm, const char *filename)"
239 .ti -1c
240 .RI "gpg_error_t \fBpwmd_open2\fP (\fBpwm_t\fP *pwm, const char *filename)"
242 .ti -1c
243 .RI "gpg_error_t \fBpwmd_open_async2\fP (\fBpwm_t\fP *pwm, const char *filename)"
245 .ti -1c
246 .RI "gpg_error_t \fBpwmd_open_async\fP (\fBpwm_t\fP *pwm, const char *filename)"
248 .ti -1c
249 .RI "\fBpwmd_async_t\fP \fBpwmd_process\fP (\fBpwm_t\fP *pwm, gpg_error_t *rc, char **result)"
251 .ti -1c
252 .RI "gpg_error_t \fBpwmd_save\fP (\fBpwm_t\fP *pwm)"
254 .ti -1c
255 .RI "gpg_error_t \fBpwmd_save2\fP (\fBpwm_t\fP *pwm)"
257 .ti -1c
258 .RI "gpg_error_t \fBpwmd_save_async2\fP (\fBpwm_t\fP *pwm)"
260 .ti -1c
261 .RI "gpg_error_t \fBpwmd_save_async\fP (\fBpwm_t\fP *pwm)"
263 .ti -1c
264 .RI "gpg_error_t \fBpwmd_command\fP (\fBpwm_t\fP *pwm, char **result, const char *cmd,...)"
266 .ti -1c
267 .RI "gpg_error_t \fBpwmd_command_ap\fP (\fBpwm_t\fP *pwm, char **result, const char *cmd, va_list ap)"
269 .ti -1c
270 .RI "gpg_error_t \fBpwmd_inquire\fP (\fBpwm_t\fP *pwm, const char *cmd, \fBpwmd_inquire_cb_t\fP func, void *user)"
272 .ti -1c
273 .RI "void \fBpwmd_close\fP (\fBpwm_t\fP *pwm)"
275 .ti -1c
276 .RI "gpg_error_t \fBpwmd_socket_type\fP (\fBpwm_t\fP *pwm, \fBpwmd_socket_t\fP *type)"
278 .ti -1c
279 .RI "void \fBpwmd_free\fP (void *ptr)"
281 .ti -1c
282 .RI "void * \fBpwmd_malloc\fP (size_t size)"
284 .ti -1c
285 .RI "void * \fBpwmd_calloc\fP (size_t nmemb, size_t size)"
287 .ti -1c
288 .RI "void * \fBpwmd_realloc\fP (void *ptr, size_t size)"
290 .ti -1c
291 .RI "char * \fBpwmd_strdup\fP (const char *str)"
293 .ti -1c
294 .RI "char * \fBpwmd_strdup_printf\fP (const char *fmt,...)"
296 .ti -1c
297 .RI "const char * \fBpwmd_strerror\fP (gpg_error_t code)"
299 .ti -1c
300 .RI "int \fBpwmd_strerror_r\fP (gpg_error_t code, char *buf, size_t size)"
302 .in -1c
303 .SH "Define Documentation"
304 .PP 
305 .SS "#define EPWMD_ERROR"
307 A general pwmd error with no suitable description. 
308 .SS "#define EPWMD_FILE_MODIFIED"
310 The data file was modified either externally or by another client while trying to process a command. 
311 .SS "#define EPWMD_LIBXML_ERROR"
313 An XML parse or other libxml2 error occurred. 
314 .SS "#define EPWMD_LOOP"
316 A recursion loop was detected while processing a 'target' attribute. 
317 .SS "#define EPWMD_MAX_SLOTS"
319 The maximum number of cache slots has been reached. There is no available slot for a new file. 
320 .SS "#define EPWMD_NO_FILE"
322 A command required an open file but no file has yet been opened. 
323 .SS "#define LIBPWMD_VERSION"
325 The version of this library. 
326 .SS "#define PWMD_FD_READABLE"
328 Set when the file descriptor is readable. 
329 .SS "#define PWMD_FD_WRITABLE"
331 Set when the file descriptor is writable. 
332 .SH "Typedef Documentation"
333 .PP 
334 .SS "\fBpwm_t\fP"
336 When a handle is mentioned in this documentation it is a pointer of this type. A new handle is created with \fBpwmd_new()\fP. 
337 .SS "\fBpwmd_inquire_cb_t\fP"
339 This is a callback function that gets passed to \fBpwmd_inquire()\fP. It is used for sending data to the server for commands that need to reply to an INQUIRE response (STORE and IMPORT). The reason for this callback is to let the client send as many bytes as it wants rather than the entire chunk 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.
341 \fBParameters:\fP
342 .RS 4
343 \fIuser\fP The user data pointer passed to \fBpwmd_inquire()\fP. 
345 \fIcmd\fP The same as the \fIcmd\fP argument to \fBpwmd_inquire()\fP. 
347 \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 because no data has been sent yet. 
349 \fIdata\fP The next chunk of data to send or NULL. 
351 \fIlen\fP The length of \fIdata\fP or 0.
354 \fBReturn values:\fP
355 .RS 4
356 \fI0\fP There is more data to be sent. 
358 \fIGPG_ERR_EOF\fP No need to call this function again, the current \fIline\fP is the last to send. 
360 \fIcode\fP Any other error code which will terminate the INQUIRE.
363 \fBNote:\fP
364 .RS 4
365 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. 
369 .SS "\fBpwmd_passphrase_cb_t\fP"
371 The value of the option \fBPWMD_OPTION_PASSPHRASE_CB\fP which is set with \fBpwmd_setopt()\fP.
373 \fBParameters:\fP
374 .RS 4
375 \fIuser\fP A user data pointer which is set with \fBPWMD_OPTION_PASSPHRASE_DATA\fP. 
377 \fIpassphrase\fP The passphrase which may be an empty string or NULL. It is not modified by libpwmd but must remain allocated for as long as it is needed. 
380 \fBReturns:\fP
381 .RS 4
382 0 on success or an error code which will cause a command to fail. 
386 .SS "\fBpwmd_status_cb_t\fP"
388 The value of the option \fBPWMD_OPTION_STATUS_CB\fP which is set with \fBpwmd_setopt()\fP.
390 \fBParameters:\fP
391 .RS 4
392 \fIuser\fP A user data pointer which is set with \fBPWMD_OPTION_STATUS_DATA\fP. 
394 \fIline\fP The status message line received from the server. 
397 \fBReturns:\fP
398 .RS 4
399 0 on success or an error code which will cause a command to fail. 
403 .SH "Enumeration Type Documentation"
404 .PP 
405 .SS "enum \fBpwmd_async_t\fP"
407 The return code of \fBpwmd_process()\fP which is used for all asynchronous commands. 
409 \fBEnumerator: \fP
410 .in +1c
412 \fB\fIASYNC_INIT \fP\fP
414 \fBFor internal use only.\fP
415 .RS 4
420 \fB\fIASYNC_PROCESS \fP\fP
421 \fBpwmd_process()\fP should be called again. 
423 \fB\fIASYNC_DONE \fP\fP
424 The command has completed. The result code should be checked for an error. 
425 .SS "enum \fBpwmd_ip_version_t\fP"
427 The value of the option \fBPWMD_OPTION_IP_VERSION\fP which is set with \fBpwmd_setopt()\fP. 
429 \fBEnumerator: \fP
430 .in +1c
432 \fB\fIPWMD_IP_ANY \fP\fP
433 Try both IPv6 and IPv4 addresses. Note that IPv6 is tried first. 
435 \fB\fIPWMD_IPV4 \fP\fP
436 Only try IPv4. 
438 \fB\fIPWMD_IPV6 \fP\fP
439 Only try IPv6. 
440 .SS "enum \fBpwmd_option_t\fP"
442 libpwmd options which are set with \fBpwmd_setopt()\fP.
444 \fBNote:\fP
445 .RS 4
446 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
451 \fBEnumerator: \fP
452 .in +1c
454 \fB\fIPWMD_OPTION_PASSPHRASE_CB \fP\fP
455 A custom passphrase retrieval function which, when set, will be used instead of \fBpinentry(1)\fP. This function will not be used when the passphrase is cached on the server or the file is a new one. The value of this option should be a \fBpwmd_passphrase_cb_t\fP.
457 \fBNote:\fP
458 .RS 4
459 An empty string as the passphrase is allowed. 
464 \fB\fIPWMD_OPTION_PASSPHRASE_DATA \fP\fP
465 User supplied data which is passed to the custom passphrase function. 
467 \fB\fIPWMD_OPTION_PASSPHRASE \fP\fP
468 A string to use as the passphrase when doing an open or save. When not NULL, this option has precedence over \fBPWMD_OPTION_PASSPHRASE_CB\fP.
470 \fBNote:\fP
471 .RS 4
472 An empty string as the passphrase is allowed. 
477 \fB\fIPWMD_OPTION_PINENTRY_TRIES \fP\fP
478 An integer value that specifies the number of tries before \fBpinentry(1)\fP will give up when opening a file with the wrong supplied passphrase. The default is 3.
480 \fBNote:\fP
481 .RS 4
482 This option has no effect when trying to save a file. The user must either cancel the pinentry causing the save to fail or enter the correct passphrase during passphrase confirmation. 
487 \fB\fIPWMD_OPTION_PINENTRY_PATH \fP\fP
488 A character string value which specifies the full path of the \fBpinentry(1)\fP binary. For the local \fBpinentry(1)\fP method, the default is specified at compile time.
490 \fBSee also:\fP
491 .RS 4
492 \fBPinentry Details\fP 
497 \fB\fIPWMD_OPTION_PINENTRY_TTY \fP\fP
498 A 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.
500 \fBSee also:\fP
501 .RS 4
502 \fBPinentry Details\fP 
507 \fB\fIPWMD_OPTION_PINENTRY_TERM \fP\fP
508 A value which specifies the terminal type (e.g., vt100) that \fBpinentry(1)\fP will use when no X11 display is available.
510 \fBSee also:\fP
511 .RS 4
512 \fBPinentry Details\fP 
517 \fB\fIPWMD_OPTION_PINENTRY_DISPLAY \fP\fP
518 A value which specifies the X11 display that \fBpinentry(1)\fP will use.
520 \fBSee also:\fP
521 .RS 4
522 \fBPinentry Details\fP 
527 \fB\fIPWMD_OPTION_PINENTRY_TITLE \fP\fP
528 A character string that \fBpinentry(1)\fP will use in it's dialog window. 
530 \fB\fIPWMD_OPTION_PINENTRY_PROMPT \fP\fP
531 A character string that \fBpinentry(1)\fP will use in it's dialog window.  
533 \fB\fIPWMD_OPTION_PINENTRY_DESC \fP\fP
534 A character string that \fBpinentry(1)\fP will use in it's dialog window.  
536 \fB\fIPWMD_OPTION_PINENTRY_LC_CTYPE \fP\fP
537 For \fBpinentry(1)\fP localization. 
539 \fB\fIPWMD_OPTION_PINENTRY_LC_MESSAGES \fP\fP
540 For \fBpinentry(1)\fP localization.  
542 \fB\fIPWMD_OPTION_PINENTRY_TIMEOUT \fP\fP
543 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. 
545 \fB\fIPWMD_OPTION_STATUS_CB \fP\fP
546 A function of type \fBpwmd_status_cb_t\fP that will process status messages received from the pwmd server. 
548 \fB\fIPWMD_OPTION_STATUS_DATA \fP\fP
549 A user data pointer which is passed to the status message function. 
551 \fB\fIPWMD_OPTION_IP_VERSION \fP\fP
552 The IP version of type \fBpwmd_ip_version_t\fP that \fBpwmd_ssh_connect()\fP and \fBpwmd_ssh_connect_async()\fP will use when connecting to the remote pwmd server.
554 \fBNote:\fP
555 .RS 4
556 This option must be set before a connection is made when not the default. 
560 .SS "enum \fBpwmd_socket_t\fP"
562 For use with \fBpwmd_socket_type()\fP. 
564 \fBEnumerator: \fP
565 .in +1c
567 \fB\fIPWMD_SOCKET_UDS \fP\fP
568 A UNIX domain socket. 
570 \fB\fIPWMD_SOCKET_SSH \fP\fP
571 An SSH connection over a TCP socket. 
572 .SH "Function Documentation"
573 .PP 
574 .SS "void* pwmd_calloc (size_t nmemb, size_t size)"
576 A wrapper around calloc(). 
578 Like calloc(), but lets libpwmd keep track of the pointer.
580 \fBParameters:\fP
581 .RS 4
582 \fInmemb\fP The number of elements to allocate. 
584 \fIsize\fP The number of bytes to allocate. 
587 \fBReturns:\fP
588 .RS 4
589 A newly allocated pointer or NULL if there wasn't enough memory. 
592 \fBSee also:\fP
593 .RS 4
594 calloc(3), \fBpwmd_free()\fP 
598 .SS "void pwmd_close (\fBpwm_t\fP * pwm)"
600 Close a handle. 
602 This will close the connection to a pwmd server and free any resources associated with it.
604 \fBParameters:\fP
605 .RS 4
606 \fIpwm\fP A handle. 
609 \fBReturns:\fP
610 .RS 4
611 Nothing. 
615 .SS "gpg_error_t pwmd_command (\fBpwm_t\fP * pwm, char ** result, const char * cmd,  ...)"
617 Send a command to the pwmd server. 
619 Sends 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. For commands that use an INQUIRE to send data to the server (STORE and IMPORT), \fBpwmd_inquire()\fP should be used and not this function.
621 \fBParameters:\fP
622 .RS 4
623 \fIpwm\fP A handle. 
625 \fIresult\fP The result of the command when successful which must be freed with \fBpwmd_free()\fP. Note that not all commands return a result. 
627 \fIcmd\fP The command to send. 
629 \fI...\fP The arguments to \fIcmd\fP. 
632 \fBReturns:\fP
633 .RS 4
634 0 on success or an error code. 
638 .SS "gpg_error_t pwmd_command_ap (\fBpwm_t\fP * pwm, char ** result, const char * cmd, va_list ap)"
640 Send a command to the pwmd server. 
642 Like \fBpwmd_command()\fP but uses an argument pointer instead.
644 \fBParameters:\fP
645 .RS 4
646 \fIpwm\fP A handle. 
648 \fIresult\fP The result of the command when successful which must be freed with \fBpwmd_free()\fP. Note that not all commands return a result. 
650 \fIcmd\fP The command to send. 
652 \fIap\fP The arguments to \fIcmd\fP. 
655 \fBReturns:\fP
656 .RS 4
657 0 on success or an error code. 
661 .SS "gpg_error_t pwmd_connect (\fBpwm_t\fP * pwm, const char * path)"
663 Connect to a local pwmd server. 
665 Connects to a local unix domain socket.
667 \fBParameters:\fP
668 .RS 4
669 \fIpwm\fP A handle. 
671 \fIpath\fP The socket path to connect to. If NULL, then a default of \fI'~/.pwmd/socket'\fP will be used. 
674 \fBReturns:\fP
675 .RS 4
676 0 on success or an error code. 
679 \fBNote:\fP
680 .RS 4
681 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
684 \fBSee also:\fP
685 .RS 4
686 \fBpwmd_ssh_connect()\fP, \fBpwmd_ssh_connect_async()\fP 
690 .SS "gpg_error_t pwmd_connect_url (\fBpwm_t\fP * pwm, const char * url)"
692 Establish a connection by parsing a URL. 
694 This allows for connecting to a pwmd server by parsing the given URL string. Whether the connection is to a remote or local server depends on the contents: 
697  socket://[path/to/local/socket]
699  or
701  ssh[46]://[username@]hostname[:port],identity,known_hosts
706 The parameters in square brackets are optional and if not specified then defaults will be used. If neither socket specification is matched, the \fIurl\fP is assumed to be a socket://.
708 \fBParameters:\fP
709 .RS 4
710 \fIpwm\fP A handle. 
712 \fIurl\fP The string to parse. 
715 \fBNote:\fP
716 .RS 4
717 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
720 \fBReturns:\fP
721 .RS 4
722 0 on success or an error code. 
725 \fBSee also:\fP
726 .RS 4
727 \fBpwmd_socket_type()\fP 
731 .SS "gpg_error_t pwmd_connect_url_async (\fBpwm_t\fP * pwm, const char * url)"
733 Establish a connection asynchronously by parsing a URL. 
735 This allows for connecting to a pwmd server by parsing the given URL string. Whether the connection is to a remote or local server depends on the contents: 
738  socket://[path/to/local/socket]
740  or
742  ssh[46]://[username@]hostname[:port],identity,known_hosts
747 The parameters in square brackets are optional and if not specified then defaults will be used. If neither socket specification is matched, the \fIurl\fP is assumed to be a socket://.
749 \fBpwmd_process()\fP should be called until the command completes.
751 \fBParameters:\fP
752 .RS 4
753 \fIpwm\fP A handle. 
755 \fIurl\fP The string to parse. 
758 \fBNote:\fP
759 .RS 4
760 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
763 \fBReturns:\fP
764 .RS 4
765 0 on success or an error code. 
768 \fBSee also:\fP
769 .RS 4
770 \fBpwmd_socket_type()\fP 
774 .SS "void pwmd_free (void * ptr)"
776 Free a previously allocated pointer. 
778 Use this function to free resources allocated by the other libpwmd memory functions. Do not use it to free allocations not made by the other libpwmd memory allocators.
780 The difference between the standard free() and this function is that this one will zero out the contents of the pointer before freeing it.
782 \fBParameters:\fP
783 .RS 4
784 \fIptr\fP The pointer to deallocate. 
787 \fBReturns:\fP
788 .RS 4
789 Nothing. 
792 \fBSee also:\fP
793 .RS 4
794 \fBpwmd_malloc()\fP, \fBpwmd_calloc()\fP, \fBpwmd_realloc()\fP, \fBpwmd_strdup()\fP, \fBpwmd_process()\fP, \fBpwmd_command()\fP 
798 .SS "gpg_error_t pwmd_get_fds (\fBpwm_t\fP * pwm, pwmd_fd_t * fds, int * n_fds)"
800 Get the associated file descriptor(s) for a handle. 
802 This function lets the application poll the available file descriptors for the specified handle. It should be called after each asynchronous function call and after each call to \fBpwmd_process()\fP since the polled file descriptors may have been closed since the previous call.
804 After returning, \fIn_fds\fP is set to the number of available file descriptors which are stored in \fIfds\fP. The .flags member of \fBpwmd_fd_t\fP specifies what can be monitored and is a bitmask of \fBPWMD_FD_READABLE\fP and \fBPWMD_FD_WRITABLE\fP. When ready, \fBpwmd_process()\fP should be called.
806 \fBParameters:\fP
807 .RS 4
808 \fIpwm\fP A handle. 
810 \fIfds\fP Set to the file descriptor(s) of the associated handle. 
812 \fIn_fds\fP Initially the size of \fIfds\fP then updated to the number of available file descriptors which are stored in \fIfds\fP. 
815 \fBReturn values:\fP
816 .RS 4
817 \fI0\fP on success or an error code. 
819 \fIGPG_ERR_ERANGE\fP There are more file descriptors than the amount specified in \fIn_fds\fP. \fIfds\fP and \fIn_fds\fP are still usable though. 
822 \fBSee also:\fP
823 .RS 4
824 \fBpwmd_process()\fP 
828 .SS "gpg_error_t pwmd_get_hostkey (\fBpwm_t\fP * pwm, const char * host, int port, char ** result)"
830 Retrieve a remote SSH host key. 
832 This key is needed for host verification of the remote pwmd server. You should be sure that the remote host is really the host that your wanting to connect to and not subject to a man-in-the-middle attack.
834 \fBParameters:\fP
835 .RS 4
836 \fIpwm\fP A handle. 
838 \fIhost\fP The hostname to connect to. 
840 \fIport\fP The port or a default if set to -1. 
842 \fIresult\fP The SHA1 sum of the server host key which must be freed with \fBpwmd_free()\fP. 
845 \fBReturns:\fP
846 .RS 4
847 0 on success or an error code. 
850 \fBSee also:\fP
851 .RS 4
852 \fBpwmd_get_hostkey_async()\fP, \fBSSH Details\fP 
856 .SS "gpg_error_t pwmd_get_hostkey_async (\fBpwm_t\fP * pwm, const char * host, int port)"
858 Retrieve a remote SSH host key asynchronously. 
860 This key is needed for host verification of the remote pwmd server. You should be sure that the remote host is really the host that your wanting to connect to and not subject to a man-in-the-middle attack.
862 \fBpwmd_process()\fP should be called until the command completes.
864 \fBParameters:\fP
865 .RS 4
866 \fIpwm\fP A handle. 
868 \fIhost\fP The hostname to connect to. 
870 \fIport\fP The port or a default if set to -1. 
873 \fBReturns:\fP
874 .RS 4
875 0 on success or an error code. 
878 \fBSee also:\fP
879 .RS 4
880 \fBpwmd_get_hostkey()\fP, \fBpwmd_process()\fP, \fBSSH Details\fP 
884 .SS "gpg_error_t pwmd_init (void)"
886 Initialize the library. 
888 This function must be the first function called in the library before any others. It sets up internationalization among other things.
890 \fBReturns:\fP
891 .RS 4
892 0 Success. 
896 .SS "gpg_error_t pwmd_inquire (\fBpwm_t\fP * pwm, const char * cmd, \fBpwmd_inquire_cb_t\fP func, void * user)"
898 Send data to a pwmd server. 
900 This lets commands that use an INQUIRE (STORE and IMPORT) send the data to the server. Use this function rather than \fBpwmd_command()\fP for these pwmd commands.
902 \fBParameters:\fP
903 .RS 4
904 \fIpwm\fP A handle. 
906 \fIcmd\fP The command (without arguments) to send that uses an INQUIRE. 
908 \fIfunc\fP A callback function which sets the data to be sent. 
910 \fIuser\fP A user data pointer passed to the callback function \fIfunc\fP. 
913 \fBReturns:\fP
914 .RS 4
915 0 on success or an error code.
918 \fBSee also:\fP
919 .RS 4
920 \fBpwmd_inquire_cb_t\fP 
924 .SS "void* pwmd_malloc (size_t size)"
926 A wrapper around malloc. 
928 Like malloc(), but lets libpwmd keep track of the pointer.
930 \fBParameters:\fP
931 .RS 4
932 \fIsize\fP The number of bytes to allocate. 
935 \fBReturns:\fP
936 .RS 4
937 A newly allocated pointer or NULL if there wasn't enough memory. 
940 \fBSee also:\fP
941 .RS 4
942 malloc(3), \fBpwmd_free()\fP 
946 .SS "\fBpwm_t\fP* pwmd_new (const char * name)"
948 Creates a new handle. 
950 Creates a new handle for use with the other functions.
952 \fBParameters:\fP
953 .RS 4
954 \fIname\fP If not NULL, the name of the application. The application name is sent to the pwmd server after successfully connecting.
956 \fIname\fP The application name or NULL. 
959 \fBReturns:\fP
960 .RS 4
961 a new handle or NULL if there was not enough memory. 
965 .SS "gpg_error_t pwmd_open (\fBpwm_t\fP * pwm, const char * filename)"
967 Open a file on the pwmd server. 
969 This will send the OPEN command to the server.
971 \fBParameters:\fP
972 .RS 4
973 \fIpwm\fP A handle. 
975 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
978 \fBReturns:\fP
979 .RS 4
980 0 on success or an error code. 
983 \fBSee also:\fP
984 .RS 4
985 \fBPinentry Details\fP 
989 .SS "gpg_error_t pwmd_open2 (\fBpwm_t\fP * pwm, const char * filename)"
991 Open a file on the pwmd server using a local pinentry. 
993 This will send the OPEN command to the server like \fBpwmd_open()\fP but will use the local pinentry and not pwmd's pinentry.
995 \fBNote:\fP
996 .RS 4
997 This function will catch SIGALRM during the lifetime of the pinentry process and set it to SIG_DFL when finished. This is needed for pinentry timeouts.
999 This pinentry method is not thread safe. It needs to set a couple of global variables for the pinentry timeout to work properly.
1002 \fBParameters:\fP
1003 .RS 4
1004 \fIpwm\fP A handle. 
1006 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
1009 \fBReturns:\fP
1010 .RS 4
1011 0 on success or an error code. 
1014 \fBReturn values:\fP
1015 .RS 4
1016 \fIGPG_ERR_PIN_BLOCKED\fP Another handle is using the local pinentry. 
1019 \fBSee also:\fP
1020 .RS 4
1021 \fBPinentry Details\fP 
1025 .SS "gpg_error_t pwmd_open_async (\fBpwm_t\fP * pwm, const char * filename)"
1027 Open a file on the pwmd server asynchronously. 
1029 This will send the OPEN command to the pwmd server. The difference from \fBpwmd_open()\fP is that it will not block if a pinentry is needed for passphrase input.
1031 \fBpwmd_process()\fP should be called until the command completes.
1033 \fBParameters:\fP
1034 .RS 4
1035 \fIpwm\fP A handle. 
1037 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
1040 \fBReturns:\fP
1041 .RS 4
1042 0 on success or an error code. 
1045 \fBSee also:\fP
1046 .RS 4
1047 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1051 .SS "gpg_error_t pwmd_open_async2 (\fBpwm_t\fP * pwm, const char * filename)"
1053 Open a file on the pwmd server asynchronously (fork method). 
1055 This will send the OPEN command to the pwmd server. The difference from \fBpwmd_open()\fP is that it will not block if a pinentry is needed for passphrase input.
1057 The difference from \fBpwmd_open_async()\fP is that libpwmd will \fBfork()\fP a pinentry process rather than have pwmd use it's pinentry method. This may be useful if the passphrase isn't cached on a remote pwmd server and a remote \fBpinentry(1)\fP is not possible.
1059 \fBpwmd_process()\fP should be called until the command completes.
1061 \fBNote:\fP
1062 .RS 4
1063 This function will catch SIGALRM during the lifetime of the pinentry process and set it to SIG_DFL when finished. This is needed for pinentry timeouts.
1066 \fBParameters:\fP
1067 .RS 4
1068 \fIpwm\fP A handle. 
1070 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
1073 \fBReturns:\fP
1074 .RS 4
1075 0 on success or an error code. 
1078 \fBSee also:\fP
1079 .RS 4
1080 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1084 .SS "gpg_error_t pwmd_pending_line (\fBpwm_t\fP * pwm)"
1086 Check for a unparsed buffered line. 
1088 A buffered line is a line that was read from the server but has not yet been processed. This function determines if there is such a line.
1090 \fBParameters:\fP
1091 .RS 4
1092 \fIpwm\fP A handle. 
1095 \fBReturn values:\fP
1096 .RS 4
1097 \fI0\fP if there is a pending line. 
1099 \fIGPG_ERR_NO_DATA\fP if there is no pending line. 
1102 \fBSee also:\fP
1103 .RS 4
1104 \fBpwmd_process()\fP 
1108 .SS "\fBpwmd_async_t\fP pwmd_process (\fBpwm_t\fP * pwm, gpg_error_t * rc, char ** result)"
1110 Process an asynchronous function. 
1112 After an asynchronous function has been called and has returned successfully, this function must be called to process the command and retrieve the result or return value.
1114 This function may also be called when not in a command to check for pending status messages sent from the server or to process a pending line.
1116 \fBParameters:\fP
1117 .RS 4
1118 \fIpwm\fP A handle. 
1120 \fIrc\fP Set to the return code of the original command after ASYNC_DONE has been returned. This value must be checked to determine if the command succeeded. 
1122 \fIresult\fP Set to the result of the command when \fIrc\fP is 0. Note that not all commands return a result. 
1125 \fBReturn values:\fP
1126 .RS 4
1127 \fIASYNC_DONE\fP The command has completed. \fIrc\fP should be checked to determine if the command was successful or not. 
1129 \fIASYNC_PROCESS\fP The command is still running and this function should be called again. 
1132 \fBSee also:\fP
1133 .RS 4
1134 \fBpwmd_get_fds()\fP, \fBpwmd_pending_line()\fP 
1138 .SS "void* pwmd_realloc (void * ptr, size_t size)"
1140 A wrapper around realloc(). 
1142 Like realloc(), but lets libpwmd keep track of the pointer. Note that this function will try and allocate the entire \fIsize\fP before freeing the original pointer and returning the new one.
1144 \fBParameters:\fP
1145 .RS 4
1146 \fIptr\fP The pointer to reallocate. 
1148 \fIsize\fP The new number of bytes to allocate. 
1151 \fBReturns:\fP
1152 .RS 4
1153 A newly allocated pointer or NULL if there wasn't enough memory. 
1156 \fBSee also:\fP
1157 .RS 4
1158 realloc(3), \fBpwmd_free()\fP 
1162 .SS "gpg_error_t pwmd_save (\fBpwm_t\fP * pwm)"
1164 Save a file on the pwmd server. 
1166 This will send the SAVE command.
1168 \fBParameters:\fP
1169 .RS 4
1170 \fIpwm\fP A handle. 
1173 \fBReturns:\fP
1174 .RS 4
1175 0 on success or an error code. 
1178 \fBSee also:\fP
1179 .RS 4
1180 \fBPinentry Details\fP 
1184 .SS "gpg_error_t pwmd_save2 (\fBpwm_t\fP * pwm)"
1186 Save a file on the pwmd server using the local pinentry. 
1188 This will send the SAVE command like \fBpwmd_save()\fP but will use a local pinentry and not pwmd's pinentry.
1190 \fBParameters:\fP
1191 .RS 4
1192 \fIpwm\fP A handle. 
1195 \fBReturns:\fP
1196 .RS 4
1197 0 on success or an error code. 
1200 \fBSee also:\fP
1201 .RS 4
1202 \fBPinentry Details\fP 
1206 .SS "gpg_error_t pwmd_save_async (\fBpwm_t\fP * pwm)"
1208 Save changes to a file on the pwmd server asynchronously. 
1210 This will send the SAVE command to the pwmd server. The difference from \fBpwmd_save()\fP is that it will not block if a pinentry is needed for passphrase input.
1212 \fBpwmd_process()\fP should be called until the command completes.
1214 \fBParameters:\fP
1215 .RS 4
1216 \fIpwm\fP A handle. 
1219 \fBReturns:\fP
1220 .RS 4
1221 0 on success or an error code. 
1224 \fBSee also:\fP
1225 .RS 4
1226 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1230 .SS "gpg_error_t pwmd_save_async2 (\fBpwm_t\fP * pwm)"
1232 Save a file on the pwmd server asynchronously (fork method). 
1234 This will send the SAVE command to the pwmd server. The difference from \fBpwmd_save()\fP is that it will not block if a pinentry is needed for passphrase input.
1236 The difference from \fBpwmd_save_async()\fP is that libpwmd will \fBfork()\fP a pinentry process rather than have pwmd use it's pinentry method. This may be useful if the passphrase isn't cached on a remote pwmd server and a remote \fBpinentry(1)\fP is not possible.
1238 \fBpwmd_process()\fP should be called until the command completes.
1240 \fBParameters:\fP
1241 .RS 4
1242 \fIpwm\fP A handle. 
1245 \fBReturns:\fP
1246 .RS 4
1247 0 on success or an error code. 
1250 \fBSee also:\fP
1251 .RS 4
1252 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1256 .SS "gpg_error_t pwmd_setopt (\fBpwm_t\fP * pwm, \fBpwmd_option_t\fP opt,  ...)"
1258 Set handle options. 
1260 See \fBpwmd_option_t\fP for option specific details.
1262 \fBParameters:\fP
1263 .RS 4
1264 \fIpwm\fP A handle. 
1266 \fIopt\fP The option. 
1268 \fI...\fP The option value. 
1271 \fBReturns:\fP
1272 .RS 4
1273 0 on success or an error code. 
1277 .SS "gpg_error_t pwmd_socket_type (\fBpwm_t\fP * pwm, \fBpwmd_socket_t\fP * type)"
1279 The type of connection a handle has. 
1281 Useful when you want to know what kind of connection a handle has.
1283 \fBParameters:\fP
1284 .RS 4
1285 \fIpwm\fP A handle. 
1287 \fItype\fP The type of socket. 
1290 \fBReturns:\fP
1291 .RS 4
1292 0 on success or an error code. 
1295 \fBSee also:\fP
1296 .RS 4
1297 \fBpwmd_connect_url()\fP 
1301 .SS "gpg_error_t pwmd_ssh_connect (\fBpwm_t\fP * pwm, const char * host, int port, const char * identity, const char * user, const char * known_hosts)"
1303 Establish a remote connection to a pwmd server. 
1305 Connects to a pwmd server over an SSH channel.
1307 \fBParameters:\fP
1308 .RS 4
1309 \fIpwm\fP A handle. 
1311 \fIhost\fP The hostname to connect to. 
1313 \fIport\fP The port or -1 for the default. 
1315 \fIidentity\fP The SSH identity file to use for authentication. This should specify the private key. The public key is assumed to be \fIidentity.pub\fP. 
1317 \fIuser\fP The username on the SSH server to login as. If NULL then invoking username will be used. 
1319 \fIknown_hosts\fP A file containing the public SSH server key hash in SHA1 format which may be obtained with \fBpwmd_get_hostkey()\fP. 
1322 \fBReturns:\fP
1323 .RS 4
1324 0 on success or an error code. 
1327 \fBNote:\fP
1328 .RS 4
1329 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
1332 \fBSee also:\fP
1333 .RS 4
1334 \fBpwmd_ssh_connect_async()\fP, \fBPWMD_OPTION_IP_VERSION\fP, \fBSSH Details\fP 
1338 .SS "gpg_error_t pwmd_ssh_connect_async (\fBpwm_t\fP * pwm, const char * host, int port, const char * identity, const char * user, const char * known_hosts)"
1340 Establish a remote connection to a pwmd server asynchronously. 
1342 This is a variant of \fBpwmd_ssh_connect()\fP that will not block while doing DNS lookups or while connecting.
1344 \fBpwmd_process()\fP should be called until the command completes.
1346 \fBParameters:\fP
1347 .RS 4
1348 \fIpwm\fP A handle. 
1350 \fIhost\fP The hostname to connect to. 
1352 \fIport\fP The port or -1 for the default. 
1354 \fIidentity\fP The SSH identity file to use for authentication. This should specify the private key. The public key is assumed to be \fIidentity.pub\fP. 
1356 \fIuser\fP The username on the SSH server to login as. If NULL, the invoking username will be used. 
1358 \fIknown_hosts\fP A file containing the public SSH server key hash in SHA1 format which may be obtained with \fBpwmd_get_hostkey()\fP. 
1361 \fBReturns:\fP
1362 .RS 4
1363 0 on success or an error code. 
1366 \fBNote:\fP
1367 .RS 4
1368 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
1371 \fBSee also:\fP
1372 .RS 4
1373 \fBpwmd_process()\fP, \fBPWMD_OPTION_IP_VERSION\fP, \fBSSH Details\fP 
1377 .SS "char* pwmd_strdup (const char * str)"
1379 A wrapper around strdup(). 
1381 Like strdup(), but lets libpwmd keep track of the pointer.
1383 \fBParameters:\fP
1384 .RS 4
1385 \fIstr\fP The string to duplicate. 
1388 \fBReturns:\fP
1389 .RS 4
1390 A newly allocated character pointer or NULL if there wasn't enough memory. 
1393 \fBSee also:\fP
1394 .RS 4
1395 strdup(3), \fBpwmd_free()\fP 
1399 .SS "char* pwmd_strdup_printf (const char * fmt,  ...)"
1401 Duplicate a formatted string. 
1403 Like sprintf() but returns an allocated string.
1405 \fBParameters:\fP
1406 .RS 4
1407 \fIfmt\fP The formatted string. 
1409 \fI...\fP Any format arguments to the string. 
1412 \fBReturns:\fP
1413 .RS 4
1414 A newly allocated character pointer or NULL if there wasn't enough memory. 
1417 \fBSee also:\fP
1418 .RS 4
1419 \fBpwmd_free()\fP 
1423 .SS "const char* pwmd_strerror (gpg_error_t code)"
1425 Return a description of an error code. 
1427 \fBParameters:\fP
1428 .RS 4
1429 \fIcode\fP The error code to describe. 
1432 \fBReturns:\fP
1433 .RS 4
1434 A character description of the error code. 
1437 \fBSee also:\fP
1438 .RS 4
1439 \fBpwmd_strerror_r()\fP 
1443 .SS "int pwmd_strerror_r (gpg_error_t code, char * buf, size_t size)"
1445 Return a description of an error code (thread-safe). 
1447 This is a thread-safe version of \fBpwmd_strerror()\fP.
1449 \fBParameters:\fP
1450 .RS 4
1451 \fIcode\fP The error code to describe. 
1453 \fIbuf\fP An allocated buffer to hold the error description. 
1455 \fIsize\fP The size of the allocated buffer \fIbuf\fP.
1458 \fBReturn values:\fP
1459 .RS 4
1460 \fI0\fP Success. 
1462 \fIERANGE\fP \fIsize\fP was not large enough to hold the entire description and \fIbuf\fP is set to the truncated error string. 
1466 .SH "Author"
1467 .PP 
1468 Generated automatically by Doxygen for libpwmd from the source code.