1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef PK11INSTALL_H
6 #define PK11INSTALL_H
7 
8 #include <prio.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 typedef void (*Pk11Install_ErrorHandler)(char *);
15 
16 typedef enum {
17     PK11_INSTALL_NO_ERROR = 0,
18     PK11_INSTALL_DIR_DOESNT_EXIST,
19     PK11_INSTALL_FILE_DOESNT_EXIST,
20     PK11_INSTALL_FILE_NOT_READABLE,
21     PK11_INSTALL_ERROR_STRING,
22     PK11_INSTALL_JAR_ERROR,
23     PK11_INSTALL_NO_INSTALLER_SCRIPT,
24     PK11_INSTALL_DELETE_TEMP_FILE,
25     PK11_INSTALL_OPEN_SCRIPT_FILE,
26     PK11_INSTALL_SCRIPT_PARSE,
27     PK11_INSTALL_SEMANTIC,
28     PK11_INSTALL_SYSINFO,
29     PK11_INSTALL_NO_PLATFORM,
30     PK11_INSTALL_BOGUS_REL_DIR,
31     PK11_INSTALL_NO_MOD_FILE,
32     PK11_INSTALL_ADD_MODULE,
33     PK11_INSTALL_JAR_EXTRACT,
34     PK11_INSTALL_DIR_NOT_WRITEABLE,
35     PK11_INSTALL_CREATE_DIR,
36     PK11_INSTALL_REMOVE_DIR,
37     PK11_INSTALL_EXEC_FILE,
38     PK11_INSTALL_WAIT_PROCESS,
39     PK11_INSTALL_PROC_ERROR,
40     PK11_INSTALL_USER_ABORT,
41     PK11_INSTALL_UNSPECIFIED
42 } Pk11Install_Error;
43 #define PK11_INSTALL_SUCCESS PK11_INSTALL_NO_ERROR
44 
45 /**************************************************************************
46  *
47  * P k 1 1 I n s t a l l _ I n i t
48  *
49  * Does initialization that otherwise would be done on the fly.  Only
50  * needs to be called by multithreaded apps, before they make any calls
51  * to this library.
52  */
53 void
54 Pk11Install_Init();
55 
56 /**************************************************************************
57  *
58  * P k 1 1 I n s t a l l _ S e t E r r o r H a n d l e r
59  *
60  * Sets the error handler to be used by the library.  Returns the current
61  * error handler function.
62  */
63 Pk11Install_ErrorHandler
64 Pk11Install_SetErrorHandler(Pk11Install_ErrorHandler handler);
65 
66 /**************************************************************************
67  *
68  * P k 1 1 I n s t a l l _ R e l e a s e
69  *
70  * Releases static data structures used by the library.  Don't use the
71  * library after calling this, unless you call Pk11Install_Init()
72  * first.  This function doesn't have to be called at all unless you're
73  * really anal about freeing memory before your program exits.
74  */
75 void
76 Pk11Install_Release();
77 
78 /*************************************************************************
79  *
80  * P k 1 1 I n s t a l l _ D o I n s t a l l
81  *
82  * jarFile is the path of a JAR in the PKCS #11 module JAR format.
83  * installDir is the directory relative to which files will be
84  *   installed.
85  * feedback is a file descriptor to which to write informative (not error)
86  * status messages: what files are being installed, what modules are being
87  * installed.  If feedback==NULL, no messages will be displayed.
88  * If force != 0, interactive prompts will be suppressed.
89  * If noverify == PR_TRUE, signatures won't be checked on the JAR file.
90  */
91 Pk11Install_Error
92 Pk11Install_DoInstall(char *jarFile, const char *installDir,
93                       const char *tempDir, PRFileDesc *feedback, short force,
94                       PRBool noverify);
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /*PK11INSTALL_H*/
101