AnyConnect Secure Mobility Client 4.4.00243

include/PromptEntry.h

00001 /**************************************************************************
00002 *       Copyright (c) 2006, Cisco Systems, All Rights Reserved
00003 ***************************************************************************
00004 *
00005 *  File:    PromptEntry.h
00006 *  Date:    08/2006
00007 *
00008 ***************************************************************************
00009 *
00010 *   Prompt Entry class implementation for the Client API.
00011 *
00012 ***************************************************************************/
00013 
00014 #ifndef _PROMPTENTRY_
00015 #define _PROMPTENTRY_
00016 
00017 
00018 #include "PromptEntryBase.h"
00019 
00020 /**
00021  * When Authentication requires a user to enter credentials or view a banner in
00022  * conjunction with their VPN activation, one or more PromptEntry objects are 
00023  * created.  Each PromptEntry typically contains a label and value.  The
00024  * value can be set with a default value that the user can then change.
00025  *
00026  * PromptEntry instances are collected into a list and delivered in a single
00027  * instance of the ConnectPromptInfo class.
00028  *
00029  * When the selections or values are complete (using setValue method) for all
00030  * the PromptEntry instances, simply call the API method
00031  * ClientIfc::UserSubmit to alert the API that it can
00032  * process the responses and proceed with VPN establishment.
00033  *
00034  * An example of accessing individual PromptEntry and their values can be
00035  * found in ClientImpl::setUserData
00036  *
00037  */
00038 
00039 
00040 class VPN_VPNAPI PromptEntry : public PromptEntryBase
00041 {
00042     public:
00043 
00044         /**
00045          * use this method to get the current value set in the prompt entry.
00046          */
00047         const tstring& getValue() const;
00048 
00049         /**
00050          * use this method to set the user selection.  If a default value is
00051          * present, it's value will be used unless this method in invoked.
00052          * Returns true if the value is successfully set.
00053          */
00054         bool setValue(tstring value);
00055 
00056 
00057         /**
00058          * The fixed name associated with this prompt entry.
00059          * This represents a non-translated fixed entity, whereas the
00060          * label is a translated entry.
00061          */
00062         const tstring &getPromptName() const;
00063 
00064 
00065         /**
00066          * Set/get the label associated with this prompt entry.
00067          * This value is translated if a translation is available.
00068          */
00069         const tstring &getPromptLabel() const;
00070 
00071 
00072         /**
00073          * Return the type of prompt entry.  See the enum PromptType for
00074          * the possible types.
00075          */
00076         PromptType getPromptType() const;
00077 
00078         /**
00079          * Get the enabled state of this prompt entry which indicates if
00080          * it can be edited.
00081          */
00082         bool isEnabled() const;
00083 
00084 
00085         /**
00086          * Get the visible state of this prompt entry which indicates if
00087          * it should be displayed.
00088          */
00089         bool isVisible() const;
00090 
00091 
00092         /**
00093          * If a prompt entry has a list of possible selection, (like Prompt_Combo 
00094          * and Prompt_Checkbox in ::PromptType enum in api.h), that list is
00095          * available via this method.  For example, a checkbox type prompt 
00096          * would return "true" and "false" as options.  The values returned could for
00097          * example, be displayed in a combo box selection.
00098          */
00099         const std::list<tstring> &getValueOptions() const;
00100 
00101 
00102         /**
00103          * Use this prompt entry for group values
00104          */
00105         bool isEntryGroup() const;
00106 
00107 
00108         static tstring Username;          /**< Identifies the PromptEntry instance
00109                                                requesting a username.
00110                                                See getPromptName() method and example
00111                                                in ClientImpl::setUserData() */
00112         static tstring Password;          /**< Identifies PromptEntry instance
00113                                                requesting a password.
00114                                                See getPromptName() method and example
00115                                                in ClientImpl::setUserData() */
00116         static tstring SecondaryUsername; /**< Identifies PromptEntry instance
00117                                                requesting secondary username. */
00118         static tstring SecondaryPassword; /**< Identifies PromptEntry instance
00119                                                requesting secondary password. */
00120         static tstring GroupList;         /**< Identifies PromptEntry instance
00121                                                with group list. */
00122         static tstring Banner;            /**< Identifies PromptEntry instance
00123                                                containing banner. */
00124         static tstring Pin;              /**< Identifies PromptEntry PIN */
00125         static tstring VerifyPin;        /**< Identifies PromptEntry Verify PIN */
00126         static tstring NetAccess;        /**< Identifies the PromptEntry displaying
00127                                               the network access state. */
00128 
00129         // The following methods are used to configure the PromptEntry
00130         // and do not need to be used by a client application.
00131 
00132 
00133         PromptEntry(tstring PromptName,
00134                     tstring PromptLabel,
00135                     PromptType promptType = Prompt_Input,
00136                     tstring DefaultValue = EmptyString,
00137                     ApiStringMap LabelValues = EmptyLabelValues);
00138 
00139         ~PromptEntry();
00140 
00141 
00142 };
00143 
00144 
00145 #endif // _PROMPTENTRY_