AnyConnect Secure Mobility Client  4.8.02045
PreferenceBase.h
1 /**************************************************************************
2 * Copyright © 2008, Cisco Systems, All Rights Reserved
3 ***************************************************************************
4 *
5 * File: PreferenceBase.h
6 * Date: 7/2008
7 *
8 ***************************************************************************
9 *
10 * Preferences Base class declaration for the Client API.
11 *
12 ***************************************************************************/
13 
14 #ifndef _PREFERENCEBASE_
15 #define _PREFERENCEBASE_
16 
17 #include "api.h"
18 #include <list>
19 #include <vector>
20 #include "PromptEntry.h"
21 
22 class Preference;
23 struct DEFAULT_PREFERENCE;
24 
25 enum PreferenceAttribute{Available,
26  UserControllable,
27  UserControlAllowed,
28  PostAuthVerification,
29  UnknownAttribute};
30 
31 #define PREFERENCE_COUNT UnknownPreference
32 #define ATTRIBUTE_COUNT UnknownAttribute
33 
34 typedef std::list<Preference*> PreferenceList;
35 
36 class VPN_VPNAPI PreferenceBase
37 {
38 
39  protected:
40 
41  PreferenceBase(PreferenceId preferenceId,
42  const tstring& label,
43  PromptType prefType,
44  const tstring& initialValue,
45  ApiStringMap* pOptions = NULL,
46  Preference* pParent = NULL);
47 
48  public:
49 
50  const PreferenceId& getPreferenceId() const;
51  PreferenceScope getPreferenceScope() const;
52 
53  const tstring& getPreferenceValue() const;
54  bool setPreferenceValue(const tstring& value);
55 
56  bool getPreferenceAttribute(const PreferenceAttribute& attribute);
57  void setPreferenceAttribute(const PreferenceAttribute& attribute, bool value);
58 
59  const PreferenceList& getChildren() const;
60 
61  void addChildPreference(Preference* pPref);
62  void removeChildPreference(Preference* pPref);
63 
64  PromptEntry* getPromptEntry() const;
65 
66  static Preference* createPreferenceFromId(PreferenceId prefId);
67 
68  static tstring getPreferenceNameFromId(PreferenceId prefId);
69  static PreferenceId getPreferenceIdFromName(const tstring& name);
70  static PreferenceAttribute getAttributeIdFromName(const tstring& attributeName);
71  static tstring getAttributeNameFromId(const PreferenceAttribute attrId);
72  static PreferenceId getParentId(const PreferenceId prefId);
73  static PreferenceScope getPreferenceScopeFromId(PreferenceId prefId);
74  static tstring getDefaultValue(PreferenceId prefId);
75  static bool getDefaultAttribute(PreferenceId prefId,
76  PreferenceAttribute attribute);
77  static bool isParentPreference(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 
96  static const tstring Automatic;
97  static const tstring SoftwareToken;
98  static const tstring HardwareToken;
99 
100  static const tstring SingleLogon;
101  static const tstring SingleLocalLogon;
102 
103  static const tstring LocalUsersOnly;
104  static const tstring AllowRemoteUsers;
105 
106  static const tstring ProxyNative;
107  static const tstring ProxyIgnoreProxy;
108  static const tstring ProxyOverride;
109 
110  static const tstring PPPExclusionAutomatic;
111  static const tstring PPPExclusionDisable;
112  static const tstring PPPExclusionOverride;
113 
114  static const tstring Connect;
115  static const tstring Pause;
116  static const tstring Disconnect;
117  static const tstring DoNothing;
118 
119  static const tstring SameUserOnly;
120  static const tstring AnyUser;
121 
122  static const tstring PasswordComplexityAlpha;
123  static const tstring PasswordComplexityPin;
124  static const tstring PasswordComplexityStrong;
125 
126  static const tstring Open;
127  static const tstring Closed;
128 
129  static const tstring IPv4;
130  static const tstring IPv6;
131  static const tstring IPv4_IPv6;
132  static const tstring IPv6_IPv4;
133 
134  private:
135  PreferenceId me_preferenceId;
136  PromptEntry* m_pPromptEntry;
137  PreferenceList m_childPreferences;
138  PreferenceScope me_preferenceScope;
139  bool mb_attributes[ATTRIBUTE_COUNT];
140 
141  static const char* sm_attributeStrs[];
142  static const DEFAULT_PREFERENCE sm_defaultPreferences[];
143 };
144 
145 #endif // _PREFERENCEBASE_
PreferenceBase
Definition: PreferenceBase.h:35
PreferenceId
PreferenceId
Definition: api.h:261
tstring
#define tstring
Definition: api.h:24
PromptEntry
Definition: PromptEntry.h:39
Preference
Definition: Preference.h:27
PreferenceScope
PreferenceScope
Definition: api.h:486
PromptType
PromptType
Definition: api.h:236
api.h