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