Back to index

lightning-sunbird  0.9+nobinonly
singsign.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 
00039 /*
00040    singsign.h --- prototypes for wallet functions.
00041 */
00042 
00043 
00044 #ifndef _SINGSIGN_H
00045 #define _SINGSIGN_H
00046 
00047 #include "nsString.h"
00048 #include "nsVoidArray.h"
00049 #include "nsIPref.h"
00050 #include "nsIDOMWindowInternal.h"
00051 
00052 class nsIURI;
00053 
00054 /* Duplicates defines as in nsIPrompt.idl -- keep in sync! */
00055 #define SINGSIGN_SAVE_PASSWORD_NEVER 0
00056 #define SINGSIGN_SAVE_PASSWORD_FOR_SESSION    1
00057 #define SINGSIGN_SAVE_PASSWORD_PERMANENTLY    2
00058 
00059 class nsIPrompt;
00060 PR_BEGIN_EXTERN_C
00061 
00062 extern PRInt32
00063 SINGSIGN_HostCount();
00064 
00065 extern PRInt32
00066 SINGSIGN_UserCount(PRInt32 host);
00067 
00068 extern PRInt32
00069 SINGSIGN_RejectCount();
00070 
00071 extern nsresult
00072 SINGSIGN_Enumerate
00073   (PRInt32 hostNumber, PRInt32 userNumber, PRBool decrypt, char **host, PRUnichar **user, PRUnichar **pswd);
00074 
00075 extern nsresult
00076 SINGSIGN_RejectEnumerate(PRInt32 rejectNumber, char **host);
00077 
00078 extern void
00079 SINGSIGN_RestoreSignonData(nsIPrompt* dialog, nsIURI* passwordRealm, const PRUnichar* name, PRUnichar** value, PRUint32 formNumber, PRUint32 elementNumber);
00080 
00081 extern nsresult
00082 SINGSIGN_PromptUsernameAndPassword
00083     (const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **user, PRUnichar **pwd,
00084      const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
00085      PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
00086 
00087 extern nsresult
00088 SINGSIGN_PromptPassword
00089     (const PRUnichar *dialogTitle, const PRUnichar *text, PRUnichar **pwd,
00090      const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
00091      PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
00092 
00093 extern nsresult
00094 SINGSIGN_Prompt
00095     (const PRUnichar *dialogTitle, const PRUnichar *text, const PRUnichar *defaultText, PRUnichar **resultText,
00096      const char* passwordRealm, nsIPrompt* dialog, PRBool *returnValue,
00097      PRUint32 savePassword = SINGSIGN_SAVE_PASSWORD_PERMANENTLY);
00098 
00099 extern nsresult
00100 SINGSIGN_RemoveUser
00101     (const char* passwordRealm, const PRUnichar *userName, PRBool notify);
00102 
00103 extern nsresult
00104 SINGSIGN_RemoveUserAfterLoginFailure
00105     (const char* passwordRealm, const PRUnichar *userName, PRBool notify);
00106 
00107 extern nsresult
00108 SINGSIGN_RemoveReject
00109     (const char* host);
00110 
00111 extern nsresult
00112 SINGSIGN_AddReject
00113     (const char* host);
00114 
00115 extern PRBool
00116 SINGSIGN_StorePassword
00117     (const char* passwordRealm, const PRUnichar *userName, const PRUnichar *password);
00118 
00119 extern nsresult
00120 SINGSIGN_HaveData(nsIPrompt* dialog, const char* passwordRealm, const PRUnichar *userName, PRBool *retval);
00121 
00122 extern void
00123 SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
00124 
00125 extern void
00126 SI_UnregisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data);
00127 
00128 extern PRBool
00129 SI_GetBoolPref(const char * prefname, PRBool defaultvalue);
00130 
00131 extern void
00132 SI_SetBoolPref(const char * prefname, PRBool prefvalue);
00133 
00134 extern void
00135 SI_SetCharPref(const char * prefname, const char * prefvalue);
00136 
00137 extern void
00138 SI_GetCharPref(const char * prefname, char** aPrefvalue);
00139 
00140 extern void
00141 SI_GetLocalizedUnicharPref(const char * prefname, PRUnichar** aPrefvalue);
00142 
00143 extern void SI_InitSignonFileName();
00144 
00145 extern PRBool
00146 SI_InSequence(const nsString& sequence, int number);
00147 
00148 extern void
00149 SI_FindValueInArgs(const nsAString& results, const nsAString& name, nsAString& value);
00150 
00151 extern void
00152 SI_DeleteAll();
00153 
00154 extern void
00155 SI_ClearUserData();
00156 
00157 extern void
00158 SI_DeletePersistentUserData();
00159 
00160 extern PRBool
00161 SINGSIGN_ReencryptAll();
00162 
00163 extern void
00164 SINGSIGN_RememberSignonData
00165   (nsIPrompt* dialog, nsIURI* uri, nsVoidArray * signonData, nsIDOMWindowInternal* window);
00166 
00167 PR_END_EXTERN_C
00168 
00169 class si_SignonDataStruct {
00170 public:
00171   si_SignonDataStruct();
00172   ~si_SignonDataStruct();
00173 
00174   nsString name;
00175   nsString value;
00176   PRBool isPassword;
00177 };
00178 
00179 #endif /* !_SINGSIGN_H */