|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 [scriptable, uuid(3a5c7a0f-f5da-4a8b-a748-d7c5a528f33b)] |
|
10 interface nsINSSErrorsService : nsISupports |
|
11 { |
|
12 /** |
|
13 * @param aNSPRCode An error code obtained using PR_GetError() |
|
14 * @return True if it is error code defined by the NSS library |
|
15 */ |
|
16 boolean isNSSErrorCode(in int32_t aNSPRCode); |
|
17 |
|
18 /** |
|
19 * Function will fail if aNSPRCode is not an NSS error code. |
|
20 * @param aNSPRCode An error code obtained using PR_GetError() |
|
21 * @return The result of the conversion, an XPCOM error code |
|
22 */ |
|
23 nsresult getXPCOMFromNSSError(in int32_t aNSPRCode); |
|
24 |
|
25 /** |
|
26 * Function will fail if aXPCOMErrorCode is not an NSS error code. |
|
27 * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError |
|
28 * return A localized human readable error explanation. |
|
29 */ |
|
30 AString getErrorMessage(in nsresult aXPCOMErrorCode); |
|
31 |
|
32 /** |
|
33 * Function will fail if aXPCOMErrorCode is not an NSS error code. |
|
34 * @param aXPCOMErrorCode An error code obtain using getXPCOMFromNSSError |
|
35 * return the |
|
36 */ |
|
37 uint32_t getErrorClass(in nsresult aXPCOMErrorCode); |
|
38 |
|
39 const unsigned long ERROR_CLASS_SSL_PROTOCOL = 1; |
|
40 const unsigned long ERROR_CLASS_BAD_CERT = 2; |
|
41 |
|
42 /** |
|
43 * The following values define the range of NSPR error codes used by NSS. |
|
44 * NSS remains the authorative source for these numbers, as a result, |
|
45 * the values might change in the future. |
|
46 * The security module will perform a runtime check and assertion |
|
47 * to ensure the values are in synch with NSS. |
|
48 */ |
|
49 const long NSS_SEC_ERROR_BASE = -(0x2000); |
|
50 const long NSS_SEC_ERROR_LIMIT = (NSS_SEC_ERROR_BASE + 1000); |
|
51 const long NSS_SSL_ERROR_BASE = -(0x3000); |
|
52 const long NSS_SSL_ERROR_LIMIT = (NSS_SSL_ERROR_BASE + 1000); |
|
53 }; |