00001 #ifndef ARCPROXYUTILS_H
00002 #define ARCPROXYUTILS_H
00003
00004 #include <string>
00005
00006 #include <QObject>
00007 #include <QString>
00008 #include <QList>
00009
00010 #include "arc-gui-config.h"
00011
00012 #include <arc/Logger.h>
00013 #include <arc/UserConfig.h>
00014
00015 class ProxyWindow;
00016 class QApplication;
00017
00018 class VomsListEntry : public QObject
00019 {
00020 private:
00021 QString m_alias;
00022 QString m_machine;
00023 QString m_port;
00024 QString m_hostDn;
00025 QString m_officialName;
00026 public:
00027 VomsListEntry();
00028
00029 void setAlias(QString alias);
00030 QString alias();
00031
00032 void setMachine(QString machine);
00033 QString machine();
00034
00035 void setPort(QString port);
00036 QString port();
00037
00038 void setHostDN(QString dn);
00039 QString hostDN();
00040
00041 QString officialName();
00042 };
00043
00044 class VomsList : public QObject
00045 {
00046 private:
00047 QList<VomsListEntry*> m_vomsList;
00048 public:
00049 VomsList();
00050 virtual ~VomsList();
00051 void clear();
00052 bool read();
00053 bool write();
00054 VomsListEntry* at(int idx);
00055 int count();
00056 };
00057
00058 class ArcProxyController : public QObject
00059 {
00060 Q_OBJECT
00061 public:
00062 enum TCertStatus { CS_PATH_EMPTY, CS_NOT_FOUND, CS_INVALID_CONFIG, CS_CADIR_NOT_FOUND, CS_VALID };
00063 enum TProxyStatus { PS_PATH_EMPTY, PS_NOT_FOUND, PS_EXPIRED, PS_NOT_VALID, PS_VALID };
00064 enum TReturnStatus { RS_OK, RS_FAILED };
00065 private:
00066
00067 std::string proxy_path;
00068 std::string cert_path;
00069 std::string key_path;
00070 std::string ca_dir;
00071 std::string vomses_path;
00072 std::string voms_dir;
00073 std::vector<std::string> vomslist;
00074 std::list<std::string> orderlist;
00075 std::string user_name;
00076 std::string retrievable_by_cert;
00077 std::string myproxy_server;
00078 std::string myproxy_command;
00079 std::list<std::string> constraintlist;
00080 std::string conffile;
00081 std::string debug;
00082
00083 bool use_gsi_comm;
00084 bool use_gsi_proxy;
00085 bool info;
00086 bool remove_proxy;
00087 bool use_empty_passphrase;
00088 int timeout;
00089 bool version;
00090 bool use_http_comm;
00091 bool use_nssdb;
00092
00093 Arc::Logger logger;
00094 Arc::LogStream logCerr;
00095 Arc::User user;
00096
00097 QString m_passphrase;
00098
00099 VomsList m_vomsList;
00100
00101 ProxyWindow* m_proxyWindow;
00102 QApplication* m_application;
00103
00104 TReturnStatus m_uiReturnStatus;
00105 public:
00106 ArcProxyController();
00107 virtual ~ArcProxyController();
00108
00109 int initialize();
00110 int printInformation();
00111 int generateProxy();
00112 int removeProxy();
00113
00114 void setUiReturnStatus(TReturnStatus status);
00115 TReturnStatus getUiReturnStatus();
00116
00117 TReturnStatus showProxyUI();
00118
00119 void showProxyUIAppLoop();
00120
00121 TCertStatus checkCert();
00122 TProxyStatus checkProxy();
00123
00124 void setPassphrase(const QString& passphrase);
00125 void setValidityPeriod(int seconds);
00126 void setUseGSIProxy(bool flag);
00127 bool getUseGSIProxy();
00128
00129 void addVomsServer(const QString& server, const QString& role);
00130 void addVomsServerAndRole(const QString& serverAndRole);
00131 void removeVomsServer(const QString& server, const QString& role);
00132 QString getVomsServer(int idx);
00133 int vomsServerCount();
00134
00135 QString getIdentity();
00136
00137 VomsList& vomsList();
00138
00139
00140
00141
00142
00143
00144 };
00145
00146 #endif // ARCPROXYUTILS_H