Another fix for commit 592815d. Don't close the SSH session when an OPEN
[libpwmd.git] / doc / libpwmd.3
blobe51bb766927a9617a50e08bab981bfb89f04b85c
1 .TH "libpwmd.h" 3 "11 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.
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 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.
59 .RE
60 .PP
61 \fBTodo\fP
62 .RS 4
63 X11 port forwarding so a remote pinentry can use the local display.
64 .RE
65 .PP
66 \fBSee also:\fP
67 .RS 4
68 \fBSSH Details\fP
69 .RE
70 .PP
71 .SH "Errors"
72 .PP
73 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.
74 .PP
75 \fBNote:\fP
76 .RS 4
77 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.
78 .RE
79 .PP
80 .SH "Example Client"
81 .PP
82 The following example will list the element tree of the data file specified in the first command line argument.
83 .PP
84 .PP
85 .nf
86  #include <stdio.h>
87  #include <stdlib.h>
88  #include <libpwmd.h>
90  int main(int argc, char **argv)
91  {
92      pwm_t *pwm = pwmd_new(NULL);
93      gpg_error_t rc = pwmd_connect(pwm, NULL);
94      char *result;
95      
96      if (!rc) {
97          rc = pwmd_open(pwm, argv[1]);
99          if (!rc) {
100              rc = pwmd_command(pwm, &result, '%s', 'LIST');
102              if (!rc) {
103                  printf('%s', result);
104                  pwmd_free(result);
105              }
106          }
107      }
109      pwmd_close(pwm);
110      
111      if (rc)
112          fprintf(stderr, 'ERR: %s\n', pwmd_strerror(rc));
114      exit(rc ? 1 : 0);
119 .SH SYNOPSIS
122 .SS "Data Structures"
124 .in +1c
125 .ti -1c
126 .RI "struct \fBpwmd_fd_t\fP"
128 .in -1c
129 .SS "Defines"
131 .in +1c
132 .ti -1c
133 .RI "#define \fBLIBPWMD_VERSION\fP"
135 .ti -1c
136 .RI "#define \fBPWMD_FD_READABLE\fP"
138 .ti -1c
139 .RI "#define \fBPWMD_FD_WRITABLE\fP"
141 .ti -1c
142 .RI "#define \fBEPWMD_ERROR\fP"
144 .ti -1c
145 .RI "#define \fBEPWMD_MAX_SLOTS\fP"
147 .ti -1c
148 .RI "#define \fBEPWMD_LOOP\fP"
150 .ti -1c
151 .RI "#define \fBEPWMD_NO_FILE\fP"
153 .ti -1c
154 .RI "#define \fBEPWMD_LIBXML_ERROR\fP"
156 .ti -1c
157 .RI "#define \fBEPWMD_FILE_MODIFIED\fP"
159 .ti -1c
160 .RI "#define \fBEPWMD_MAX\fP"
162 .in -1c
163 .SS "Typedefs"
165 .in +1c
166 .ti -1c
167 .RI "typedef struct pwm_s \fBpwm_t\fP"
169 .ti -1c
170 .RI "typedef gpg_error_t(* \fBpwmd_passphrase_cb_t\fP )(void *user, char **passphrase)"
172 .ti -1c
173 .RI "typedef int(* \fBpwmd_status_cb_t\fP )(void *user, const char *line)"
175 .ti -1c
176 .RI "typedef gpg_error_t(* \fBpwmd_inquire_cb_t\fP )(void *user, const char *cmd, gpg_error_t rc, char **data, size_t *len)"
178 .in -1c
179 .SS "Enumerations"
181 .in +1c
182 .ti -1c
183 .RI "enum \fBpwmd_async_t\fP { \fBASYNC_INIT\fP, \fBASYNC_PROCESS\fP, \fBASYNC_DONE\fP }"
185 .ti -1c
186 .RI "enum \fBpwmd_ip_version_t\fP { \fBPWMD_IP_ANY\fP, \fBPWMD_IPV4\fP, \fBPWMD_IPV6\fP }"
188 .ti -1c
189 .RI "enum \fBpwmd_socket_t\fP { \fBPWMD_SOCKET_UDS\fP, \fBPWMD_SOCKET_SSH\fP }"
191 .ti -1c
192 .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 }"
194 .in -1c
195 .SS "Functions"
197 .in +1c
198 .ti -1c
199 .RI "gpg_error_t \fBpwmd_init\fP (void)"
201 .ti -1c
202 .RI "\fBpwm_t\fP * \fBpwmd_new\fP (const char *name)"
204 .ti -1c
205 .RI "gpg_error_t \fBpwmd_connect\fP (\fBpwm_t\fP *pwm, const char *path)"
207 .ti -1c
208 .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)"
210 .ti -1c
211 .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)"
213 .ti -1c
214 .RI "gpg_error_t \fBpwmd_connect_url\fP (\fBpwm_t\fP *pwm, const char *url)"
216 .ti -1c
217 .RI "gpg_error_t \fBpwmd_connect_url_async\fP (\fBpwm_t\fP *pwm, const char *url)"
219 .ti -1c
220 .RI "gpg_error_t \fBpwmd_get_hostkey\fP (\fBpwm_t\fP *pwm, const char *host, int port, char **result)"
222 .ti -1c
223 .RI "gpg_error_t \fBpwmd_get_hostkey_async\fP (\fBpwm_t\fP *pwm, const char *host, int port)"
225 .ti -1c
226 .RI "gpg_error_t \fBpwmd_get_fds\fP (\fBpwm_t\fP *pwm, pwmd_fd_t *fds, int *n_fds)"
228 .ti -1c
229 .RI "gpg_error_t \fBpwmd_pending_line\fP (\fBpwm_t\fP *pwm)"
231 .ti -1c
232 .RI "gpg_error_t \fBpwmd_setopt\fP (\fBpwm_t\fP *pwm, \fBpwmd_option_t\fP opt,...)"
234 .ti -1c
235 .RI "gpg_error_t \fBpwmd_open\fP (\fBpwm_t\fP *pwm, const char *filename)"
237 .ti -1c
238 .RI "gpg_error_t \fBpwmd_open2\fP (\fBpwm_t\fP *pwm, const char *filename)"
240 .ti -1c
241 .RI "gpg_error_t \fBpwmd_open_async2\fP (\fBpwm_t\fP *pwm, const char *filename)"
243 .ti -1c
244 .RI "gpg_error_t \fBpwmd_open_async\fP (\fBpwm_t\fP *pwm, const char *filename)"
246 .ti -1c
247 .RI "\fBpwmd_async_t\fP \fBpwmd_process\fP (\fBpwm_t\fP *pwm, gpg_error_t *rc, char **result)"
249 .ti -1c
250 .RI "gpg_error_t \fBpwmd_save\fP (\fBpwm_t\fP *pwm)"
252 .ti -1c
253 .RI "gpg_error_t \fBpwmd_save2\fP (\fBpwm_t\fP *pwm)"
255 .ti -1c
256 .RI "gpg_error_t \fBpwmd_save_async2\fP (\fBpwm_t\fP *pwm)"
258 .ti -1c
259 .RI "gpg_error_t \fBpwmd_save_async\fP (\fBpwm_t\fP *pwm)"
261 .ti -1c
262 .RI "gpg_error_t \fBpwmd_command\fP (\fBpwm_t\fP *pwm, char **result, const char *cmd,...)"
264 .ti -1c
265 .RI "gpg_error_t \fBpwmd_command_ap\fP (\fBpwm_t\fP *pwm, char **result, const char *cmd, va_list ap)"
267 .ti -1c
268 .RI "gpg_error_t \fBpwmd_inquire\fP (\fBpwm_t\fP *pwm, const char *cmd, \fBpwmd_inquire_cb_t\fP func, void *user)"
270 .ti -1c
271 .RI "void \fBpwmd_close\fP (\fBpwm_t\fP *pwm)"
273 .ti -1c
274 .RI "gpg_error_t \fBpwmd_socket_type\fP (\fBpwm_t\fP *pwm, \fBpwmd_socket_t\fP *type)"
276 .ti -1c
277 .RI "void \fBpwmd_free\fP (void *ptr)"
279 .ti -1c
280 .RI "void * \fBpwmd_malloc\fP (size_t size)"
282 .ti -1c
283 .RI "void * \fBpwmd_calloc\fP (size_t nmemb, size_t size)"
285 .ti -1c
286 .RI "void * \fBpwmd_realloc\fP (void *ptr, size_t size)"
288 .ti -1c
289 .RI "char * \fBpwmd_strdup\fP (const char *str)"
291 .ti -1c
292 .RI "char * \fBpwmd_strdup_printf\fP (const char *fmt,...)"
294 .ti -1c
295 .RI "const char * \fBpwmd_strerror\fP (gpg_error_t code)"
297 .ti -1c
298 .RI "int \fBpwmd_strerror_r\fP (gpg_error_t code, char *buf, size_t size)"
300 .in -1c
301 .SH "Define Documentation"
302 .PP 
303 .SS "#define EPWMD_ERROR"
305 A general pwmd error with no suitable description. 
306 .SS "#define EPWMD_FILE_MODIFIED"
308 The data file was modified either externally or by another client while trying to process a command. 
309 .SS "#define EPWMD_LIBXML_ERROR"
311 An XML parse or other libxml2 error occurred. 
312 .SS "#define EPWMD_LOOP"
314 A recursion loop was detected while processing a 'target' attribute. 
315 .SS "#define EPWMD_MAX_SLOTS"
317 The maximum number of cache slots has been reached. There is no available slot for a new file. 
318 .SS "#define EPWMD_NO_FILE"
320 A command required an open file but no file has yet been opened. 
321 .SS "#define LIBPWMD_VERSION"
323 The version of this library. 
324 .SS "#define PWMD_FD_READABLE"
326 Set when the file descriptor is readable. 
327 .SS "#define PWMD_FD_WRITABLE"
329 Set when the file descriptor is writable. 
330 .SH "Typedef Documentation"
331 .PP 
332 .SS "\fBpwm_t\fP"
334 When a handle is mentioned in this documentation it is a pointer of this type. A new handle is created with \fBpwmd_new()\fP. 
335 .SS "\fBpwmd_inquire_cb_t\fP"
337 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.
339 \fBParameters:\fP
340 .RS 4
341 \fIuser\fP The user data pointer passed to \fBpwmd_inquire()\fP. 
343 \fIcmd\fP The same as the \fIcmd\fP argument to \fBpwmd_inquire()\fP. 
345 \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. 
347 \fIdata\fP The next chunk of data to send or NULL. 
349 \fIlen\fP The length of \fIdata\fP or 0.
352 \fBReturn values:\fP
353 .RS 4
354 \fI0\fP There is more data to be sent. 
356 \fIGPG_ERR_EOF\fP No need to call this function again, the current \fIline\fP is the last to send. 
358 \fIcode\fP Any other error code which will terminate the INQUIRE.
361 \fBNote:\fP
362 .RS 4
363 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. 
367 .SS "\fBpwmd_passphrase_cb_t\fP"
369 The value of the option \fBPWMD_OPTION_PASSPHRASE_CB\fP which is set with \fBpwmd_setopt()\fP.
371 \fBParameters:\fP
372 .RS 4
373 \fIuser\fP A user data pointer which is set with \fBPWMD_OPTION_PASSPHRASE_DATA\fP. 
375 \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. 
378 \fBReturns:\fP
379 .RS 4
380 0 on success or an error code which will cause a command to fail. 
384 .SS "\fBpwmd_status_cb_t\fP"
386 The value of the option \fBPWMD_OPTION_STATUS_CB\fP which is set with \fBpwmd_setopt()\fP.
388 \fBParameters:\fP
389 .RS 4
390 \fIuser\fP A user data pointer which is set with \fBPWMD_OPTION_STATUS_DATA\fP. 
392 \fIline\fP The status message line received from the server. 
395 \fBReturns:\fP
396 .RS 4
397 0 on success or an error code which will cause a command to fail. 
401 .SH "Enumeration Type Documentation"
402 .PP 
403 .SS "enum \fBpwmd_async_t\fP"
405 The return code of \fBpwmd_process()\fP which is used for all asynchronous commands. 
407 \fBEnumerator: \fP
408 .in +1c
410 \fB\fIASYNC_INIT \fP\fP
412 \fBFor internal use only.\fP
413 .RS 4
418 \fB\fIASYNC_PROCESS \fP\fP
419 \fBpwmd_process()\fP should be called again. 
421 \fB\fIASYNC_DONE \fP\fP
422 The command has completed. The result code should be checked for an error. 
423 .SS "enum \fBpwmd_ip_version_t\fP"
425 The value of the option \fBPWMD_OPTION_IP_VERSION\fP which is set with \fBpwmd_setopt()\fP. 
427 \fBEnumerator: \fP
428 .in +1c
430 \fB\fIPWMD_IP_ANY \fP\fP
431 Try both IPv6 and IPv4 addresses. Note that IPv6 is tried first. 
433 \fB\fIPWMD_IPV4 \fP\fP
434 Only try IPv4. 
436 \fB\fIPWMD_IPV6 \fP\fP
437 Only try IPv6. 
438 .SS "enum \fBpwmd_option_t\fP"
440 libpwmd options which are set with \fBpwmd_setopt()\fP.
442 \fBNote:\fP
443 .RS 4
444 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
449 \fBEnumerator: \fP
450 .in +1c
452 \fB\fIPWMD_OPTION_PASSPHRASE_CB \fP\fP
453 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.
455 \fBNote:\fP
456 .RS 4
457 An empty string as the passphrase is allowed. 
462 \fB\fIPWMD_OPTION_PASSPHRASE_DATA \fP\fP
463 User supplied data which is passed to the custom passphrase function. 
465 \fB\fIPWMD_OPTION_PASSPHRASE \fP\fP
466 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.
468 \fBNote:\fP
469 .RS 4
470 An empty string as the passphrase is allowed. 
475 \fB\fIPWMD_OPTION_PINENTRY_TRIES \fP\fP
476 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.
478 \fBNote:\fP
479 .RS 4
480 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. 
485 \fB\fIPWMD_OPTION_PINENTRY_PATH \fP\fP
486 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.
488 \fBSee also:\fP
489 .RS 4
490 \fBPinentry Details\fP 
495 \fB\fIPWMD_OPTION_PINENTRY_TTY \fP\fP
496 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.
498 \fBSee also:\fP
499 .RS 4
500 \fBPinentry Details\fP 
505 \fB\fIPWMD_OPTION_PINENTRY_TERM \fP\fP
506 A value which specifies the terminal type (e.g., vt100) that \fBpinentry(1)\fP will use when no X11 display is available.
508 \fBSee also:\fP
509 .RS 4
510 \fBPinentry Details\fP 
515 \fB\fIPWMD_OPTION_PINENTRY_DISPLAY \fP\fP
516 A value which specifies the X11 display that \fBpinentry(1)\fP will use.
518 \fBSee also:\fP
519 .RS 4
520 \fBPinentry Details\fP 
525 \fB\fIPWMD_OPTION_PINENTRY_TITLE \fP\fP
526 A character string that \fBpinentry(1)\fP will use in it's dialog window. 
528 \fB\fIPWMD_OPTION_PINENTRY_PROMPT \fP\fP
529 A character string that \fBpinentry(1)\fP will use in it's dialog window.  
531 \fB\fIPWMD_OPTION_PINENTRY_DESC \fP\fP
532 A character string that \fBpinentry(1)\fP will use in it's dialog window.  
534 \fB\fIPWMD_OPTION_PINENTRY_LC_CTYPE \fP\fP
535 For \fBpinentry(1)\fP localization. 
537 \fB\fIPWMD_OPTION_PINENTRY_LC_MESSAGES \fP\fP
538 For \fBpinentry(1)\fP localization.  
540 \fB\fIPWMD_OPTION_PINENTRY_TIMEOUT \fP\fP
541 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. 
543 \fB\fIPWMD_OPTION_STATUS_CB \fP\fP
544 A function of type \fBpwmd_status_cb_t\fP that will process status messages received from the pwmd server. 
546 \fB\fIPWMD_OPTION_STATUS_DATA \fP\fP
547 A user data pointer which is passed to the status message function. 
549 \fB\fIPWMD_OPTION_IP_VERSION \fP\fP
550 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.
552 \fBNote:\fP
553 .RS 4
554 This option must be set before a connection is made when not the default. 
558 .SS "enum \fBpwmd_socket_t\fP"
560 For use with \fBpwmd_socket_type()\fP. 
562 \fBEnumerator: \fP
563 .in +1c
565 \fB\fIPWMD_SOCKET_UDS \fP\fP
566 A UNIX domain socket. 
568 \fB\fIPWMD_SOCKET_SSH \fP\fP
569 An SSH connection over a TCP socket. 
570 .SH "Function Documentation"
571 .PP 
572 .SS "void* pwmd_calloc (size_t nmemb, size_t size)"
574 A wrapper around calloc(). 
576 Like calloc(), but lets libpwmd keep track of the pointer.
578 \fBParameters:\fP
579 .RS 4
580 \fInmemb\fP The number of elements to allocate. 
582 \fIsize\fP The number of bytes to allocate. 
585 \fBReturns:\fP
586 .RS 4
587 A newly allocated pointer or NULL if there wasn't enough memory. 
590 \fBSee also:\fP
591 .RS 4
592 calloc(3), \fBpwmd_free()\fP 
596 .SS "void pwmd_close (\fBpwm_t\fP * pwm)"
598 Close a handle. 
600 This will close the connection to a pwmd server and free any resources associated with it.
602 \fBParameters:\fP
603 .RS 4
604 \fIpwm\fP A handle. 
607 \fBReturns:\fP
608 .RS 4
609 Nothing. 
613 .SS "gpg_error_t pwmd_command (\fBpwm_t\fP * pwm, char ** result, const char * cmd,  ...)"
615 Send a command to the pwmd server. 
617 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.
619 \fBParameters:\fP
620 .RS 4
621 \fIpwm\fP A handle. 
623 \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. 
625 \fIcmd\fP The command to send. 
627 \fI...\fP The arguments to \fIcmd\fP. 
630 \fBReturns:\fP
631 .RS 4
632 0 on success or an error code. 
636 .SS "gpg_error_t pwmd_command_ap (\fBpwm_t\fP * pwm, char ** result, const char * cmd, va_list ap)"
638 Send a command to the pwmd server. 
640 Like \fBpwmd_command()\fP but uses an argument pointer instead.
642 \fBParameters:\fP
643 .RS 4
644 \fIpwm\fP A handle. 
646 \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. 
648 \fIcmd\fP The command to send. 
650 \fIap\fP The arguments to \fIcmd\fP. 
653 \fBReturns:\fP
654 .RS 4
655 0 on success or an error code. 
659 .SS "gpg_error_t pwmd_connect (\fBpwm_t\fP * pwm, const char * path)"
661 Connect to a local pwmd server. 
663 Connects to a local unix domain socket.
665 \fBParameters:\fP
666 .RS 4
667 \fIpwm\fP A handle. 
669 \fIpath\fP The socket path to connect to. If NULL, then a default of \fI'~/.pwmd/socket'\fP will be used. 
672 \fBReturns:\fP
673 .RS 4
674 0 on success or an error code. 
677 \fBNote:\fP
678 .RS 4
679 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
682 \fBSee also:\fP
683 .RS 4
684 \fBpwmd_ssh_connect()\fP, \fBpwmd_ssh_connect_async()\fP 
688 .SS "gpg_error_t pwmd_connect_url (\fBpwm_t\fP * pwm, const char * url)"
690 Establish a connection by parsing a URL. 
692 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: 
695  socket://[path/to/local/socket]
697  or
699  ssh[46]://[username@]hostname[:port],identity,known_hosts
704 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://.
706 \fBParameters:\fP
707 .RS 4
708 \fIpwm\fP A handle. 
710 \fIurl\fP The string to parse. 
713 \fBNote:\fP
714 .RS 4
715 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
718 \fBReturns:\fP
719 .RS 4
720 0 on success or an error code. 
723 \fBSee also:\fP
724 .RS 4
725 \fBpwmd_socket_type()\fP 
729 .SS "gpg_error_t pwmd_connect_url_async (\fBpwm_t\fP * pwm, const char * url)"
731 Establish a connection asynchronously by parsing a URL. 
733 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: 
736  socket://[path/to/local/socket]
738  or
740  ssh[46]://[username@]hostname[:port],identity,known_hosts
745 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://.
747 \fBpwmd_process()\fP should be called until the command completes.
749 \fBParameters:\fP
750 .RS 4
751 \fIpwm\fP A handle. 
753 \fIurl\fP The string to parse. 
756 \fBNote:\fP
757 .RS 4
758 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
761 \fBReturns:\fP
762 .RS 4
763 0 on success or an error code. 
766 \fBSee also:\fP
767 .RS 4
768 \fBpwmd_socket_type()\fP 
772 .SS "void pwmd_free (void * ptr)"
774 Free a previously allocated pointer. 
776 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.
778 The difference between the standard free() and this function is that this one will zero out the contents of the pointer before freeing it.
780 \fBParameters:\fP
781 .RS 4
782 \fIptr\fP The pointer to deallocate. 
785 \fBReturns:\fP
786 .RS 4
787 Nothing. 
790 \fBSee also:\fP
791 .RS 4
792 \fBpwmd_malloc()\fP, \fBpwmd_calloc()\fP, \fBpwmd_realloc()\fP, \fBpwmd_strdup()\fP, \fBpwmd_process()\fP, \fBpwmd_command()\fP 
796 .SS "gpg_error_t pwmd_get_fds (\fBpwm_t\fP * pwm, pwmd_fd_t * fds, int * n_fds)"
798 Get the associated file descriptor(s) for a handle. 
800 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.
802 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.
804 \fBParameters:\fP
805 .RS 4
806 \fIpwm\fP A handle. 
808 \fIfds\fP Set to the file descriptor(s) of the associated handle. 
810 \fIn_fds\fP Initially the size of \fIfds\fP then updated to the number of available file descriptors which are stored in \fIfds\fP. 
813 \fBReturn values:\fP
814 .RS 4
815 \fI0\fP on success or an error code. 
817 \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. 
820 \fBSee also:\fP
821 .RS 4
822 \fBpwmd_process()\fP 
826 .SS "gpg_error_t pwmd_get_hostkey (\fBpwm_t\fP * pwm, const char * host, int port, char ** result)"
828 Retrieve a remote SSH host key. 
830 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.
832 \fBParameters:\fP
833 .RS 4
834 \fIpwm\fP A handle. 
836 \fIhost\fP The hostname to connect to. 
838 \fIport\fP The port or a default if set to -1. 
840 \fIresult\fP The SHA1 sum of the server host key which must be freed with \fBpwmd_free()\fP. 
843 \fBReturns:\fP
844 .RS 4
845 0 on success or an error code. 
848 \fBSee also:\fP
849 .RS 4
850 \fBpwmd_get_hostkey_async()\fP, \fBSSH Details\fP 
854 .SS "gpg_error_t pwmd_get_hostkey_async (\fBpwm_t\fP * pwm, const char * host, int port)"
856 Retrieve a remote SSH host key asynchronously. 
858 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.
860 \fBpwmd_process()\fP should be called until the command completes.
862 \fBParameters:\fP
863 .RS 4
864 \fIpwm\fP A handle. 
866 \fIhost\fP The hostname to connect to. 
868 \fIport\fP The port or a default if set to -1. 
871 \fBReturns:\fP
872 .RS 4
873 0 on success or an error code. 
876 \fBSee also:\fP
877 .RS 4
878 \fBpwmd_get_hostkey()\fP, \fBpwmd_process()\fP, \fBSSH Details\fP 
882 .SS "gpg_error_t pwmd_init (void)"
884 Initialize the library. 
886 This function must be the first function called in the library before any others. It sets up internationalization among other things.
888 \fBReturns:\fP
889 .RS 4
890 0 Success. 
894 .SS "gpg_error_t pwmd_inquire (\fBpwm_t\fP * pwm, const char * cmd, \fBpwmd_inquire_cb_t\fP func, void * user)"
896 Send data to a pwmd server. 
898 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.
900 \fBParameters:\fP
901 .RS 4
902 \fIpwm\fP A handle. 
904 \fIcmd\fP The command (without arguments) to send that uses an INQUIRE. 
906 \fIfunc\fP A callback function which sets the data to be sent. 
908 \fIuser\fP A user data pointer passed to the callback function \fIfunc\fP. 
911 \fBReturns:\fP
912 .RS 4
913 0 on success or an error code.
916 \fBSee also:\fP
917 .RS 4
918 \fBpwmd_inquire_cb_t\fP 
922 .SS "void* pwmd_malloc (size_t size)"
924 A wrapper around malloc. 
926 Like malloc(), but lets libpwmd keep track of the pointer.
928 \fBParameters:\fP
929 .RS 4
930 \fIsize\fP The number of bytes to allocate. 
933 \fBReturns:\fP
934 .RS 4
935 A newly allocated pointer or NULL if there wasn't enough memory. 
938 \fBSee also:\fP
939 .RS 4
940 malloc(3), \fBpwmd_free()\fP 
944 .SS "\fBpwm_t\fP* pwmd_new (const char * name)"
946 Creates a new handle. 
948 Creates a new handle for use with the other functions.
950 \fBParameters:\fP
951 .RS 4
952 \fIname\fP If not NULL, the name of the application. The application name is sent to the pwmd server after successfully connecting.
954 \fIname\fP The application name or NULL. 
957 \fBReturns:\fP
958 .RS 4
959 a new handle or NULL if there was not enough memory. 
963 .SS "gpg_error_t pwmd_open (\fBpwm_t\fP * pwm, const char * filename)"
965 Open a file on the pwmd server. 
967 This will send the OPEN command to the server.
969 \fBParameters:\fP
970 .RS 4
971 \fIpwm\fP A handle. 
973 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
976 \fBReturns:\fP
977 .RS 4
978 0 on success or an error code. 
981 \fBSee also:\fP
982 .RS 4
983 \fBPinentry Details\fP 
987 .SS "gpg_error_t pwmd_open2 (\fBpwm_t\fP * pwm, const char * filename)"
989 Open a file on the pwmd server using a local pinentry. 
991 This will send the OPEN command to the server like \fBpwmd_open()\fP but will use the local pinentry and not pwmd's pinentry.
993 \fBNote:\fP
994 .RS 4
995 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.
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 file only. 
1005 \fBReturns:\fP
1006 .RS 4
1007 0 on success or an error code. 
1010 \fBSee also:\fP
1011 .RS 4
1012 \fBPinentry Details\fP 
1016 .SS "gpg_error_t pwmd_open_async (\fBpwm_t\fP * pwm, const char * filename)"
1018 Open a file on the pwmd server asynchronously. 
1020 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.
1022 \fBpwmd_process()\fP should be called until the command completes.
1024 \fBParameters:\fP
1025 .RS 4
1026 \fIpwm\fP A handle. 
1028 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
1031 \fBReturns:\fP
1032 .RS 4
1033 0 on success or an error code. 
1036 \fBSee also:\fP
1037 .RS 4
1038 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1042 .SS "gpg_error_t pwmd_open_async2 (\fBpwm_t\fP * pwm, const char * filename)"
1044 Open a file on the pwmd server asynchronously (fork method). 
1046 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.
1048 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.
1050 \fBpwmd_process()\fP should be called until the command completes.
1052 \fBNote:\fP
1053 .RS 4
1054 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.
1057 \fBParameters:\fP
1058 .RS 4
1059 \fIpwm\fP A handle. 
1061 \fIfilename\fP The filename to open. The \fIfilename\fP is not a full path but the data file only. 
1064 \fBReturns:\fP
1065 .RS 4
1066 0 on success or an error code. 
1069 \fBSee also:\fP
1070 .RS 4
1071 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1075 .SS "gpg_error_t pwmd_pending_line (\fBpwm_t\fP * pwm)"
1077 Check for a unparsed buffered line. 
1079 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.
1081 \fBParameters:\fP
1082 .RS 4
1083 \fIpwm\fP A handle. 
1086 \fBReturn values:\fP
1087 .RS 4
1088 \fI0\fP if there is a pending line. 
1090 \fIGPG_ERR_NO_DATA\fP if there is no pending line. 
1093 \fBSee also:\fP
1094 .RS 4
1095 \fBpwmd_process()\fP 
1099 .SS "\fBpwmd_async_t\fP pwmd_process (\fBpwm_t\fP * pwm, gpg_error_t * rc, char ** result)"
1101 Process an asynchronous function. 
1103 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.
1105 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.
1107 \fBParameters:\fP
1108 .RS 4
1109 \fIpwm\fP A handle. 
1111 \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. 
1113 \fIresult\fP Set to the result of the command when \fIrc\fP is 0. Note that not all commands return a result. 
1116 \fBReturn values:\fP
1117 .RS 4
1118 \fIASYNC_DONE\fP The command has completed. \fIrc\fP should be checked to determine if the command was successful or not. 
1120 \fIASYNC_PROCESS\fP The command is still running and this function should be called again. 
1123 \fBSee also:\fP
1124 .RS 4
1125 \fBpwmd_get_fds()\fP, \fBpwmd_pending_line()\fP 
1129 .SS "void* pwmd_realloc (void * ptr, size_t size)"
1131 A wrapper around realloc(). 
1133 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.
1135 \fBParameters:\fP
1136 .RS 4
1137 \fIptr\fP The pointer to reallocate. 
1139 \fIsize\fP The new number of bytes to allocate. 
1142 \fBReturns:\fP
1143 .RS 4
1144 A newly allocated pointer or NULL if there wasn't enough memory. 
1147 \fBSee also:\fP
1148 .RS 4
1149 realloc(3), \fBpwmd_free()\fP 
1153 .SS "gpg_error_t pwmd_save (\fBpwm_t\fP * pwm)"
1155 Save a file on the pwmd server. 
1157 This will send the SAVE command.
1159 \fBParameters:\fP
1160 .RS 4
1161 \fIpwm\fP A handle. 
1164 \fBReturns:\fP
1165 .RS 4
1166 0 on success or an error code. 
1169 \fBSee also:\fP
1170 .RS 4
1171 \fBPinentry Details\fP 
1175 .SS "gpg_error_t pwmd_save2 (\fBpwm_t\fP * pwm)"
1177 Save a file on the pwmd server using the local pinentry. 
1179 This will send the SAVE command like \fBpwmd_save()\fP but will use a local pinentry and not pwmd's pinentry.
1181 \fBParameters:\fP
1182 .RS 4
1183 \fIpwm\fP A handle. 
1186 \fBReturns:\fP
1187 .RS 4
1188 0 on success or an error code. 
1191 \fBSee also:\fP
1192 .RS 4
1193 \fBPinentry Details\fP 
1197 .SS "gpg_error_t pwmd_save_async (\fBpwm_t\fP * pwm)"
1199 Save changes to a file on the pwmd server asynchronously. 
1201 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.
1203 \fBpwmd_process()\fP should be called until the command completes.
1205 \fBParameters:\fP
1206 .RS 4
1207 \fIpwm\fP A handle. 
1210 \fBReturns:\fP
1211 .RS 4
1212 0 on success or an error code. 
1215 \fBSee also:\fP
1216 .RS 4
1217 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1221 .SS "gpg_error_t pwmd_save_async2 (\fBpwm_t\fP * pwm)"
1223 Save a file on the pwmd server asynchronously (fork method). 
1225 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.
1227 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.
1229 \fBpwmd_process()\fP should be called until the command completes.
1231 \fBParameters:\fP
1232 .RS 4
1233 \fIpwm\fP A handle. 
1236 \fBReturns:\fP
1237 .RS 4
1238 0 on success or an error code. 
1241 \fBSee also:\fP
1242 .RS 4
1243 \fBpwmd_process()\fP, \fBPinentry Details\fP 
1247 .SS "gpg_error_t pwmd_setopt (\fBpwm_t\fP * pwm, \fBpwmd_option_t\fP opt,  ...)"
1249 Set handle options. 
1251 See \fBpwmd_option_t\fP for option specific details.
1253 \fBParameters:\fP
1254 .RS 4
1255 \fIpwm\fP A handle. 
1257 \fIopt\fP The option. 
1259 \fI...\fP The option value. 
1262 \fBReturns:\fP
1263 .RS 4
1264 0 on success or an error code. 
1268 .SS "gpg_error_t pwmd_socket_type (\fBpwm_t\fP * pwm, \fBpwmd_socket_t\fP * type)"
1270 The type of connection a handle has. 
1272 Useful when you want to know what kind of connection a handle has.
1274 \fBParameters:\fP
1275 .RS 4
1276 \fIpwm\fP A handle. 
1278 \fItype\fP The type of socket. 
1281 \fBReturns:\fP
1282 .RS 4
1283 0 on success or an error code. 
1286 \fBSee also:\fP
1287 .RS 4
1288 \fBpwmd_connect_url()\fP 
1292 .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)"
1294 Establish a remote connection to a pwmd server. 
1296 Connects to a pwmd server over an SSH channel.
1298 \fBParameters:\fP
1299 .RS 4
1300 \fIpwm\fP A handle. 
1302 \fIhost\fP The hostname to connect to. 
1304 \fIport\fP The port or -1 for the default. 
1306 \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. 
1308 \fIuser\fP The username on the SSH server to login as. If NULL then invoking username will be used. 
1310 \fIknown_hosts\fP A file containing the public SSH server key hash in SHA1 format which may be obtained with \fBpwmd_get_hostkey()\fP. 
1313 \fBReturns:\fP
1314 .RS 4
1315 0 on success or an error code. 
1318 \fBNote:\fP
1319 .RS 4
1320 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
1323 \fBSee also:\fP
1324 .RS 4
1325 \fBpwmd_ssh_connect_async()\fP, \fBPWMD_OPTION_IP_VERSION\fP, \fBSSH Details\fP 
1329 .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)"
1331 Establish a remote connection to a pwmd server asynchronously. 
1333 This is a variant of \fBpwmd_ssh_connect()\fP that will not block while doing DNS lookups or while connecting.
1335 \fBpwmd_process()\fP should be called until the command completes.
1337 \fBParameters:\fP
1338 .RS 4
1339 \fIpwm\fP A handle. 
1341 \fIhost\fP The hostname to connect to. 
1343 \fIport\fP The port or -1 for the default. 
1345 \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. 
1347 \fIuser\fP The username on the SSH server to login as. If NULL, the invoking username will be used. 
1349 \fIknown_hosts\fP A file containing the public SSH server key hash in SHA1 format which may be obtained with \fBpwmd_get_hostkey()\fP. 
1352 \fBReturns:\fP
1353 .RS 4
1354 0 on success or an error code. 
1357 \fBNote:\fP
1358 .RS 4
1359 When the first character of a filename parameter is a tilde (~), it will be expanded to the home directory of the current user. 
1362 \fBSee also:\fP
1363 .RS 4
1364 \fBpwmd_process()\fP, \fBPWMD_OPTION_IP_VERSION\fP, \fBSSH Details\fP 
1368 .SS "char* pwmd_strdup (const char * str)"
1370 A wrapper around strdup(). 
1372 Like strdup(), but lets libpwmd keep track of the pointer.
1374 \fBParameters:\fP
1375 .RS 4
1376 \fIstr\fP The string to duplicate. 
1379 \fBReturns:\fP
1380 .RS 4
1381 A newly allocated character pointer or NULL if there wasn't enough memory. 
1384 \fBSee also:\fP
1385 .RS 4
1386 strdup(3), \fBpwmd_free()\fP 
1390 .SS "char* pwmd_strdup_printf (const char * fmt,  ...)"
1392 Duplicate a formatted string. 
1394 Like sprintf() but returns an allocated string.
1396 \fBParameters:\fP
1397 .RS 4
1398 \fIfmt\fP The formatted string. 
1400 \fI...\fP Any format arguments to the string. 
1403 \fBReturns:\fP
1404 .RS 4
1405 A newly allocated character pointer or NULL if there wasn't enough memory. 
1408 \fBSee also:\fP
1409 .RS 4
1410 \fBpwmd_free()\fP 
1414 .SS "const char* pwmd_strerror (gpg_error_t code)"
1416 Return a description of an error code. 
1418 \fBParameters:\fP
1419 .RS 4
1420 \fIcode\fP The error code to describe. 
1423 \fBReturns:\fP
1424 .RS 4
1425 A character description of the error code. 
1428 \fBSee also:\fP
1429 .RS 4
1430 \fBpwmd_strerror_r()\fP 
1434 .SS "int pwmd_strerror_r (gpg_error_t code, char * buf, size_t size)"
1436 Return a description of an error code (thread-safe). 
1438 This is a thread-safe version of \fBpwmd_strerror()\fP.
1440 \fBParameters:\fP
1441 .RS 4
1442 \fIcode\fP The error code to describe. 
1444 \fIbuf\fP An allocated buffer to hold the error description. 
1446 \fIsize\fP The size of the allocated buffer \fIbuf\fP.
1449 \fBReturn values:\fP
1450 .RS 4
1451 \fI0\fP Success. 
1453 \fIERANGE\fP \fIsize\fP was not large enough to hold the entire description and \fIbuf\fP is set to the truncated error string. 
1457 .SH "Author"
1458 .PP 
1459 Generated automatically by Doxygen for libpwmd from the source code.