1 .\" This program is free software; you can redistribute it and/or modify
2 .\" it under the terms of the GNU General Public License as published by
3 .\" the Free Software Foundation; either version 2 of the License, or
4 .\" (at your option) any later version.
6 .\" This program is distributed in the hope that it will be useful,
7 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
8 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 .\" GNU General Public License for more details.
11 .\" You should have received a copy of the GNU General Public License
12 .\" along with this program; if not, write to the Free Software
13 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 \\$2 \(laURL: \\$1 \(ra\\$3
17 .if \n[.g] .mso www.tmac
18 .TH LIBPWMD 3 "3 Feb 2007" "Password Manager Daemon Library" "Password Manager Daemon Library"
21 libpwmd \- pwmd client interface library
24 .B #include <libpwmd.h>
26 .BI "pwm_t *pwmd_connect(const char " *socket ", int " **error ");"
27 .BI "int pwmd_command(pwm_t " *pwm ", char " **result ", int " **error ", pwmd_cmd " cmd ", " ... ");"
28 .BI "void pwmd_close(pwm_t " *pwm ");"
29 .BI "const char *pwmd_strerror(int " error ");"
31 .BI "typedef char *(" pwmd_password_func ")(void *" data ");"
35 is an library making it easy for applications to use
38 \fBpwmd_connect\fP() connects to the specified \fIsocket\fP. If \fIsocket\fP
39 is NULL then a default of \fI~/.pwmd/socket\fP will be used. If there is an
40 error while connecting \fIerror\fP is set to the errno of the failed function
41 and NULL is returned. When successful a handle is returned for use in the
42 other library functions.
44 \fBpwmd_command\fP() sends either a protocol command to the server or sets
45 library options using handle \fIpwm\fP. The function returns \fBPWMD_OK\fP
46 when successful and stores the output of the protocol command \fIcmd\fP to
47 \fIresult\fP which should be
49 Protocol commands that don't have a result will set \fIresult\fP to NULL. If
50 a protocol error occurs then \fBPWMD_PERROR\fP is returned and \fIerror\fP is
51 set to the protocol error code. \fBPWMD_ERROR\fP is returned when a
52 non-protocol error occurs and sets \fIerror\fP to the errno of the failed
53 function. \fBPWMD_PINENTRY_ERROR\fP is returned when
55 fails and sets \fIerror\fP to \fBEPWMD_ERROR\fP. \fIcmd\fP is one of:
59 Opens a file on the server. The following argument should be of type
60 \fIchar *\fP to specify the filename.
63 Sends the \fISAVE\fP protocol command. It also checks to see if the file is
64 cached on the server and determines whether to obtain a password from
66 This command takes no arguments.
69 Sends a protocol command to the server. The next argument is of type
70 \fIchar *\fP which is the command to send. The command should be newline
74 Sets library options and
76 settings. The next argument is one of the following:
79 .B PWMD_OPTION_PASSWORD_FUNC
80 Specifies a function to use to get a password. The function should return an
81 allocated \fIchar *\fP string which is the password or NULL if there is an
84 .B PWMD_OPTION_PASSWORD_DATA
85 A userdata pointer passed to the password function.
87 .B PWMD_OPTION_PINENTRY
90 to obtain the password for opening and saving a file on the server. The
91 following argument is an \fIint\fP and is \fI1\fP to enable
93 use, and \fI0\fP to use the password which is set with
94 \fBPWMD_OPTION_PASSWORD\fP.
100 .B PWMD_OPTION_PROMPT
101 Sets the strings used in the
104 The next argument is of type \fIchar *\fP. If not defined then a default will
107 .B PWMD_OPTION_PASSWORD
108 Sets the password to use for opening and saving a file when
109 \fBPWMD_OPTION_PINENTRY\fP is \fI0\fP. The following argument is the password
110 and is of type \fIchar *\fP.
114 \fBpwmd_close\fP() closes the connection to the server and frees resources
115 used by the handle \fIpwm\fP.
117 \fBpwmd_strerror\fP() returns a string describing a protocol error code
118 \fIerror\fP or NULL if \fIerror\fP is invalid.
123 Default connecting socket.
125 .B @prefix@/lib/pkgconfig/libpwmd.pc
131 Ben Kibbey <bjk@luxsci.net>
133 .URL "http://bjk.sourceforge.net/pwmd/" "PWMD Homepage" .