AnyConnect Secure Mobility Client  4.10.08029
PromptEntryBase.h
1 /**************************************************************************
2 * Copyright (c) 2008, Cisco Systems, All Rights Reserved
3 ***************************************************************************
4 *
5 * File: PromptEntryBase.h
6 * Date: 01/2008
7 *
8 ***************************************************************************
9 *
10 * Prompt Entry base class implementation for the Client API.
11 *
12 ***************************************************************************/
13 
14 #ifndef _PROMPTENTRYBASE_
15 #define _PROMPTENTRYBASE_
16 
17 
18 #include "api.h"
19 #include <list>
20 
21 
22 #define PROMPT_ENTRY_VALUE_TRUE _T("true")
23 #define PROMPT_ENTRY_VALUE_FALSE _T("false")
24 
25 class VPN_VPNAPI PromptEntryBase
26 {
27  public:
28 
29  bool setValue(const tstring& value);
30  bool clearValue();
31 
32  const tstring &getPromptName() const;
33 
34  const tstring &getPromptLabel() const;
35 
36  bool isEnabled() const;
37 
38  void setEnabled(bool bIsEnabled);
39 
40  bool isVisible() const;
41 
42  void setVisible(bool bIsVisible);
43 
44  // if this is a PromptEntry that has a list of values
45  // (e.g. combo box style) the default will be to mark it as a group
46  // combo. This method allows the group designation to be set directly.
47  //
48  void setEntryGroup(bool bIsEntryGroup);
49 
50 
51  PromptEntryBase(tstring PromptName,
52  tstring PromptLabel,
53  PromptType promptType = Prompt_Input,
54  const tstring& DefaultValue = EmptyString,
55  ApiStringMap LabelValues = EmptyLabelValues);
56 
57 
58  void setPromptLabel(tstring label);
59 
60  // In cases of prompt types with options (checkbox, combobox),
61  // this will return the translated label (of the option).
62  const tstring &getValue() const;
63 
64  // this function returns the internal representation of the value
65  const tstring &getTrueValue() const;
66 
67  const std::list<tstring> &getValueOptions() const;
68 
69  bool isEntryGroup() const;
70 
71  bool isReadOnly() const;
72 
73  PromptType getPromptType() const;
74 
75  size_t GetGroupAttributesCount();
76 
77 
78  ~PromptEntryBase();
79 
80  static const tstring EmptyString;
81 
82  static const std::list<tstring> EmptyList;
83 
84  static const ApiStringMap EmptyLabelValues;
85 
86  PromptEntryBase& operator=(const PromptEntryBase& assignmentOperator);
87 
88  PromptEntryBase(const PromptEntryBase& existingEntry);
89 
90 
91  private:
92 
93  tstring ms_PromptName;
94 
95  tstring ms_PromptLabel;
96 
97  PromptType me_PromptType;
98 
99  tstring ms_Value;
100 
101  ApiStringMap msm_LabelValueMap;
102 
103  std::list<tstring> mls_ValueOptions;
104 
105  bool mb_IsEntryGroup;
106 
107  bool mb_Enabled;
108 
109  bool mb_Visible;
110 
111  public:
112 
114  {
115  public:
116  GroupAttributes() :
117  CredRequired(true),
118  UsesSDIAuth(false),
119  UsernameEditable(true),
120  Username(),
121  SecondaryUsernameEditable(true),
122  SecondaryUsername(),
123  UsesSecondaryAuth(false) {}
124 
125  bool CredRequired;
126  bool UsesSDIAuth;
127  bool UsernameEditable;
128  tstring Username;
129  bool SecondaryUsernameEditable;
130  tstring SecondaryUsername;
131  bool UsesSecondaryAuth;
132  };
133 
135  {
136  public:
137  SingleAttributes() :
138  SecondaryAuthEntry(false),
139  SSOTimeoutSeconds(0),
140  SSOIsExternalBrowser(false) {}
141 
142  bool SecondaryAuthEntry;
143  tstring SSOURL;
144  tstring SSOFinalURL;
145  tstring SSOTokenCookieName;
146  tstring SSOErrorCookieName;
147  unsigned int SSOTimeoutSeconds;
148  tstring SSOUserAgent;
149  bool SSOIsExternalBrowser;
150  };
151 
152  typedef std::map<tstring, GroupAttributes> GroupAttributeMap;
153 
154  const GroupAttributes& getGroupAttributes(const tstring& group) const;
155  void setGroupAttributeMap(const GroupAttributeMap& groupAttributeMap);
156 
157  const SingleAttributes& getSingleAttributes() const;
158  void setSingleAttributes(const SingleAttributes& singleAttributes);
159 
160  private:
161 
162  void copyGroupAttributeMap (const GroupAttributeMap &source,
163  GroupAttributeMap &destination);
164  static const GroupAttributes DefaultGroupAttributes;
165  GroupAttributeMap m_GroupAttributeMap;
166 
167  SingleAttributes m_SingleAttributes;
168 };
169 
170 
171 #endif // _PROMPTENTRYBASE_
PromptEntryBase
Definition: PromptEntryBase.h:26
Prompt_Input
@ Prompt_Input
Definition: api.h:249
PromptEntryBase::GroupAttributes
Definition: PromptEntryBase.h:114
tstring
#define tstring
Definition: api.h:35
PromptEntryBase::SingleAttributes
Definition: PromptEntryBase.h:135
PromptType
PromptType
Definition: api.h:249
api.h