AnyConnect Secure Mobility Client 4.8.02045

include/ConnectPromptInfo.h

00001 /**************************************************************************
00002 *       Copyright (c) 2006, Cisco Systems, All Rights Reserved
00003 ***************************************************************************
00004 *
00005 *  File:    ConnectPromptInfo.h
00006 *  Date:    08/2006
00007 *
00008 ***************************************************************************
00009 *
00010 *   Connect Prompt Info class implementation for the Client API.
00011 *
00012 ***************************************************************************/
00013 #ifndef _CONNECTPROMPTINFO_
00014 #define _CONNECTPROMPTINFO_
00015 
00016 #include "ConnectPromptInfoBase.h"
00017 
00018 class PromptEntry;
00019 
00020 /**
00021  * This class transports credential data between the client interface
00022  * and the API.  The API creates PromptEntry instances for each required
00023  * option or credential.  These PromptEntry instances can range from an
00024  * instance with group options to one containing a password prompt.
00025  *
00026  * The API automatically references the instance of this class and any
00027  * values that have been set.  When the selections or values are set,
00028  * simply call the API method ClientIfc::UserSubmit to alert
00029  * the API that it can process the responses and proceed with VPN
00030  * establishment.
00031  *
00032  * The storage and management of this class are the responsibility of the API.
00033  * No management is required on the part of a client program.
00034  */
00035 
00036 
00037 class VPN_VPNAPI ConnectPromptInfo : public ConnectPromptInfoBase
00038 {
00039 
00040     public:
00041 
00042 
00043         /**
00044          * Specifies what type of data is being requested/presented to the user:
00045          * Certificate - can be a single or list of certificates.
00046          * Proxy - indicates being prompted for proxy credentials.
00047          * Credentials - indicates being prompted for user credentials
00048          * (for example, username, password).
00049          */
00050         ConnectPromptType getConnectPromptType() const;
00051 
00052         /**
00053          * This method returns whether or not this connect prompt has been
00054          * marked as canceled by the user.
00055          */
00056         bool isCanceled() const;
00057 
00058         /**
00059          * Marks the canceled state of this connect prompt.
00060          */
00061         void setCanceled(bool bIsCanceled);
00062 
00063         /**
00064          * This method returns whether or not this connect prompt has error occurred
00065          */
00066         UserResponseError getResponseError() const;
00067     
00068         /**
00069          * Marks the error state of this connect prompt.
00070          */
00071         void setResponseError(UserResponseError err);
00072     
00073         /**
00074          * This method returns the count of any available PromptEntry objects.
00075          * Each PromptEntry object, typically, represents a credential whose
00076          * value the client must set before calling the UserSubmit method.
00077          */
00078         unsigned int countPromptEntry() const;
00079 
00080 
00081         /**
00082          * Return the string if any, related to the credentials for which
00083          * the user is being prompted.
00084          */
00085         const tstring &getMessage() const;
00086 
00087 
00088         /**
00089          * Retrieve a list of any available prompt names.
00090          */
00091         const std::list<tstring> &getListPromptNames(
00092                                    std::list<tstring> &listPromptNames) const;
00093 
00094 
00095         /**
00096          * Retrieve a PromptEntry instance by name.  The list of names can
00097          * be obtained using getListPromptNames method. 
00098          * 
00099          * See the ::PromptType enum found in api.h for valid PromptEntry
00100          * types (except for Prompt_Checkbox which is used by the Preference
00101          * class).
00102          */
00103         PromptEntry *getPromptEntry(const tstring &promptName) const;
00104 
00105 
00106         /**
00107          * Retrieve the entire list of PromptEntry objects.
00108          */
00109         const std::list<PromptEntry *> &getListPromptEntry() const;
00110 
00111         /**
00112          * If an error during authentication is detected,
00113          * this method returns true.
00114          */
00115         bool hasAuthenticationError() const;
00116 
00117         /**
00118          * If an error during authentication is detected,
00119          * this method returns the auth error code.
00120          */
00121         int getAuthenticationError() const;
00122 
00123         /**
00124          * Get the name to be used for the button used to submit user responses
00125          * (For example, Connect, Submit)
00126          */
00127         const tstring &getSubmitButtonName() const;
00128 
00129 
00130         /**
00131          * Indicates that an enrollment Certificate Authority (CA) is
00132          * available.
00133          */
00134         bool hasEnrollmentCA() const;
00135 
00136 
00137         /**
00138          * Set to true to indicate that we want to retrieve a
00139          * certificate from the CA.
00140          */
00141         void setUseEnrollmentCA(bool bUseEnrollmentCA);
00142 
00143         /**
00144          * Set the actively selected group.
00145          * This method will update the value and enabled properties of the
00146          * contained credential PromptEntry objects.
00147          */
00148         bool setTunnelGroup(const tstring &group);
00149 
00150         /**
00151          * Indicates if this object is "Empty".  This means:
00152          * -The object has no entries and no enrollmentCA (and a detail message)
00153          * -Has only disabled/invisible entries
00154          * -Has only entries of Type Prompt_Banner or Prompt_Hidden or Prompt_Header or Prompt_CheckBox
00155          * returns true if the object is "Empty" false otherwise
00156          */
00157         bool isEmpty() const;
00158 
00159         ConnectPromptInfo(tstring defaultSubmitButtonName);
00160         virtual ~ConnectPromptInfo();
00161 
00162 };
00163 
00164 
00165 #endif // _CONNECTPROMPTINFO_