2007-02-17 06:47:28 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-02-17 06:47:28 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2014-05-29 02:28:03 +04:00
|
|
|
[scriptable, uuid(dc8013f2-4aed-47a8-bc4e-9fd7a6cc60fa)]
|
2007-02-17 06:47:28 +03:00
|
|
|
interface nsINSSErrorsService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param aNSPRCode An error code obtained using PR_GetError()
|
|
|
|
* @return True if it is error code defined by the NSS library
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
boolean isNSSErrorCode(in int32_t aNSPRCode);
|
2007-02-17 06:47:28 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function will fail if aNSPRCode is not an NSS error code.
|
|
|
|
* @param aNSPRCode An error code obtained using PR_GetError()
|
|
|
|
* @return The result of the conversion, an XPCOM error code
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult getXPCOMFromNSSError(in int32_t aNSPRCode);
|
2007-02-17 06:47:28 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function will fail if aXPCOMErrorCode is not an NSS error code.
|
|
|
|
* @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError
|
|
|
|
* return A localized human readable error explanation.
|
|
|
|
*/
|
|
|
|
AString getErrorMessage(in nsresult aXPCOMErrorCode);
|
2007-10-30 23:26:25 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function will fail if aXPCOMErrorCode is not an NSS error code.
|
|
|
|
* @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError
|
|
|
|
* return the
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t getErrorClass(in nsresult aXPCOMErrorCode);
|
2007-10-30 23:26:25 +03:00
|
|
|
|
|
|
|
const unsigned long ERROR_CLASS_SSL_PROTOCOL = 1;
|
|
|
|
const unsigned long ERROR_CLASS_BAD_CERT = 2;
|
2007-12-04 21:53:14 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The following values define the range of NSPR error codes used by NSS.
|
|
|
|
* NSS remains the authorative source for these numbers, as a result,
|
|
|
|
* the values might change in the future.
|
|
|
|
* The security module will perform a runtime check and assertion
|
|
|
|
* to ensure the values are in synch with NSS.
|
|
|
|
*/
|
2007-12-04 22:38:27 +03:00
|
|
|
const long NSS_SEC_ERROR_BASE = -(0x2000);
|
2007-12-04 21:53:14 +03:00
|
|
|
const long NSS_SEC_ERROR_LIMIT = (NSS_SEC_ERROR_BASE + 1000);
|
2007-12-04 22:38:27 +03:00
|
|
|
const long NSS_SSL_ERROR_BASE = -(0x3000);
|
2007-12-04 21:53:14 +03:00
|
|
|
const long NSS_SSL_ERROR_LIMIT = (NSS_SSL_ERROR_BASE + 1000);
|
2014-05-29 02:28:03 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The error codes within each module must fit in 16 bits. We want these
|
|
|
|
* errors to fit in the same module as the NSS errors but not overlap with
|
|
|
|
* any of them. Converting an NSS SEC, NSS SSL, or PSM error to an NS error
|
|
|
|
* involves negating the value of the error and then synthesizing an error
|
|
|
|
* in the NS_ERROR_MODULE_SECURITY module. Hence, PSM errors will start at
|
|
|
|
* a negative value that both doesn't overlap with the current value
|
|
|
|
* ranges for NSS errors and that will fit in 16 bits when negated.
|
|
|
|
*/
|
|
|
|
const long PSM_ERROR_BASE = -(0x4000);
|
|
|
|
const long PSM_ERROR_LIMIT = (PSM_ERROR_BASE + 1000);
|
2007-02-17 06:47:28 +03:00
|
|
|
};
|