| AnyConnect Secure Mobility Client 5.1.16.194

PreferenceBase.h
1 /**************************************************************************
2 * Copyright (c) 2008, 2021-2022 Cisco Systems, Inc.
3 * All Rights Reserved. Cisco Highly Confidential.
4 ***************************************************************************
5 *
6 * File: PreferenceBase.h
7 * Date: 7/2008
8 *
9 ***************************************************************************
10 * Preferences Base class declaration for the Client API.
11 ***************************************************************************/
12
13 #ifndef _PREFERENCEBASE_
14 #define _PREFERENCEBASE_
15
16 #include "api.h"
17 #include <list>
18 #include <vector>
19 #include "PromptEntry.h"
20
21 class Preference;
22 struct DEFAULT_PREFERENCE;
23
24 enum PreferenceAttribute
25 {
26 Available,
27 UserControllable,
28 UserControlAllowed,
29 PostAuthVerification,
30 UnknownAttribute
31 };
32
33 #define PREFERENCE_COUNT UnknownPreference
34 #define ATTRIBUTE_COUNT UnknownAttribute
35
36 typedef std::list<Preference*> PreferenceList;
37
38 class VPN_VPNAPI PreferenceBase
39 {
40
41 protected:
42
43 PreferenceBase(PreferenceId preferenceId,
44 const tstring& label,
45 PromptType prefType,
46 const tstring& initialValue,
47 ApiStringMap* pOptions = NULL,
48 Preference* pParent = NULL);
49
50 public:
51
52 const PreferenceId& getPreferenceId() const;
53 PreferenceScope getPreferenceScope() const;
54
55 const tstring& getPreferenceValue() const;
56 bool setPreferenceValue(const tstring& value);
57
58 bool getPreferenceAttribute(const PreferenceAttribute& attribute);
59 void setPreferenceAttribute(const PreferenceAttribute& attribute, bool value);
60
61 const PreferenceList& getChildren() const;
62
63 void addChildPreference(Preference* pPref);
64 void removeChildPreference(Preference* pPref);
65
66 PromptEntry* getPromptEntry() const;
67
68 static Preference* createPreferenceFromId(PreferenceId prefId);
69
70 static tstring getPreferenceNameFromId(PreferenceId prefId);
71 static PreferenceId getPreferenceIdFromName(const tstring& name);
72 static PreferenceAttribute getAttributeIdFromName(const tstring& attributeName);
73 static tstring getAttributeNameFromId(const PreferenceAttribute attrId);
74 static PreferenceId getParentId(const PreferenceId prefId);
75 static PreferenceScope getPreferenceScopeFromId(PreferenceId prefId);
76 static tstring getDefaultValue(PreferenceId prefId);
77 static bool getDefaultAttribute(PreferenceId prefId,
78 PreferenceAttribute attribute);
79 static bool isParentPreference(const PreferenceId prefId);
80 static bool isPreferenceDefined(const PreferenceId prefId);
81 static bool isValidPreference(const PreferenceId prefId);
82
83 /*
84 * Deep Copy Assignment Operator
85 */
86 PreferenceBase& operator=(const PreferenceBase& existingPref)
87 {
88 return deepCopy(existingPref);
89 }
90 /*
91 * Deep Copy Constructor
92 */
93 explicit PreferenceBase(const PreferenceBase& existingPref)
94 {
95 deepCopy(existingPref);
96 }
97 virtual ~PreferenceBase();
98
99 static const tstring PreferenceEnabled;
100 static const tstring PreferenceDisabled;
101
102 static const tstring DisconnectOnSuspend;
103 static const tstring ReconnectAfterResume;
104
105 static const tstring AllStores;
106 static const tstring MachineStore;
107 static const tstring UserStore;
108 static const tstring SystemStore;
109 static const tstring LoginStore;
110 static const tstring UserFirefoxNSS;
111 static const tstring UserPEMFile;
112
113 static const tstring Automatic;
114 static const tstring SoftwareToken;
115 static const tstring HardwareToken;
116
117 static const tstring SingleLogon;
118 static const tstring SingleLocalLogon;
119 static const tstring SingleLogonNoRemote;
120
121 static const tstring LocalUsersOnly;
122 static const tstring AllowRemoteUsers;
123
124 static const tstring ProxyNative;
125 static const tstring ProxyIgnoreProxy;
126 static const tstring ProxyOverride;
127
128 static const tstring PPPExclusionAutomatic;
129 static const tstring PPPExclusionDisable;
130 static const tstring PPPExclusionOverride;
131
132 static const tstring Connect;
133 static const tstring Pause;
134 static const tstring Disconnect;
135 static const tstring DoNothing;
136
137 static const tstring SameUserOnly;
138 static const tstring AnyUser;
139
140 static const tstring PasswordComplexityAlpha;
141 static const tstring PasswordComplexityPin;
142 static const tstring PasswordComplexityStrong;
143
144 static const tstring Open;
145 static const tstring Closed;
146
147 static const tstring IPv4;
148 static const tstring IPv6;
149 static const tstring IPv4_IPv6;
150 static const tstring IPv6_IPv4;
151
152 private:
153 PreferenceBase& deepCopy(const PreferenceBase& existingPref);
154
155 PreferenceId me_preferenceId;
156 PromptEntry* m_pPromptEntry;
157 PreferenceList m_childPreferences;
158 PreferenceScope me_preferenceScope;
159 bool mb_attributes[ATTRIBUTE_COUNT];
160
161 static const char* sm_attributeStrs[];
162 static const DEFAULT_PREFERENCE sm_defaultPreferences[];
163 };
164
165 #endif // _PREFERENCEBASE_
api.h
tstring
#define tstring
Definition: api.h:35
PreferenceBase
Definition: PreferenceBase.h:38
PreferenceScope
PreferenceScope
Definition: api.h:530
PreferenceId
PreferenceId
Definition: api.h:294
PromptEntry
Definition: PromptEntry.h:39
PromptType
PromptType
Definition: api.h:269
Preference
Definition: Preference.h:27