extra: import at 3.0.1 beta 1
[mozilla-extra.git] / extensions / wallet / src / singsign.h
blob8cb269b4663a3c8287e65ac26f73836ccb68713b
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
40 singsign.h --- prototypes for wallet functions.
44 #ifndef _SINGSIGN_H
45 #define _SINGSIGN_H
47 #include "nsString.h"
48 #include "nsVoidArray.h"
49 #include "nsIPref.h"
50 #include "nsIDOMWindowInternal.h"
52 class nsIURI;
53 class nsIPromptService2;
54 class nsIChannel;
55 class nsIAuthInformation;
57 /* Duplicates defines as in nsIPrompt.idl -- keep in sync! */
58 #define SINGSIGN_SAVE_PASSWORD_NEVER 0
59 #define SINGSIGN_SAVE_PASSWORD_FOR_SESSION 1
60 #define SINGSIGN_SAVE_PASSWORD_PERMANENTLY 2
62 class nsIPrompt;
63 PR_BEGIN_EXTERN_C
65 extern PRInt32
66 SINGSIGN_HostCount();
68 extern PRInt32
69 SINGSIGN_UserCount(PRInt32 host);
71 extern PRInt32
72 SINGSIGN_RejectCount();
74 extern nsresult
75 SINGSIGN_Enumerate
76 (PRInt32 hostNumber, PRInt32 userNumber, PRBool decrypt, char **host, PRUnichar **user, PRUnichar **pswd);
78 extern nsresult
79 SINGSIGN_RejectEnumerate(PRInt32 rejectNumber, char **host);
81 extern void
82 SINGSIGN_RestoreSignonData(nsIPrompt* dialog, nsIURI* passwordRealm, const PRUnichar* name, PRUnichar** value, PRUint32 formNumber, PRUint32 elementNumber);
84 extern nsresult
85 SINGSIGN_PromptUsernameAndPassword
86 (const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
87 const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
88 PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
90 extern nsresult
91 SINGSIGN_PromptPassword
92 (const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **pwd,
93 const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
94 PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
96 extern nsresult
97 SINGSIGN_Prompt
98 (const PRUnichar *dialogTitle, const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
99 const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
100 PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
102 extern nsresult
103 SINGSIGN_PromptAuth
104 (nsIPromptService2* aService, nsIDOMWindow* aParent, nsIChannel* aChannel,
105 PRUint32 aLevel, nsIAuthInformation* aAuthInfo, PRBool* retval);
107 extern nsresult
108 SINGSIGN_RemoveUser
109 (const char* passwordRealm, const PRUnichar *userName, PRBool notify);
111 extern nsresult
112 SINGSIGN_RemoveUserAfterLoginFailure
113 (const char* passwordRealm, const PRUnichar *userName, PRBool notify);
115 extern nsresult
116 SINGSIGN_RemoveReject
117 (const char* host);
119 extern nsresult
120 SINGSIGN_AddReject
121 (const char* host);
123 extern PRBool
124 SINGSIGN_StorePassword
125 (const char* passwordRealm, const PRUnichar *userName, const PRUnichar *password);
127 extern nsresult
128 SINGSIGN_HaveData(nsIPrompt* dialog, const char* passwordRealm, const PRUnichar *userName, PRBool *retval);
130 extern void
131 SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
133 extern void
134 SI_UnregisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
136 extern PRBool
137 SI_GetBoolPref(const char * prefname, PRBool defaultvalue);
139 extern void
140 SI_SetBoolPref(const char * prefname, PRBool prefvalue);
142 extern void
143 SI_SetCharPref(const char * prefname, const char * prefvalue);
145 extern void
146 SI_GetCharPref(const char * prefname, char** aPrefvalue);
148 extern void
149 SI_GetLocalizedUnicharPref(const char * prefname, PRUnichar** aPrefvalue);
151 extern void SI_InitSignonFileName();
153 extern PRBool
154 SI_InSequence(const nsString& sequence, int number);
156 extern void
157 SI_FindValueInArgs(const nsAString& results, const nsAString& name, nsAString& value);
159 extern void
160 SI_DeleteAll();
162 extern void
163 SI_ClearUserData();
165 extern void
166 SI_DeletePersistentUserData();
168 extern PRBool
169 SINGSIGN_ReencryptAll();
171 extern void
172 SINGSIGN_RememberSignonData
173 (nsIPrompt* dialog, nsIURI* uri, nsVoidArray * signonData, nsIDOMWindowInternal* window);
175 extern void
176 SI_ShutdownModule();
178 PR_END_EXTERN_C
180 class si_SignonDataStruct {
181 public:
182 si_SignonDataStruct();
183 ~si_SignonDataStruct();
185 nsString name;
186 nsString value;
187 PRBool isPassword;
190 #endif /* !_SINGSIGN_H */