AnyConnect Secure Mobility Client 4.4.00243

include/PreferenceBase.h

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 
00094         static const tstring Automatic;
00095         static const tstring SoftwareToken;
00096         static const tstring HardwareToken;
00097 
00098         static const tstring SingleLogon;
00099         static const tstring SingleLocalLogon;
00100 
00101         static const tstring LocalUsersOnly;
00102         static const tstring AllowRemoteUsers;
00103 
00104         static const tstring ProxyNative;
00105         static const tstring ProxyIgnoreProxy;
00106         static const tstring ProxyOverride;
00107 
00108         static const tstring PPPExclusionAutomatic;
00109         static const tstring PPPExclusionDisable;
00110         static const tstring PPPExclusionOverride;
00111 
00112         static const tstring Connect;
00113         static const tstring Pause;
00114         static const tstring Disconnect;
00115         static const tstring DoNothing;
00116 
00117         static const tstring SameUserOnly;
00118         static const tstring AnyUser;
00119 
00120         static const tstring PasswordComplexityAlpha;
00121         static const tstring PasswordComplexityPin;
00122         static const tstring PasswordComplexityStrong;
00123 
00124         static const tstring Open;
00125         static const tstring Closed;
00126 
00127         static const tstring IPv4;
00128         static const tstring IPv6;
00129         static const tstring IPv4_IPv6;
00130         static const tstring IPv6_IPv4;
00131         
00132     private:
00133         PreferenceId me_preferenceId;
00134         PromptEntry* m_pPromptEntry;
00135         PreferenceList m_childPreferences;
00136         PreferenceScope me_preferenceScope;
00137         bool mb_attributes[ATTRIBUTE_COUNT];
00138         
00139         static const char* sm_attributeStrs[];
00140         static const DEFAULT_PREFERENCE sm_defaultPreferences[];
00141 };
00142 
00143 #endif // _PREFERENCEBASE_