kpasswdserver.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KPASSWDSERVER_H
00026 #define KPASSWDSERVER_H
00027
00028 #include <qdict.h>
00029 #include <qintdict.h>
00030
00031 #include <dcopclient.h>
00032 #include <kio/authinfo.h>
00033 #include <kded/kdedmodule.h>
00034
00035 class KPasswdServer : public KDEDModule
00036 {
00037 Q_OBJECT
00038 K_DCOP
00039 public:
00040 KPasswdServer(const QCString &);
00041 ~KPasswdServer();
00042
00043 k_dcop:
00044 KIO::AuthInfo checkAuthInfo(KIO::AuthInfo, long);
00045 KIO::AuthInfo queryAuthInfo(KIO::AuthInfo, QString, long, long);
00046 void addAuthInfo(KIO::AuthInfo, long);
00047
00048 public slots:
00049 void processRequest();
00050
00051 void removeAuthForWindowId(long windowId);
00052
00053 protected:
00054 struct AuthInfo;
00055
00056 QString createCacheKey( const KIO::AuthInfo &info );
00057 const AuthInfo *findAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00058 void removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
00059 void addAuthInfoItem(const QString &key, const KIO::AuthInfo &info, long windowId, long seqNr, bool canceled);
00060 KIO::AuthInfo copyAuthInfo(const AuthInfo *);
00061 void updateAuthExpire(const QString &key, const AuthInfo *, long windowId, bool keep);
00062
00063 struct AuthInfo {
00064 AuthInfo() { expire = expNever; isCanceled = false; seqNr = 0; }
00065
00066 KURL url;
00067 QString directory;
00068 QString username;
00069 QString password;
00070 QString realmValue;
00071 QString digestInfo;
00072
00073 enum { expNever, expWindowClose, expTime } expire;
00074 QValueList<long> windowList;
00075 unsigned long expireTime;
00076 long seqNr;
00077
00078 bool isCanceled;
00079 };
00080
00081 class AuthInfoList : public QPtrList<AuthInfo>
00082 {
00083 public:
00084 AuthInfoList() { setAutoDelete(true); }
00085 int compareItems(QPtrCollection::Item n1, QPtrCollection::Item n2);
00086 };
00087
00088 QDict< AuthInfoList > m_authDict;
00089
00090 struct Request {
00091 DCOPClient *client;
00092 DCOPClientTransaction *transaction;
00093 QString key;
00094 KIO::AuthInfo info;
00095 QString errorMsg;
00096 long windowId;
00097 long seqNr;
00098 };
00099
00100 QPtrList< Request > m_authPending;
00101 QPtrList< Request > m_authWait;
00102 QIntDict<QStringList> mWindowIdList;
00103 DCOPClient *m_dcopClient;
00104 long m_seqNr;
00105 };
00106
00107 #endif
This file is part of the documentation for kdelibs Version 3.1.0.