michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MODUTIL_ERROR_H michael@0: #define MODUTIL_ERROR_H michael@0: michael@0: /* michael@0: * The values of these enumerated constants are immutable and must not be michael@0: * changed. michael@0: */ michael@0: typedef enum { michael@0: NO_ERR=0, michael@0: INVALID_USAGE_ERR, michael@0: UNEXPECTED_ARG_ERR, michael@0: UNKNOWN_OPTION_ERR, michael@0: MULTIPLE_COMMAND_ERR, michael@0: OPTION_NEEDS_ARG_ERR, michael@0: DUPLICATE_OPTION_ERR, michael@0: MISSING_PARAM_ERR, michael@0: INVALID_FIPS_ARG, michael@0: NO_COMMAND_ERR, michael@0: NO_DBDIR_ERR, michael@0: FIPS_SWITCH_FAILED_ERR, michael@0: FIPS_ALREADY_ON_ERR, michael@0: FIPS_ALREADY_OFF_ERR, michael@0: FILE_ALREADY_EXISTS_ERR, michael@0: FILE_DOESNT_EXIST_ERR, michael@0: FILE_NOT_READABLE_ERR, michael@0: FILE_NOT_WRITEABLE_ERR, michael@0: DIR_DOESNT_EXIST_ERR, michael@0: DIR_NOT_READABLE_ERR, michael@0: DIR_NOT_WRITEABLE_ERR, michael@0: INVALID_CONSTANT_ERR, michael@0: ADD_MODULE_FAILED_ERR, michael@0: UNUSED_ERR, /* reserved for future use */ michael@0: OUT_OF_MEM_ERR, michael@0: DELETE_INTERNAL_ERR, michael@0: DELETE_FAILED_ERR, michael@0: NO_LIST_LOCK_ERR, michael@0: NO_MODULE_LIST_ERR, michael@0: NO_SUCH_MODULE_ERR, michael@0: MOD_INFO_ERR, michael@0: SLOT_INFO_ERR, michael@0: TOKEN_INFO_ERR, michael@0: NO_SUCH_TOKEN_ERR, michael@0: CHANGEPW_FAILED_ERR, michael@0: BAD_PW_ERR, michael@0: DB_ACCESS_ERR, michael@0: AUTHENTICATION_FAILED_ERR, michael@0: NO_SUCH_SLOT_ERR, michael@0: ENABLE_FAILED_ERR, michael@0: UPDATE_MOD_FAILED_ERR, michael@0: DEFAULT_FAILED_ERR, michael@0: UNDEFAULT_FAILED_ERR, michael@0: STDIN_READ_ERR, michael@0: UNSPECIFIED_ERR, michael@0: NOCERTDB_MISUSE_ERR, michael@0: NSS_INITIALIZE_FAILED_ERR, michael@0: michael@0: LAST_ERR /* must be last */ michael@0: } Error; michael@0: #define SUCCESS NO_ERR michael@0: michael@0: /* !!! Should move this into its own .c and un-static it. */ michael@0: static char *errStrings[] = { michael@0: "Operation completed successfully.\n", michael@0: "ERROR: Invalid command line.\n", michael@0: "ERROR: Not expecting argument \"%s\".\n", michael@0: "ERROR: Unknown option: %s.\n", michael@0: "ERROR: %s: multiple commands are not allowed on the command line.\n", michael@0: "ERROR: %s: option needs an argument.\n", michael@0: "ERROR: %s: option cannot be given more than once.\n", michael@0: "ERROR: Command \"%s\" requires parameter \"%s\".\n", michael@0: "ERROR: Argument to -fips must be \"true\" or \"false\".\n", michael@0: "ERROR: No command was specified.\n", michael@0: "ERROR: Cannot determine database directory: use the -dbdir option.\n", michael@0: "ERROR: Unable to switch FIPS modes.\n", michael@0: "FIPS mode already enabled.\n", michael@0: "FIPS mode already disabled.\n", michael@0: "ERROR: File \"%s\" already exists.\n", michael@0: "ERROR: File \"%s\" does not exist.\n", michael@0: "ERROR: File \"%s\" is not readable.\n", michael@0: "ERROR: File \"%s\" is not writeable.\n", michael@0: "ERROR: Directory \"%s\" does not exist.\n", michael@0: "ERROR: Directory \"%s\" is not readable.\n", michael@0: "ERROR: Directory \"%s\" is not writeable.\n", michael@0: "\"%s\" is not a recognized value.\n", michael@0: "ERROR: Failed to add module \"%s\". Probable cause : \"%s\".\n", michael@0: "Unused error string", michael@0: "ERROR: Out of memory.\n", michael@0: "ERROR: Cannot delete internal module.\n", michael@0: "ERROR: Failed to delete module \"%s\".\n", michael@0: "ERROR: Unable to obtain lock on module list.\n", michael@0: "ERROR: Unable to obtain module list.\n", michael@0: "ERROR: Module \"%s\" not found in database.\n", michael@0: "ERROR: Unable to get information about module \"%s\".\n", michael@0: "ERROR: Unable to get information about slot \"%s\".\n", michael@0: "ERROR: Unable to get information about token \"%s\".\n", michael@0: "ERROR: Token \"%s\" not found.\n", michael@0: "ERROR: Unable to change password on token \"%s\".\n", michael@0: "ERROR: Incorrect password.\n", michael@0: "ERROR: Unable to access database \"%s\".\n", michael@0: "ERROR: Unable to authenticate to token \"%s\".\n", michael@0: "ERROR: Slot \"%s\" not found.\n", michael@0: "ERROR: Failed to %s slot \"%s\".\n", michael@0: "ERROR: Failed to update module \"%s\".\n", michael@0: "ERROR: Failed to change defaults.\n", michael@0: "ERROR: Failed to change default.\n", michael@0: "ERROR: Unable to read from standard input.\n", michael@0: "ERROR: Unknown error occurred.\n", michael@0: "ERROR: -nocertdb option can only be used with the -jar command.\n" michael@0: "ERROR: NSS_Initialize() failed.\n" michael@0: }; michael@0: michael@0: typedef enum { michael@0: FIPS_ENABLED_MSG=0, michael@0: FIPS_DISABLED_MSG, michael@0: USING_DBDIR_MSG, michael@0: CREATING_DB_MSG, michael@0: ADD_MODULE_SUCCESS_MSG, michael@0: DELETE_SUCCESS_MSG, michael@0: CHANGEPW_SUCCESS_MSG, michael@0: BAD_PW_MSG, michael@0: PW_MATCH_MSG, michael@0: DONE_MSG, michael@0: ENABLE_SUCCESS_MSG, michael@0: DEFAULT_SUCCESS_MSG, michael@0: UNDEFAULT_SUCCESS_MSG, michael@0: BROWSER_RUNNING_MSG, michael@0: ABORTING_MSG, michael@0: michael@0: LAST_MSG /* must be last */ michael@0: } Message; michael@0: michael@0: static char *msgStrings[] = { michael@0: "FIPS mode enabled.\n", michael@0: "FIPS mode disabled.\n", michael@0: "Using database directory %s...\n", michael@0: "Creating \"%s\"...", michael@0: "Module \"%s\" added to database.\n", michael@0: "Module \"%s\" deleted from database.\n", michael@0: "Token \"%s\" password changed successfully.\n", michael@0: "Incorrect password, try again...\n", michael@0: "Passwords do not match, try again...\n", michael@0: "done.\n", michael@0: "Slot \"%s\" %s.\n", michael@0: "Successfully changed defaults.\n", michael@0: "Successfully changed defaults.\n", michael@0: "\nWARNING: Performing this operation while the browser is running could cause" michael@0: "\ncorruption of your security databases. If the browser is currently running," michael@0: "\nyou should exit browser before continuing this operation. Type " michael@0: "\n'q ' to abort, or to continue: ", michael@0: "\nAborting...\n" michael@0: }; michael@0: michael@0: #endif /* MODUTIL_ERROR_H */