AnyConnect Secure Mobility Client 5.1.9.113

include/PromptEntry.h

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