AnyConnect Secure Mobility Client 4.8.02045

include/ConnectPromptInfoBase.h

00001 /**************************************************************************
00002 *       Copyright (c) 2008, Cisco Systems, All Rights Reserved
00003 ***************************************************************************
00004 *
00005 *  File:    ConnectPromptInfoBase.h
00006 *  Date:    01/2008
00007 *
00008 ***************************************************************************
00009 *
00010 *   Connect Prompt Info base class implementation for the Client API.
00011 *
00012 ***************************************************************************/
00013 
00014 #ifndef _CONNECTPROMPTINFOBASE_
00015 #define _CONNECTPROMPTINFOBASE_
00016 
00017 #include "api.h"
00018 #include <list>
00019 
00020 class PromptEntry;
00021 
00022 typedef enum
00023 {
00024     HIDDEN,    /**< Indicates the control is not to be displayed */
00025     ENABLED,   /**< Indicates the control should be displayed and enabled */
00026     DISABLED   /**< Indicates the control should be displayed but disabled */
00027 } UIControlStateType;
00028 
00029 //
00030 // This class is the base class intended to manage the credential data being
00031 // requested from client applications.  It will manage the setup and data
00032 // needed to support the various credential requests.
00033 //
00034 
00035 
00036 class VPN_VPNAPI ConnectPromptInfoBase
00037 {
00038     protected:
00039 
00040         ConnectPromptType getConnectPromptType() const;
00041 
00042         unsigned int countPromptEntry() const;
00043 
00044         const tstring &getMessage() const;
00045 
00046         const std::list<tstring> &getListPromptNames(
00047                                    std::list<tstring> &listPromptNames) const;
00048 
00049         PromptEntry *getPromptEntry(const tstring &promptName) const;
00050 
00051         const std::list<PromptEntry *> &getListPromptEntry() const;
00052 
00053         bool hasAuthenticationError() const;
00054 
00055         const tstring &getSubmitButtonName() const;
00056 
00057         bool hasEnrollmentCA() const;
00058 
00059         void setUseEnrollmentCA(bool bUseEnrollmentCA);
00060 
00061         bool isEmpty() const;
00062 
00063     public:
00064 
00065         // set the button to be used for submitting user responses
00066         //
00067         void setSubmitButtonName(const tstring &buttonName);
00068 
00069         void setConnectPromptType(ConnectPromptType connectPromptType);
00070 
00071         bool isCanceled() const;
00072 
00073         void setCanceled(bool bIsCanceled);
00074 
00075         // BUGBUG: Cwrapper/API and COM API need to be updated with getResponseError and setResponseError
00076         UserResponseError getResponseError() const;
00077     
00078         void setResponseError(UserResponseError err);
00079     
00080         void setMessage(tstring message);
00081 
00082         void setAuthenticationError(int iAuthError);
00083         int getAuthenticationError() const;
00084 
00085         void setAuthenticationErrorMessage(const tstring &authErrorMessage);
00086         tstring  getAuthenticationErrorMessage() const;
00087 
00088         // PromptEntry objects added using this method will be managed
00089         // by this object.  This can include deletion.
00090         //
00091         void addPromptEntry(PromptEntry *promptEntry);
00092         void insertPromptEntry(PromptEntry *promptEntry);
00093         void removeMatchingPromptEntry(PromptType promptType);
00094         void clearPasswordData();
00095 
00096         void setHasEnrollmentCA(bool bHasEnrollmentCA);
00097 
00098         bool useEnrollmentCA() const;
00099 
00100         
00101         // determine if request originated as web or standalone
00102         //
00103         void setAgentRequest(bool agentRequest);
00104 
00105         bool isAgentRequest() const;
00106 
00107         bool isAutoSubmit() const;
00108         void setAutoSubmit(bool bIsAutoSubmit);
00109 
00110         // Set actively selected group.
00111         // This method will update the value and enabled properties of the
00112         // contained credential PromptEntry objects.
00113         //
00114         bool setTunnelGroup(const tstring &group);
00115 
00116 
00117         // reset the contents of this object back to initialized state.
00118         // This method removes all data currently in this object instance.
00119         //
00120         void reset();
00121 
00122         // is this instance empty or is there some useable data
00123         //
00124         bool valid() const;
00125 
00126         void setButtonState(UIControlStateType state) {me_buttonState = state;};
00127         UIControlStateType getButtonState() {return me_buttonState;};
00128 
00129         // generate a formatted output of PromptEntry contents.
00130         //
00131         tstring toString() const;
00132 
00133         ConnectPromptInfoBase(tstring defaultSubmitButtonName);
00134         explicit ConnectPromptInfoBase(const ConnectPromptInfoBase &copyCtor);
00135         ConnectPromptInfoBase& operator=(const ConnectPromptInfoBase &inst);
00136         virtual ~ConnectPromptInfoBase();
00137 
00138     private:
00139         tstring mso_defaultMessage;
00140         tstring mso_certificateMessage;
00141         tstring mso_authErrorMessage;
00142         tstring ms_defaultSubmitButtonName;
00143         tstring ms_SubmitButtonName;
00144 
00145         std::list<PromptEntry *> mlo_PromptEntry;
00146 
00147         ConnectPromptType me_ConnectPromptType;
00148 
00149         bool mb_isCanceled;
00150         UserResponseError m_responseError;
00151         int  mi_AuthenticationError;
00152         bool mb_HasEnrollmentCA;
00153         bool mb_UseEnrollmentCA;
00154         bool mb_AgentRequest;
00155         bool mb_isAutoSubmit;
00156 
00157         UIControlStateType me_buttonState;
00158 
00159 };
00160 
00161 
00162 #endif // _CONNECTPROMPTINFOBASE_