AnyConnect Secure Mobility Client 4.4.00243

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 the count of any available PromptEntry objects.
00065          * Each PromptEntry object, typically, represents a credential whose
00066          * value the client must set before calling the UserSubmit method.
00067          */
00068         unsigned int countPromptEntry() const;
00069 
00070 
00071         /**
00072          * Return the string if any, related to the credentials for which
00073          * the user is being prompted.
00074          */
00075         const tstring &getMessage() const;
00076 
00077 
00078         /**
00079          * Retrieve a list of any available prompt names.
00080          */
00081         const std::list<tstring> &getListPromptNames(
00082                                    std::list<tstring> &listPromptNames) const;
00083 
00084 
00085         /**
00086          * Retrieve a PromptEntry instance by name.  The list of names can
00087          * be obtained using getListPromptNames method. 
00088          * 
00089          * See the ::PromptType enum found in api.h for valid PromptEntry
00090          * types (except for Prompt_Checkbox which is used by the Preference
00091          * class).
00092          */
00093         PromptEntry *getPromptEntry(const tstring &promptName) const;
00094 
00095 
00096         /**
00097          * Retrieve the entire list of PromptEntry objects.
00098          */
00099         const std::list<PromptEntry *> &getListPromptEntry() const;
00100 
00101         /**
00102          * If an error during authentication is detected,
00103          * this method returns true.
00104          */
00105         bool hasAuthenticationError() const;
00106 
00107         /**
00108          * If an error during authentication is detected,
00109          * this method returns the auth error code.
00110          */
00111         int getAuthenticationError() const;
00112 
00113         /**
00114          * Get the name to be used for the button used to submit user responses
00115          * (For example, Connect, Submit)
00116          */
00117         const tstring &getSubmitButtonName() const;
00118 
00119 
00120         /**
00121          * Indicates that an enrollment Certificate Authority (CA) is
00122          * available.
00123          */
00124         bool hasEnrollmentCA() const;
00125 
00126 
00127         /**
00128          * Set to true to indicate that we want to retrieve a
00129          * certificate from the CA.
00130          */
00131         void setUseEnrollmentCA(bool bUseEnrollmentCA);
00132 
00133         /**
00134          * Set the actively selected group.
00135          * This method will update the value and enabled properties of the
00136          * contained credential PromptEntry objects.
00137          */
00138         bool setTunnelGroup(const tstring &group);
00139 
00140         ConnectPromptInfo(tstring defaultSubmitButtonName);
00141         virtual ~ConnectPromptInfo();
00142 
00143 };
00144 
00145 
00146 #endif // _CONNECTPROMPTINFO_