Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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/. */
5 #ifndef MODUTIL_ERROR_H
6 #define MODUTIL_ERROR_H
8 /*
9 * The values of these enumerated constants are immutable and must not be
10 * changed.
11 */
12 typedef enum {
13 NO_ERR=0,
14 INVALID_USAGE_ERR,
15 UNEXPECTED_ARG_ERR,
16 UNKNOWN_OPTION_ERR,
17 MULTIPLE_COMMAND_ERR,
18 OPTION_NEEDS_ARG_ERR,
19 DUPLICATE_OPTION_ERR,
20 MISSING_PARAM_ERR,
21 INVALID_FIPS_ARG,
22 NO_COMMAND_ERR,
23 NO_DBDIR_ERR,
24 FIPS_SWITCH_FAILED_ERR,
25 FIPS_ALREADY_ON_ERR,
26 FIPS_ALREADY_OFF_ERR,
27 FILE_ALREADY_EXISTS_ERR,
28 FILE_DOESNT_EXIST_ERR,
29 FILE_NOT_READABLE_ERR,
30 FILE_NOT_WRITEABLE_ERR,
31 DIR_DOESNT_EXIST_ERR,
32 DIR_NOT_READABLE_ERR,
33 DIR_NOT_WRITEABLE_ERR,
34 INVALID_CONSTANT_ERR,
35 ADD_MODULE_FAILED_ERR,
36 UNUSED_ERR, /* reserved for future use */
37 OUT_OF_MEM_ERR,
38 DELETE_INTERNAL_ERR,
39 DELETE_FAILED_ERR,
40 NO_LIST_LOCK_ERR,
41 NO_MODULE_LIST_ERR,
42 NO_SUCH_MODULE_ERR,
43 MOD_INFO_ERR,
44 SLOT_INFO_ERR,
45 TOKEN_INFO_ERR,
46 NO_SUCH_TOKEN_ERR,
47 CHANGEPW_FAILED_ERR,
48 BAD_PW_ERR,
49 DB_ACCESS_ERR,
50 AUTHENTICATION_FAILED_ERR,
51 NO_SUCH_SLOT_ERR,
52 ENABLE_FAILED_ERR,
53 UPDATE_MOD_FAILED_ERR,
54 DEFAULT_FAILED_ERR,
55 UNDEFAULT_FAILED_ERR,
56 STDIN_READ_ERR,
57 UNSPECIFIED_ERR,
58 NOCERTDB_MISUSE_ERR,
59 NSS_INITIALIZE_FAILED_ERR,
61 LAST_ERR /* must be last */
62 } Error;
63 #define SUCCESS NO_ERR
65 /* !!! Should move this into its own .c and un-static it. */
66 static char *errStrings[] = {
67 "Operation completed successfully.\n",
68 "ERROR: Invalid command line.\n",
69 "ERROR: Not expecting argument \"%s\".\n",
70 "ERROR: Unknown option: %s.\n",
71 "ERROR: %s: multiple commands are not allowed on the command line.\n",
72 "ERROR: %s: option needs an argument.\n",
73 "ERROR: %s: option cannot be given more than once.\n",
74 "ERROR: Command \"%s\" requires parameter \"%s\".\n",
75 "ERROR: Argument to -fips must be \"true\" or \"false\".\n",
76 "ERROR: No command was specified.\n",
77 "ERROR: Cannot determine database directory: use the -dbdir option.\n",
78 "ERROR: Unable to switch FIPS modes.\n",
79 "FIPS mode already enabled.\n",
80 "FIPS mode already disabled.\n",
81 "ERROR: File \"%s\" already exists.\n",
82 "ERROR: File \"%s\" does not exist.\n",
83 "ERROR: File \"%s\" is not readable.\n",
84 "ERROR: File \"%s\" is not writeable.\n",
85 "ERROR: Directory \"%s\" does not exist.\n",
86 "ERROR: Directory \"%s\" is not readable.\n",
87 "ERROR: Directory \"%s\" is not writeable.\n",
88 "\"%s\" is not a recognized value.\n",
89 "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n",
90 "Unused error string",
91 "ERROR: Out of memory.\n",
92 "ERROR: Cannot delete internal module.\n",
93 "ERROR: Failed to delete module \"%s\".\n",
94 "ERROR: Unable to obtain lock on module list.\n",
95 "ERROR: Unable to obtain module list.\n",
96 "ERROR: Module \"%s\" not found in database.\n",
97 "ERROR: Unable to get information about module \"%s\".\n",
98 "ERROR: Unable to get information about slot \"%s\".\n",
99 "ERROR: Unable to get information about token \"%s\".\n",
100 "ERROR: Token \"%s\" not found.\n",
101 "ERROR: Unable to change password on token \"%s\".\n",
102 "ERROR: Incorrect password.\n",
103 "ERROR: Unable to access database \"%s\".\n",
104 "ERROR: Unable to authenticate to token \"%s\".\n",
105 "ERROR: Slot \"%s\" not found.\n",
106 "ERROR: Failed to %s slot \"%s\".\n",
107 "ERROR: Failed to update module \"%s\".\n",
108 "ERROR: Failed to change defaults.\n",
109 "ERROR: Failed to change default.\n",
110 "ERROR: Unable to read from standard input.\n",
111 "ERROR: Unknown error occurred.\n",
112 "ERROR: -nocertdb option can only be used with the -jar command.\n"
113 "ERROR: NSS_Initialize() failed.\n"
114 };
116 typedef enum {
117 FIPS_ENABLED_MSG=0,
118 FIPS_DISABLED_MSG,
119 USING_DBDIR_MSG,
120 CREATING_DB_MSG,
121 ADD_MODULE_SUCCESS_MSG,
122 DELETE_SUCCESS_MSG,
123 CHANGEPW_SUCCESS_MSG,
124 BAD_PW_MSG,
125 PW_MATCH_MSG,
126 DONE_MSG,
127 ENABLE_SUCCESS_MSG,
128 DEFAULT_SUCCESS_MSG,
129 UNDEFAULT_SUCCESS_MSG,
130 BROWSER_RUNNING_MSG,
131 ABORTING_MSG,
133 LAST_MSG /* must be last */
134 } Message;
136 static char *msgStrings[] = {
137 "FIPS mode enabled.\n",
138 "FIPS mode disabled.\n",
139 "Using database directory %s...\n",
140 "Creating \"%s\"...",
141 "Module \"%s\" added to database.\n",
142 "Module \"%s\" deleted from database.\n",
143 "Token \"%s\" password changed successfully.\n",
144 "Incorrect password, try again...\n",
145 "Passwords do not match, try again...\n",
146 "done.\n",
147 "Slot \"%s\" %s.\n",
148 "Successfully changed defaults.\n",
149 "Successfully changed defaults.\n",
150 "\nWARNING: Performing this operation while the browser is running could cause"
151 "\ncorruption of your security databases. If the browser is currently running,"
152 "\nyou should exit browser before continuing this operation. Type "
153 "\n'q <enter>' to abort, or <enter> to continue: ",
154 "\nAborting...\n"
155 };
157 #endif /* MODUTIL_ERROR_H */