| AnyConnect Secure Mobility Client 5.1.10.233

Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
GUIClientImpl Class Reference

`#include <GUIClientImpl.h>`

## Public Member Functions
| GUIClientImpl (MainDialog *parent)
bool | connect (tstring host)
void | setUserData (ConnectPromptInfo &ConnectPrompt)
Public Member Functions inherited from ClientIfc
bool | attach (ClientType clientType=ClientType_GUI, bool requestFullCapabilities=true, bool suppressAutoConnect=true)
void | detach ()
void | ProcessEvents ()
bool | hasFullCapabilities ()
bool | isConnected (bool bSilent=false)
bool | isAvailable ()
bool | isVPNServiceAvailable ()
bool | isOperatingMode (OperatingMode opMode)
std::list< tstring > | getHostNames ()
tstring | getDefaultHostName ()
bool | connect (tstring host)
bool | connect (tstring host, unsigned int origin)
bool | setNewTunnelGroup (const tstring &group)
void | disconnect ()
void | cancel ()
void | getState ()
void | getStats ()
void | resetStats ()
void | startStats ()
void | stopStats ()
void | exportStats (const tstring &tstrFilePath)
void | setBannerResponse (bool bAccepted)
void | setPreConnectReminderResponse ()
void | setCertBlockedResponse (bool bUnblock)
void | setCertWarningResponse (bool bConnect, bool bImportCert)
void | UserSubmit ()
std::shared_ptr< PreferenceInfo > | getPreferences ()
unsigned int | getPreferencesCount ()
bool | savePreferences (const std::shared_ptr< PreferenceInfo > &spPreferenceInfo)
tstring | getConnectHost ()
void | setLastVpnError (VPNError vpnError)
VPNError | getLastVpnError ()
bool | isConnectRequestActive ()

## Public Attributes
tstring | ms_user
tstring | ms_pswd
tstring | ms_group

## Protected Member Functions
void | StatsCB (IN VPNStats &stats)
void | StateCB (IN const VPNState state, IN const VPNSubState subState, IN const tstring stateString)
void | BannerCB (IN const tstring &banner)
void | PreConnectReminderCB (const tstring &rtstrPreConnectReminder)
void | NoticeCB (IN const tstring &notice, IN const MessageType type, IN const bool bSensitive=false)
void | ExitNoticeCB (IN const tstring &notice, const int returnCode)
void | ServiceReadyCB ()
void | UserPromptCB (IN ConnectPromptInfo &ConnectPrompt)
void | CertBlockedCB (IN const tstring &rtstrUntrustedServer)
void | CertWarningCB (IN const tstring &rtstrUntrustedServer, IN const std::list< tstring > &rltstrCertErrors, IN bool bAllowImport)
void | EventAvailable ()
Protected Member Functions inherited from ClientIfcBase
virtual void | StatsCB (VPNStats &stats)=0
virtual void | StateCB (const VPNState state, const VPNSubState subState, const tstring stateString)=0
virtual void | BannerCB (const tstring &banner)=0
virtual void | NoticeCB (const tstring &notice, const MessageType type, const bool bSensitive=false)=0
virtual void | ExitNoticeCB (const tstring &tstrNotice, const int returnCode)
virtual void | UserPromptCB (ConnectPromptInfo &ConnectPrompt)=0
virtual void | WMHintCB (const WMHint hint, const WMHintReason reason)
virtual void | deliverWebLaunchHostCB (const tstring &activeHost)
virtual void | CertBlockedCB (const tstring &rtstrUntrustedServer)=0
virtual void | CertWarningCB (const tstring &rtstrUntrustedServer, const std::list< tstring > &rltstrCertErrors, bool bAllowImport)=0
void | ResetQuarantinedReconnect ()
void | ClientIfcTransmigration ()
bool | attach (const ClientType clientType=ClientType_GUI, const bool requestFullCapabilities=true, const bool suppressAutoConnect=true, const bool bSuppressEventAvailableCB=false)
void | detach ()
void | ProcessEvents ()
bool | hasFullCapabilities ()
bool | isConnected (bool bSilent=false)
bool | isAvailable ()
std::list< tstring > | getHostNames ()
std::list< HostEntry > | getHostEntries ()
tstring | getDefaultHostName ()
bool | connect (tstring host)
bool | connect (tstring host, unsigned int origin)
bool | setNewTunnelGroup (const tstring &group)
void | disconnect ()
void | cancel ()
void | resetStats ()
void | getState ()
VPNState | getCurrentVPNState ()
VPNSubState | getCurrentVPNSubState ()
VPNSubState | getPreviousVPNSubState ()
STATE | getCurrentState ()
tstring | getStateText ()
void | setNetworkStates (NETENV_STATE netEnvState, NETCTRL_STATE netCtrlState, NETWORK_TYPE netType, bool bACBrowserForCPRemediation, bool bUpdateUI)
void | refreshOperatingModeForCurrentNetStates ()
NETENV_STATE | getCurrentNetEnvState ()
NETENV_STATE | getPreviousNetEnvState ()
NETCTRL_STATE | getCurrentNetCtrlState ()
NETWORK_TYPE | getCurrentNetType ()
bool | isACBrowserForCPRemediation ()
tstring | getNetworkStatusText (const VPNState state, const VPNSubState subState, const NETENV_STATE netEnvState, const NETCTRL_STATE netCtrlState)
PreferenceInfo & | getPreferences ()
bool | savePreferences ()
void | startStats ()
void | stopStats ()
void | UserSubmit ()
void | setBanner (const tstring &banner)
void | setBannerResponse (bool bResponse)
void | setPreConnectReminder (const tstring &tstrPreConnectReminder)
void | setPreConnectReminderResponse ()
bool | getUserResponse ()
bool | isUserResponseSet ()
void | setCertBlocked (const tstring &tstrUntrustedServer)
void | setCertWarning (const tstring &rtstrUntrustedServer, const std::list< tstring > &rltstrCertErrors, bool bAllowImport)
bool | getCertImportResponse ()
void | setUserPrompt (ConnectPromptInfo &ConnectPrompt)
void | setCertBlockedResponse (bool bUnlock)
void | setCertWarningResponse (bool bConnect, bool bImportCert)
void | insertStateToConnectPrompt (ConnectPromptInfo &ConnectPrompt)
void | ExitNotice (const tstring &tstrNotice, const int code=0)
void | notice (const tstring &tstrNotice, const MessageType type=MsgType_Info, bool bClearLastMsg=false, bool bForce=false, bool bStateMsg=false, bool bSensitiveMsg=false)
void | notice (MsgWithArg &notice, const MessageType type=MsgType_Info, bool bClearLastMsg=false, bool bForce=false, bool bStateMsg=false, bool bSensitiveMsg=false)
void | getStats (void)
void | setStats (VPNStats &stats)
void | exportStats (const tstring &tstrFilePath)
void | initState (VPNState state, VPNState previousState, VPNSubState subState)
void | setState (VPNState state, VPNState previousState, VPNSubState subState=VPNSS_NORMAL, bool bUpdateStateMsg=true, bool bOnlyUpdateUI=false)
void | setWMHint (WMHint hint, WMHintReason reason)
bool | isLastConnectType (const ConnectPromptType connPromptType)
bool | isOperatingMode (OperatingMode opMode)
void | setOperatingMode (OperatingMode opMode)
void | unsetOperatingMode (OperatingMode opMode)
bool | CanRemediateCaptivePortal ()
bool | policyAllowsCaptivePortalRemediation ()
bool | isEventShutdown ()
bool | isUsingEventModel ()
time_t | getLastDisconnectTime ()
ConnectPromptInfo | getConnectPromptInfo ()
void | resetConnectPromptPasswordData ()
void | setStandaloneConnection (bool isStandalone)
void | deliverActiveHost (const tstring &activeHost, ConnectProtocolType vpnProtocol=PROTOCOL_TYPE_UNKNOWN, bool bActiveHostFriendlyName=false)
bool | isVPNServiceReady ()
void | resetLastDisconnectTime (time_t time=1)
void | processMinimize ()
void | setEnrollClientCert (CertObj *pCert)
void | linuxCertImportWarnUser ()
void | linuxCertImportWarnUserResponse (bool bAccept)
void | setDefaultHost (tstring &host)
void | setLastVpnError (VPNError vpnError)
VPNError | getLastVpnError ()
bool | requestImportLocalization (const tstring tstrLocale, const std::vector< unsigned char > &MoFileData)
void | startAHS (const unsigned int uiReason, const ProxyIfc &proxy)
void | AHSSelectedHost (const unsigned int uiReason, const std::vector< tstring > &headendList, const long statusReturnCode, const tstring &extraInfo)
std::vector< tstring > | getAHSHostList ()
unsigned int | getAHSState ()
bool | isAHSHasRun ()
bool | IsAHSCachingRestricted ()
bool | suppressConnectionErrorPopups ()
tstring | getCaptivePortalDetectedMsg ()
void | setProxyAuthPrompts (ProxyIfc *pProxy, const tstring &promptMsg)
bool | handleIpcMessage (CIpcMessage *pIpcMessage)
void | signalDisconnectedToEventNtfctnThread ()
bool | IsCsdTokenVerified () const
void | activateConnectMgrTunnelInitiationCompletionEvent ()
bool | isConnectRequestActive ()
bool | isConnectRequestCleanup ()
bool | syncProfileChange (const tstring &profileName)
tstring | getConnectHost ()
tstring | getMgmtTunnelHostname ()
VPN_TUNNEL_SCOPE | getVpnTunnelScope ()
bool | isStandaloneConnection ()
void | sendSSoLogoutPrompt (ConnectPromptInfo &cpi)
void | setExternalSSOLogoutUrlFromAgent (const tstring &logoutUrl)

## Protected Attributes
ConnectPromptInfo * | m_pConnectPrompt
MainDialog * | parentWindow

## Additional Inherited Members
Static Protected Member Functions inherited from ClientIfcBase
static tstring | getNoticeTypeText (MessageType msgType)
static tstring | getStateText (VPNState state, VPNSubState subState=VPNSS_NORMAL, NETENV_STATE netEnvState=NES_NETWORK_ACCESSIBLE, const tstring &tstrConnectedHost=tstring())
static tstring | getNetCtrlText (NETCTRL_STATE netCtrlState)
static tstring | getNetEnvText (NETENV_STATE netEnvState, bool bSimple=false)
static tstring | getNetTypeText (NETWORK_TYPE netType)
static tstring | getQuarantinedStatusText ()
static tstring | getNetworkStatusSimpleText (const NETENV_STATE netEnvState, const NETCTRL_STATE netCtrlState)

## Detailed Description

This is an example application demonstrating the implementation of the AnyConnect API

## Constructor & Destructor Documentation

## ◆ GUIClientImpl()

GUIClientImpl::GUIClientImpl | ( | MainDialog * | parent | ) |

25 : m_pConnectPrompt(NULL)
26{
27 parentWindow = parent;
28}

## ◆ ~GUIClientImpl()

GUIClientImpl::~GUIClientImpl | ( |  | ) |
| virtual

30{ }

## Member Function Documentation

## ◆ BannerCB()

void GUIClientImpl::BannerCB | ( | IN const tstring & | banner | ) |
| protected

65{
66 bool bBannerAccepted = true;
67 setBannerResponse(bBannerAccepted);
68}
ClientIfc::setBannerResponse
void setBannerResponse(bool bAccepted)

## ◆ CertBlockedCB()

void GUIClientImpl::CertBlockedCB | ( | IN const tstring & | rtstrUntrustedServer | ) |
| protected

78{
79 setCertBlockedResponse(false);
80}

## ◆ CertWarningCB()

void GUIClientImpl::CertWarningCB | ( | IN const tstring & | rtstrUntrustedServer,
|  | IN const std::list< tstring > & | rltstrCertErrors,
|  | IN bool | bAllowImport )
| protected

86{
87 setCertWarningResponse(false, false);
88}

## ◆ connect()

bool GUIClientImpl::connect | ( | tstring | host | ) |

35{
36 me_RequestType = REQ_CONNECT;
37
38 // This is the main method for initiating a VPN connection.
39 // The method can be found in ClientIfc.
40 //
41 bool bSuccess = ClientIfc::connect(host);
42 if (!bSuccess)
43 {
44 return false;
45 }
46
47 return true;
48}
ClientIfc::connect
bool connect(tstring host)

## ◆ EventAvailable()

void GUIClientImpl::EventAvailable | ( |  | ) |
| protected virtual

The implementation of this method and subsequent call on MainDialog::HandleEventAvailable demonstrates the posting of an event.

Reimplemented from ClientIfcBase.

111{
112 parentWindow->HandleEventAvailable();
113}

## ◆ ExitNoticeCB()

void GUIClientImpl::ExitNoticeCB | ( | IN const tstring & | notice,
|  | const int | returnCode )
| protected

101{
102 parentWindow->showStatusbarText(notice.c_str());
103}

## ◆ NoticeCB()

void GUIClientImpl::NoticeCB | ( | IN const tstring & | notice,
|  | IN const MessageType | type,
|  | IN const bool | bSensitive = false )
| protected

94{
95 parentWindow->showStatusbarText(notice);
96}

## ◆ PreConnectReminderCB()

void GUIClientImpl::PreConnectReminderCB | ( | const tstring & | rtstrPreConnectReminder | ) |
| protected virtual

If a pre-connect reminder needs to be acknowledged, this CB delivers the pre-connect reminder to the client.

NOTE: Connection establishment will block until the method setPreConnectReminderResponse() is called.

In a GUI, a pre-connect reminder would typically be displayed in a modal dialog with an OK button selection.

See also
  setPreConnectReminderResponse() to set the user acknowledgement to the pre-connect reminder message.

Reimplemented from ClientIfcBase.

72{
73 setPreConnectReminderResponse();
74}
ClientIfc::setPreConnectReminderResponse
void setPreConnectReminderResponse()

## ◆ ServiceReadyCB()

void GUIClientImpl::ServiceReadyCB | ( |  | ) |
| protected virtual

Under normal operating conditions, this CB is called as soon as the attach method completes. In case the service (vpn agent) is not ready, this CB is not called until it is.

Any API calls made prior to this CB being called will result in a NoticeCB error message.

Implements ClientIfcBase.

107{ }

## ◆ setUserData()

void GUIClientImpl::setUserData | ( | ConnectPromptInfo & | ConnectPrompt | ) |

139{
140 parentWindow->showStatusbarText(ConnectPrompt.getMessage().c_str());
141
142 std::list<tstring> promptNames;
143 // get the list of PromptEntry received.
144 //
145 ConnectPrompt.getListPromptNames(promptNames);
146
147 std::list<tstring> :: iterator name_iter;
148 for (name_iter = promptNames.begin();
149 name_iter != promptNames.end(); ++name_iter)
150 {
151 PromptEntry *entry = ConnectPrompt.getPromptEntry(*name_iter);
152
153 // For this demo program, we'll assume any combo box is for
154 // group selection.
155 //
156 if (entry->getPromptType() == Prompt_Combo)
157 {
158 entry->setValue(ms_group);
159 }
160
161 tstring promptName = entry->getPromptName();
162 if (promptName == L"username")
163 {
164 entry->setValue(ms_user);
165 }
166 else if (promptName == L"password")
167 {
168 entry->setValue(ms_pswd);
169 }
170 }
171}
Prompt_Combo
@ Prompt_Combo
Definition api.h:262
tstring
#define tstring
Definition api.h:35
ConnectPromptInfo::getMessage
const tstring & getMessage() const
ConnectPromptInfo::getPromptEntry
PromptEntry * getPromptEntry(const tstring &promptName) const
ConnectPromptInfo::getListPromptNames
const std::list< tstring > & getListPromptNames(std::list< tstring > &listPromptNames) const
PromptEntry::getPromptName
const tstring & getPromptName() const
PromptEntry::getPromptType
PromptType getPromptType() const
PromptEntry::setValue
bool setValue(const tstring &value)

## ◆ StateCB()

void GUIClientImpl::StateCB | ( | IN const VPNState | state,
|  | IN const VPNSubState | subState,
|  | IN const tstring | stateString )
| protected

58{
59 parentWindow->showStatusbarText(stateString);
60}

## ◆ StatsCB()

void GUIClientImpl::StatsCB | ( | IN VPNStats & | stats | ) |
| protected

51{ }

## ◆ UserPromptCB()

void GUIClientImpl::UserPromptCB | ( | IN ConnectPromptInfo & | ConnectPrompt | ) |
| protected

117{
118 parentWindow->HandlePromptCB(ConnectPrompt);
119
120 if (me_RequestType == REQ_CONNECT)
121 {
122 // for example purposes, only allow one try at setting user data
123 //
124 me_RequestType = REQ_END;
125
126 // look for requested user input fields and fill in previously
127 // stored values.
128 //
129 setUserData(ConnectPrompt);
130
131 // now that the user data has been entered, submit the response.
132 //
133 UserSubmit();
134 }
135}
ClientIfc::UserSubmit
void UserSubmit()