| AnyConnect Secure Mobility Client 5.0.00556

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# include/PromptEntryBase.h

    00001 /**************************************************************************
    00002 *       Copyright (c) 2008, Cisco Systems, All Rights Reserved
    00003 ***************************************************************************
    00004 *
    00005 *  File:    PromptEntryBase.h
    00006 *  Date:    01/2008
    00007 *
    00008 ***************************************************************************
    00009 *
    00010 *   Prompt Entry base class implementation for the Client API.
    00011 *
    00012 ***************************************************************************/
    00013
    00014 #ifndef _PROMPTENTRYBASE_
    00015 #define _PROMPTENTRYBASE_
    00016
    00017
    00018 #include "api.h"
    00019 #include <list>
    00020
    00021
    00022 #define PROMPT_ENTRY_VALUE_TRUE  _T("true")
    00023 #define PROMPT_ENTRY_VALUE_FALSE  _T("false")
    00024
    00025 class VPN_VPNAPI PromptEntryBase
    00026 {
    00027     public:
    00028
    00029         bool setValue(const tstring& value);
    00030         bool clearValue();
    00031
    00032         const tstring &getPromptName() const;
    00033
    00034         const tstring &getPromptLabel() const;
    00035
    00036         bool isEnabled() const;
    00037
    00038         void setEnabled(bool bIsEnabled);
    00039
    00040         bool isVisible() const;
    00041
    00042         void setVisible(bool bIsVisible);
    00043
    00044         // if this is a PromptEntry that has a list of values
    00045         // (e.g. combo box style) the default will be to mark it as a group
    00046         // combo.  This method allows the group designation to be set directly.
    00047         //
    00048         void setEntryGroup(bool bIsEntryGroup);
    00049
    00050
    00051         PromptEntryBase(tstring PromptName,
    00052                         tstring PromptLabel,
    00053                         PromptType promptType = Prompt_Input,
    00054                         const tstring& DefaultValue = EmptyString,
    00055                         ApiStringMap LabelValues = EmptyLabelValues);
    00056
    00057
    00058         void setPromptLabel(tstring label);
    00059
    00060         // In cases of prompt types with options (checkbox, combobox),
    00061         // this will return the translated label (of the option).
    00062         const tstring &getValue() const;
    00063
    00064         // this function returns the internal representation of the value
    00065         const tstring &getTrueValue() const;
    00066
    00067         const std::list<tstring> &getValueOptions() const;
    00068
    00069         bool isEntryGroup() const;
    00070
    00071         bool isReadOnly() const;
    00072
    00073         PromptType getPromptType() const;
    00074
    00075         size_t GetGroupAttributesCount();
    00076
    00077
    00078         ~PromptEntryBase();
    00079
    00080         static const tstring EmptyString;
    00081
    00082         static const std::list<tstring> EmptyList;
    00083
    00084         static const ApiStringMap EmptyLabelValues;
    00085
    00086         PromptEntryBase& operator=(const PromptEntryBase& assignmentOperator);
    00087
    00088         PromptEntryBase(const PromptEntryBase& existingEntry);
    00089
    00090
    00091     private:
    00092
    00093         tstring ms_PromptName;
    00094
    00095         tstring ms_PromptLabel;
    00096
    00097         PromptType me_PromptType;
    00098
    00099         tstring ms_Value;
    00100
    00101         ApiStringMap msm_LabelValueMap;
    00102
    00103         std::list<tstring> mls_ValueOptions;
    00104
    00105         bool mb_IsEntryGroup;
    00106
    00107         bool mb_Enabled;
    00108
    00109         bool mb_Visible;
    00110
    00111     public:
    00112
    00113         class GroupAttributes
    00114         {
    00115         public:
    00116             GroupAttributes() :
    00117               CredRequired(true),
    00118               UsesSDIAuth(false),
    00119               UsernameEditable(true),
    00120               Username(),
    00121               SecondaryUsernameEditable(true),
    00122               SecondaryUsername(),
    00123               UsesSecondaryAuth(false) {}
    00124
    00125             bool CredRequired;
    00126             bool UsesSDIAuth;
    00127             bool UsernameEditable;
    00128             tstring Username;
    00129             bool SecondaryUsernameEditable;
    00130             tstring SecondaryUsername;
    00131             bool UsesSecondaryAuth;
    00132         };
    00133
    00134         class SingleAttributes
    00135         {
    00136         public:
    00137             SingleAttributes() :
    00138               SecondaryAuthEntry(false),
    00139               SSOTimeoutSeconds(0),
    00140               SSOIsExternalBrowser(false) {}
    00141
    00142             bool SecondaryAuthEntry;
    00143             tstring SSOURL;
    00144             tstring SSOFinalURL;
    00145             tstring SSOTokenCookieName;
    00146             tstring SSOErrorCookieName;
    00147             unsigned int SSOTimeoutSeconds;
    00148             tstring SSOUserAgent;
    00149             bool SSOIsExternalBrowser;
    00150         };
    00151
    00152         typedef std::map<tstring, GroupAttributes> GroupAttributeMap;
    00153
    00154         const GroupAttributes& getGroupAttributes(const tstring& group) const;
    00155         void setGroupAttributeMap(const GroupAttributeMap& groupAttributeMap);
    00156
    00157         const SingleAttributes& getSingleAttributes() const;
    00158         void setSingleAttributes(const SingleAttributes& singleAttributes);
    00159
    00160     private:
    00161
    00162         void copyGroupAttributeMap (const GroupAttributeMap &source,
    00163                                     GroupAttributeMap &destination);
    00164         static const GroupAttributes DefaultGroupAttributes;
    00165         GroupAttributeMap m_GroupAttributeMap;
    00166
    00167         SingleAttributes m_SingleAttributes;
    00168 };
    00169
    00170
    00171 #endif // _PROMPTENTRYBASE_