AnyConnect Secure Mobility Client 5.0.00556

include/PreferenceBase.h

00001 /**************************************************************************
00002 *   Copyright (c) 2008, 2021 Cisco Systems, Inc.
00003 *   All Rights Reserved. Cisco 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{Available,            
00025                          UserControllable,     
00026                          UserControlAllowed,
00027                          PostAuthVerification, 
00028                          UnknownAttribute};
00029 
00030 #define PREFERENCE_COUNT UnknownPreference
00031 #define ATTRIBUTE_COUNT UnknownAttribute
00032 
00033 typedef std::list<Preference*> PreferenceList;
00034 
00035 class VPN_VPNAPI PreferenceBase
00036 {
00037 
00038     protected:
00039      
00040         PreferenceBase(PreferenceId preferenceId,
00041                        const tstring& label,
00042                        PromptType prefType,
00043                        const tstring& initialValue,
00044                        ApiStringMap* pOptions = NULL,
00045                        Preference* pParent = NULL);
00046 
00047     public:
00048 
00049         const PreferenceId& getPreferenceId() const;
00050         PreferenceScope getPreferenceScope() const;
00051 
00052         const tstring& getPreferenceValue() const;
00053         bool setPreferenceValue(const tstring& value);
00054 
00055         bool getPreferenceAttribute(const PreferenceAttribute& attribute); 
00056         void setPreferenceAttribute(const PreferenceAttribute& attribute, bool value);
00057 
00058         const PreferenceList& getChildren() const; 
00059         
00060         void addChildPreference(Preference* pPref);
00061         void removeChildPreference(Preference* pPref);
00062      
00063         PromptEntry* getPromptEntry() const;
00064 
00065         static Preference* createPreferenceFromId(PreferenceId prefId);
00066         
00067         static tstring getPreferenceNameFromId(PreferenceId prefId);
00068         static PreferenceId getPreferenceIdFromName(const tstring& name);
00069         static PreferenceAttribute getAttributeIdFromName(const tstring& attributeName);
00070         static tstring getAttributeNameFromId(const PreferenceAttribute attrId);
00071         static PreferenceId getParentId(const PreferenceId prefId);
00072         static PreferenceScope getPreferenceScopeFromId(PreferenceId prefId);
00073         static tstring getDefaultValue(PreferenceId prefId);
00074         static bool getDefaultAttribute(PreferenceId prefId, 
00075                                         PreferenceAttribute attribute);
00076         static bool isParentPreference(const PreferenceId prefId);
00077         static bool isPreferenceDefined(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         static const tstring UserFirefoxNSS;
00096         static const tstring UserPEMFile;
00097 
00098         static const tstring Automatic;
00099         static const tstring SoftwareToken;
00100         static const tstring HardwareToken;
00101 
00102         static const tstring SingleLogon;
00103         static const tstring SingleLocalLogon;
00104         static const tstring SingleLogonNoRemote;
00105 
00106         static const tstring LocalUsersOnly;
00107         static const tstring AllowRemoteUsers;
00108 
00109         static const tstring ProxyNative;
00110         static const tstring ProxyIgnoreProxy;
00111         static const tstring ProxyOverride;
00112 
00113         static const tstring PPPExclusionAutomatic;
00114         static const tstring PPPExclusionDisable;
00115         static const tstring PPPExclusionOverride;
00116 
00117         static const tstring Connect;
00118         static const tstring Pause;
00119         static const tstring Disconnect;
00120         static const tstring DoNothing;
00121 
00122         static const tstring SameUserOnly;
00123         static const tstring AnyUser;
00124 
00125         static const tstring PasswordComplexityAlpha;
00126         static const tstring PasswordComplexityPin;
00127         static const tstring PasswordComplexityStrong;
00128 
00129         static const tstring Open;
00130         static const tstring Closed;
00131 
00132         static const tstring IPv4;
00133         static const tstring IPv6;
00134         static const tstring IPv4_IPv6;
00135         static const tstring IPv6_IPv4;
00136         
00137     private:
00138         PreferenceId me_preferenceId;
00139         PromptEntry* m_pPromptEntry;
00140         PreferenceList m_childPreferences;
00141         PreferenceScope me_preferenceScope;
00142         bool mb_attributes[ATTRIBUTE_COUNT];
00143         
00144         static const char* sm_attributeStrs[];
00145         static const DEFAULT_PREFERENCE sm_defaultPreferences[];
00146 };
00147 
00148 #endif // _PREFERENCEBASE_