AnyConnect Secure Mobility Client  4.10.06090
PreferenceBase.h
1 /**************************************************************************
2 * Copyright (c) 2008, 2021 Cisco Systems, Inc.
3 * All Rights Reserved. Cisco 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{Available,
25  UserControllable,
26  UserControlAllowed,
27  PostAuthVerification,
28  UnknownAttribute};
29 
30 #define PREFERENCE_COUNT UnknownPreference
31 #define ATTRIBUTE_COUNT UnknownAttribute
32 
33 typedef std::list<Preference*> PreferenceList;
34 
35 class VPN_VPNAPI PreferenceBase
36 {
37 
38  protected:
39 
40  PreferenceBase(PreferenceId preferenceId,
41  const tstring& label,
42  PromptType prefType,
43  const tstring& initialValue,
44  ApiStringMap* pOptions = NULL,
45  Preference* pParent = NULL);
46 
47  public:
48 
49  const PreferenceId& getPreferenceId() const;
50  PreferenceScope getPreferenceScope() const;
51 
52  const tstring& getPreferenceValue() const;
53  bool setPreferenceValue(const tstring& value);
54 
55  bool getPreferenceAttribute(const PreferenceAttribute& attribute);
56  void setPreferenceAttribute(const PreferenceAttribute& attribute, bool value);
57 
58  const PreferenceList& getChildren() const;
59 
60  void addChildPreference(Preference* pPref);
61  void removeChildPreference(Preference* pPref);
62 
63  PromptEntry* getPromptEntry() const;
64 
65  static Preference* createPreferenceFromId(PreferenceId prefId);
66 
67  static tstring getPreferenceNameFromId(PreferenceId prefId);
68  static PreferenceId getPreferenceIdFromName(const tstring& name);
69  static PreferenceAttribute getAttributeIdFromName(const tstring& attributeName);
70  static tstring getAttributeNameFromId(const PreferenceAttribute attrId);
71  static PreferenceId getParentId(const PreferenceId prefId);
72  static PreferenceScope getPreferenceScopeFromId(PreferenceId prefId);
73  static tstring getDefaultValue(PreferenceId prefId);
74  static bool getDefaultAttribute(PreferenceId prefId,
75  PreferenceAttribute attribute);
76  static bool isParentPreference(const PreferenceId prefId);
77  static bool isPreferenceDefined(const PreferenceId prefId);
78  static bool isValidPreference(const PreferenceId prefId);
79 
80  PreferenceBase& operator=(const PreferenceBase&);
81  explicit PreferenceBase(const PreferenceBase&);
82  ~PreferenceBase();
83 
84  static const tstring PreferenceEnabled;
85  static const tstring PreferenceDisabled;
86 
87  static const tstring DisconnectOnSuspend;
88  static const tstring ReconnectAfterResume;
89 
90  static const tstring AllStores;
91  static const tstring MachineStore;
92  static const tstring UserStore;
93  static const tstring SystemStore;
94  static const tstring LoginStore;
95  static const tstring UserFirefoxNSS;
96  static const tstring UserPEMFile;
97 
98  static const tstring Automatic;
99  static const tstring SoftwareToken;
100  static const tstring HardwareToken;
101 
102  static const tstring SingleLogon;
103  static const tstring SingleLocalLogon;
104  static const tstring SingleLogonNoRemote;
105 
106  static const tstring LocalUsersOnly;
107  static const tstring AllowRemoteUsers;
108 
109  static const tstring ProxyNative;
110  static const tstring ProxyIgnoreProxy;
111  static const tstring ProxyOverride;
112 
113  static const tstring PPPExclusionAutomatic;
114  static const tstring PPPExclusionDisable;
115  static const tstring PPPExclusionOverride;
116 
117  static const tstring Connect;
118  static const tstring Pause;
119  static const tstring Disconnect;
120  static const tstring DoNothing;
121 
122  static const tstring SameUserOnly;
123  static const tstring AnyUser;
124 
125  static const tstring PasswordComplexityAlpha;
126  static const tstring PasswordComplexityPin;
127  static const tstring PasswordComplexityStrong;
128 
129  static const tstring Open;
130  static const tstring Closed;
131 
132  static const tstring IPv4;
133  static const tstring IPv6;
134  static const tstring IPv4_IPv6;
135  static const tstring IPv6_IPv4;
136 
137  private:
138  PreferenceId me_preferenceId;
139  PromptEntry* m_pPromptEntry;
140  PreferenceList m_childPreferences;
141  PreferenceScope me_preferenceScope;
142  bool mb_attributes[ATTRIBUTE_COUNT];
143 
144  static const char* sm_attributeStrs[];
145  static const DEFAULT_PREFERENCE sm_defaultPreferences[];
146 };
147 
148 #endif // _PREFERENCEBASE_
#define tstring
Definition: api.h:35
Definition: PreferenceBase.h:35
PreferenceScope
Definition: api.h:504
PreferenceId
Definition: api.h:274
Definition: PromptEntry.h:40
PromptType
Definition: api.h:249
Definition: Preference.h:28