michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * 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: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(3a5c7a0f-f5da-4a8b-a748-d7c5a528f33b)] michael@0: interface nsINSSErrorsService : nsISupports michael@0: { michael@0: /** michael@0: * @param aNSPRCode An error code obtained using PR_GetError() michael@0: * @return True if it is error code defined by the NSS library michael@0: */ michael@0: boolean isNSSErrorCode(in int32_t aNSPRCode); michael@0: michael@0: /** michael@0: * Function will fail if aNSPRCode is not an NSS error code. michael@0: * @param aNSPRCode An error code obtained using PR_GetError() michael@0: * @return The result of the conversion, an XPCOM error code michael@0: */ michael@0: nsresult getXPCOMFromNSSError(in int32_t aNSPRCode); michael@0: michael@0: /** michael@0: * Function will fail if aXPCOMErrorCode is not an NSS error code. michael@0: * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError michael@0: * return A localized human readable error explanation. michael@0: */ michael@0: AString getErrorMessage(in nsresult aXPCOMErrorCode); michael@0: michael@0: /** michael@0: * Function will fail if aXPCOMErrorCode is not an NSS error code. michael@0: * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError michael@0: * return the michael@0: */ michael@0: uint32_t getErrorClass(in nsresult aXPCOMErrorCode); michael@0: michael@0: const unsigned long ERROR_CLASS_SSL_PROTOCOL = 1; michael@0: const unsigned long ERROR_CLASS_BAD_CERT = 2; michael@0: michael@0: /** michael@0: * The following values define the range of NSPR error codes used by NSS. michael@0: * NSS remains the authorative source for these numbers, as a result, michael@0: * the values might change in the future. michael@0: * The security module will perform a runtime check and assertion michael@0: * to ensure the values are in synch with NSS. michael@0: */ michael@0: const long NSS_SEC_ERROR_BASE = -(0x2000); michael@0: const long NSS_SEC_ERROR_LIMIT = (NSS_SEC_ERROR_BASE + 1000); michael@0: const long NSS_SSL_ERROR_BASE = -(0x3000); michael@0: const long NSS_SSL_ERROR_LIMIT = (NSS_SSL_ERROR_BASE + 1000); michael@0: };