AnyConnect Secure Mobility Client 4.4.00243

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 
00062     public:
00063 
00064         // set the button to be used for submitting user responses
00065         //
00066         void setSubmitButtonName(const tstring &buttonName);
00067 
00068         void setConnectPromptType(ConnectPromptType connectPromptType);
00069 
00070         bool isCanceled() const;
00071 
00072         void setCanceled(bool bIsCanceled);
00073 
00074         void setMessage(tstring message);
00075 
00076         void setAuthenticationError(int miAuthError);
00077         int  getAuthenticationError() const;
00078 
00079         // PromptEntry objects added using this method will be managed
00080         // by this object.  This can include deletion.
00081         //
00082         void addPromptEntry(PromptEntry *promptEntry);
00083         void insertPromptEntry(PromptEntry *promptEntry);
00084 
00085         void setHasEnrollmentCA(bool bHasEnrollmentCA);
00086 
00087         bool useEnrollmentCA() const;
00088 
00089         
00090         // determine if request originated as web or standalone
00091         //
00092         void setAgentRequest(bool agentRequest);
00093 
00094         bool isAgentRequest() const;
00095 
00096         // Set actively selected group.
00097         // This method will update the value and enabled properties of the
00098         // contained credential PromptEntry objects.
00099         //
00100         bool setTunnelGroup(const tstring &group);
00101 
00102 
00103         // reset the contents of this object back to initialized state.
00104         // This method removes all data currently in this object instance.
00105         //
00106         void reset();
00107 
00108         // is this instance empty or is there some useable data
00109         //
00110         bool valid() const;
00111 
00112         void setButtonState(UIControlStateType state) {me_buttonState = state;};
00113         UIControlStateType getButtonState() {return me_buttonState;};
00114 
00115         // generate a formatted output of PromptEntry contents.
00116         //
00117         tstring toString() const;
00118 
00119         ConnectPromptInfoBase(tstring defaultSubmitButtonName);
00120         explicit ConnectPromptInfoBase(const ConnectPromptInfoBase &copyCtor);
00121         ConnectPromptInfoBase& operator=(const ConnectPromptInfoBase &inst);
00122         virtual ~ConnectPromptInfoBase();
00123 
00124     private:
00125         tstring mso_defaultMessage;
00126         tstring mso_certificateMessage;
00127         tstring ms_defaultSubmitButtonName;
00128         tstring ms_SubmitButtonName;
00129 
00130         std::list<PromptEntry *> mlo_PromptEntry;
00131 
00132         ConnectPromptType me_ConnectPromptType;
00133 
00134         bool mb_isCanceled;
00135         int  mi_AuthenticationError;
00136         bool mb_HasEnrollmentCA;
00137         bool mb_UseEnrollmentCA;
00138         bool mb_AgentRequest;
00139 
00140         UIControlStateType me_buttonState;
00141 
00142 };
00143 
00144 
00145 #endif // _CONNECTPROMPTINFOBASE_