AnyConnect Secure Mobility Client  4.10.06090
ConnectPromptInfoBase.h
1 /**************************************************************************
2 * Copyright (c) 2008, Cisco Systems, All Rights Reserved
3 ***************************************************************************
4 *
5 * File: ConnectPromptInfoBase.h
6 * Date: 01/2008
7 *
8 ***************************************************************************
9 *
10 * Connect Prompt Info base class implementation for the Client API.
11 *
12 ***************************************************************************/
13 
14 #ifndef _CONNECTPROMPTINFOBASE_
15 #define _CONNECTPROMPTINFOBASE_
16 
17 #include "api.h"
18 #include <list>
19 
20 class PromptEntry;
21 
22 typedef enum
23 {
24  HIDDEN, /**< Indicates the control is not to be displayed */
25  ENABLED, /**< Indicates the control should be displayed and enabled */
26  DISABLED /**< Indicates the control should be displayed but disabled */
27 } UIControlStateType;
28 
29 //
30 // This class is the base class intended to manage the credential data being
31 // requested from client applications. It will manage the setup and data
32 // needed to support the various credential requests.
33 //
34 
35 
36 class VPN_VPNAPI ConnectPromptInfoBase
37 {
38  protected:
39 
40  ConnectPromptType getConnectPromptType() const;
41 
42  unsigned int countPromptEntry() const;
43 
44  const tstring &getMessage() const;
45 
46  const std::list<tstring> &getListPromptNames(
47  std::list<tstring> &listPromptNames) const;
48 
49  PromptEntry *getPromptEntry(const tstring &promptName) const;
50 
51  const std::list<PromptEntry *> &getListPromptEntry() const;
52 
53  bool hasAuthenticationError() const;
54 
55  const tstring &getSubmitButtonName() const;
56 
57  bool hasEnrollmentCA() const;
58 
59  void setUseEnrollmentCA(bool bUseEnrollmentCA);
60 
61  bool isEmpty() const;
62 
63  public:
64 
65  // set the button to be used for submitting user responses
66  //
67  void setSubmitButtonName(const tstring &buttonName);
68 
69  void setConnectPromptType(ConnectPromptType connectPromptType);
70 
71  bool isCanceled() const;
72 
73  void setCanceled(bool bIsCanceled);
74 
75  // BUGBUG: Cwrapper/API and COM API need to be updated with getResponseError and setResponseError
76  UserResponseError getResponseError() const;
77 
78  void setResponseError(UserResponseError err);
79 
80  void setMessage(const tstring& tstrMessage);
81 
82  void setAuthenticationError(int iAuthError);
83  int getAuthenticationError() const;
84 
85  void setAuthenticationErrorMessage(const tstring &authErrorMessage);
86  tstring getAuthenticationErrorMessage() const;
87 
88  // PromptEntry objects added using this method will be managed
89  // by this object. This can include deletion.
90  //
91  void addPromptEntry(PromptEntry *promptEntry);
92  void insertPromptEntry(PromptEntry *promptEntry);
93  void removeMatchingPromptEntry(PromptType promptType);
94  void clearPasswordData();
95 
96  void setHasEnrollmentCA(bool bHasEnrollmentCA);
97 
98  bool useEnrollmentCA() const;
99 
100 
101  // determine if request originated as web or standalone
102  //
103  void setAgentRequest(bool agentRequest);
104 
105  bool isAgentRequest() const;
106 
107  bool isAutoSubmit() const;
108  void setAutoSubmit(bool bIsAutoSubmit);
109 
110  // Set actively selected group.
111  // This method will update the value and enabled properties of the
112  // contained credential PromptEntry objects.
113  //
114  bool setTunnelGroup(const tstring &group);
115 
116 
117  // reset the contents of this object back to initialized state.
118  // This method removes all data currently in this object instance.
119  //
120  void reset();
121 
122  // is this instance empty or is there some useable data
123  //
124  bool valid() const;
125 
126  void setButtonState(UIControlStateType state) {me_buttonState = state;};
127  UIControlStateType getButtonState() {return me_buttonState;};
128 
129  // generate a formatted output of PromptEntry contents.
130  //
131  tstring toString() const;
132 
133  ConnectPromptInfoBase(tstring defaultSubmitButtonName);
134  explicit ConnectPromptInfoBase(const ConnectPromptInfoBase &copyCtor);
135  ConnectPromptInfoBase& operator=(const ConnectPromptInfoBase &inst);
136  virtual ~ConnectPromptInfoBase();
137 
138  PromptEntry* getFirstPromptEntryOfType(PromptType ptype);
139 
140  private:
141  tstring mso_defaultMessage;
142  tstring mso_certificateMessage;
143  tstring mso_authErrorMessage;
144  tstring ms_defaultSubmitButtonName;
145  tstring ms_SubmitButtonName;
146 
147  std::list<PromptEntry *> mlo_PromptEntry;
148 
149  ConnectPromptType me_ConnectPromptType;
150 
151  bool mb_isCanceled;
152  UserResponseError m_responseError;
153  int mi_AuthenticationError;
154  bool mb_HasEnrollmentCA;
155  bool mb_UseEnrollmentCA;
156  bool mb_AgentRequest;
157  bool mb_isAutoSubmit;
158 
159  UIControlStateType me_buttonState;
160 
161 };
162 
163 
164 #endif // _CONNECTPROMPTINFOBASE_
ConnectPromptType
Definition: api.h:224
Definition: ConnectPromptInfoBase.h:36
#define tstring
Definition: api.h:35
Definition: PromptEntry.h:40
PromptType
Definition: api.h:249