![]() |
AnyConnect Secure Mobility Client 5.1.9.113
|
00001 /************************************************************************** 00002 * Copyright (c) 2008, 2021-2022 Cisco Systems, Inc. 00003 * All Rights Reserved. Cisco Highly Confidential. 00004 *************************************************************************** 00005 * 00006 * File: PreferenceBase.h 00007 * Date: 7/2008 00008 * 00009 *************************************************************************** 00010 * Preferences Base class declaration for the Client API. 00011 ***************************************************************************/ 00012 00013 #ifndef _PREFERENCEBASE_ 00014 #define _PREFERENCEBASE_ 00015 00016 #include "api.h" 00017 #include <list> 00018 #include <vector> 00019 #include "PromptEntry.h" 00020 00021 class Preference; 00022 struct DEFAULT_PREFERENCE; 00023 00024 enum PreferenceAttribute 00025 { 00026 Available, 00027 UserControllable, 00028 UserControlAllowed, 00029 PostAuthVerification, 00030 UnknownAttribute 00031 }; 00032 00033 #define PREFERENCE_COUNT UnknownPreference 00034 #define ATTRIBUTE_COUNT UnknownAttribute 00035 00036 typedef std::list<Preference*> PreferenceList; 00037 00038 class VPN_VPNAPI PreferenceBase 00039 { 00040 00041 protected: 00042 00043 PreferenceBase(PreferenceId preferenceId, 00044 const tstring& label, 00045 PromptType prefType, 00046 const tstring& initialValue, 00047 ApiStringMap* pOptions = NULL, 00048 Preference* pParent = NULL); 00049 00050 public: 00051 00052 const PreferenceId& getPreferenceId() const; 00053 PreferenceScope getPreferenceScope() const; 00054 00055 const tstring& getPreferenceValue() const; 00056 bool setPreferenceValue(const tstring& value); 00057 00058 bool getPreferenceAttribute(const PreferenceAttribute& attribute); 00059 void setPreferenceAttribute(const PreferenceAttribute& attribute, bool value); 00060 00061 const PreferenceList& getChildren() const; 00062 00063 void addChildPreference(Preference* pPref); 00064 void removeChildPreference(Preference* pPref); 00065 00066 PromptEntry* getPromptEntry() const; 00067 00068 static Preference* createPreferenceFromId(PreferenceId prefId); 00069 00070 static tstring getPreferenceNameFromId(PreferenceId prefId); 00071 static PreferenceId getPreferenceIdFromName(const tstring& name); 00072 static PreferenceAttribute getAttributeIdFromName(const tstring& attributeName); 00073 static tstring getAttributeNameFromId(const PreferenceAttribute attrId); 00074 static PreferenceId getParentId(const PreferenceId prefId); 00075 static PreferenceScope getPreferenceScopeFromId(PreferenceId prefId); 00076 static tstring getDefaultValue(PreferenceId prefId); 00077 static bool getDefaultAttribute(PreferenceId prefId, 00078 PreferenceAttribute attribute); 00079 static bool isParentPreference(const PreferenceId prefId); 00080 static bool isPreferenceDefined(const PreferenceId prefId); 00081 static bool isValidPreference(const PreferenceId prefId); 00082 00083 /* 00084 * Deep Copy Assignment Operator 00085 */ 00086 PreferenceBase& operator=(const PreferenceBase& existingPref) 00087 { 00088 return deepCopy(existingPref); 00089 } 00090 /* 00091 * Deep Copy Constructor 00092 */ 00093 explicit PreferenceBase(const PreferenceBase& existingPref) 00094 { 00095 deepCopy(existingPref); 00096 } 00097 virtual ~PreferenceBase(); 00098 00099 static const tstring PreferenceEnabled; 00100 static const tstring PreferenceDisabled; 00101 00102 static const tstring DisconnectOnSuspend; 00103 static const tstring ReconnectAfterResume; 00104 00105 static const tstring AllStores; 00106 static const tstring MachineStore; 00107 static const tstring UserStore; 00108 static const tstring SystemStore; 00109 static const tstring LoginStore; 00110 static const tstring UserFirefoxNSS; 00111 static const tstring UserPEMFile; 00112 00113 static const tstring Automatic; 00114 static const tstring SoftwareToken; 00115 static const tstring HardwareToken; 00116 00117 static const tstring SingleLogon; 00118 static const tstring SingleLocalLogon; 00119 static const tstring SingleLogonNoRemote; 00120 00121 static const tstring LocalUsersOnly; 00122 static const tstring AllowRemoteUsers; 00123 00124 static const tstring ProxyNative; 00125 static const tstring ProxyIgnoreProxy; 00126 static const tstring ProxyOverride; 00127 00128 static const tstring PPPExclusionAutomatic; 00129 static const tstring PPPExclusionDisable; 00130 static const tstring PPPExclusionOverride; 00131 00132 static const tstring Connect; 00133 static const tstring Pause; 00134 static const tstring Disconnect; 00135 static const tstring DoNothing; 00136 00137 static const tstring SameUserOnly; 00138 static const tstring AnyUser; 00139 00140 static const tstring PasswordComplexityAlpha; 00141 static const tstring PasswordComplexityPin; 00142 static const tstring PasswordComplexityStrong; 00143 00144 static const tstring Open; 00145 static const tstring Closed; 00146 00147 static const tstring IPv4; 00148 static const tstring IPv6; 00149 static const tstring IPv4_IPv6; 00150 static const tstring IPv6_IPv4; 00151 00152 private: 00153 PreferenceBase& deepCopy(const PreferenceBase& existingPref); 00154 00155 PreferenceId me_preferenceId; 00156 PromptEntry* m_pPromptEntry; 00157 PreferenceList m_childPreferences; 00158 PreferenceScope me_preferenceScope; 00159 bool mb_attributes[ATTRIBUTE_COUNT]; 00160 00161 static const char* sm_attributeStrs[]; 00162 static const DEFAULT_PREFERENCE sm_defaultPreferences[]; 00163 }; 00164 00165 #endif // _PREFERENCEBASE_