14 #ifndef _CLIENTIFCBASE_
15 #define _CLIENTIFCBASE_
21 #include "ClientIfcCommon.h"
24 #if defined(ANYCONNECT_USE_SNAK)
25 #include "SNAK_CertPlugin.h"
28 #if defined(HOST_DATA_SUPPORTED)
40 class ClientIfcInternal;
42 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED)
43 class CEventNotificationTlv;
46 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
47 class CredentialPrefill;
50 #if (defined(ANYCONNECT_USE_SNAK) || defined(PLATFORM_APPLE_SSLVPN)) && !defined(PLATFORM_WIN_APP)
51 class ManagedCertificate;
54 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED)
55 class IACImporterAsync;
56 class IACImporterAsyncCB;
61 friend class EventMgr;
62 friend class ClientIfcInternal;
79 virtual void StatsCB(
VPNStats &stats) = 0;
88 virtual void StateCB(
const VPNState state,
105 virtual void BannerCB(
const tstring &banner) = 0;
120 virtual void PreConnectReminderCB(
const tstring &rtstrPreConnectReminder);
134 virtual void NoticeCB(
const tstring ¬ice,
136 const bool bSensitive =
false) = 0;
138 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
139 virtual void CertBannerCB(
const tstring &certBannerSummary,
140 const uint32_t nCertBannerCertLen,
141 const uint8_t *pCertBannerCertDer,
142 const std::list<tstring> &confirmReasons,
143 const std::list<CertConfirmReason> &confirmReasonEnums,
144 bool bImportAllowed =
true) = 0;
162 virtual void ExitNoticeCB(
const tstring &tstrNotice,
163 const int returnCode);
174 virtual void ServiceReadyCB() = 0;
204 virtual void WMHintCB(
const WMHint hint,
219 virtual void deliverWebLaunchHostCB(
const tstring &activeHost);
231 virtual void CertBlockedCB(
const tstring &rtstrUntrustedServer) = 0;
246 virtual void CertWarningCB(
const tstring &rtstrUntrustedServer,
247 const std::list<tstring> &rltstrCertErrors,
248 bool bAllowImport) = 0;
250 #if defined(PLATFORM_WIN_APP)
254 virtual void CertWarningCB(
const tstring &rtstrUntrustedServer,
255 const std::list<tstring> &rltstrCertErrors,
256 const std::vector<uint8_t> &rvServerCertDER,
257 bool bAllowImport) = 0;
273 virtual void EventAvailable();
275 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED)
276 virtual void ImportPKCS12ResultCB(
const std::vector<uint8_t> &certHash,
279 #if defined(PLATFORM_ANDROID)
280 virtual void ClientCertificateCB(std::vector< std::pair<uint32_t, uint8_t*> > certList) = 0;
281 virtual void AgentDetachedCB();
284 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED)
288 virtual void EventNotificationInternalCB(
289 const std::shared_ptr<CEventNotificationTlv>& spEventNtfctnTlv) = 0;
296 void ClientIfcTransmigration();
300 bool attach(
const ClientType clientType = ClientType_GUI,
301 const bool requestFullCapabilities =
true,
302 const bool suppressAutoConnect =
true,
303 const bool bSuppressEventAvailableCB =
false);
307 void ProcessEvents();
309 bool hasFullCapabilities();
311 bool isConnected(
bool bSilent =
false);
315 std::list<tstring> getHostNames();
317 std::list<HostEntry> getHostEntries();
322 #
if defined(HOST_DATA_SUPPORTED)
323 const IHostData& host);
329 #
if defined(HOST_DATA_SUPPORTED)
330 const IHostData& host,
334 unsigned int origin);
336 bool setNewTunnelGroup(
const tstring & group);
355 NETENV_STATE netEnvState = NES_NETWORK_ACCESSIBLE,
358 void setNetworkStates(NETENV_STATE netEnvState,
359 NETCTRL_STATE netCtrlState,
360 NETWORK_TYPE netType,
361 bool bACBrowserForCPRemediation,
363 void refreshOperatingModeForCurrentNetStates();
364 NETENV_STATE getCurrentNetEnvState();
365 NETENV_STATE getPreviousNetEnvState();
366 NETCTRL_STATE getCurrentNetCtrlState();
367 NETWORK_TYPE getCurrentNetType();
368 bool isACBrowserForCPRemediation();
370 static tstring getNetCtrlText(NETCTRL_STATE netCtrlState);
371 static tstring getNetEnvText(NETENV_STATE netEnvState,
372 bool bSimple =
false);
373 static tstring getNetTypeText(NETWORK_TYPE netType);
374 static tstring getQuarantinedStatusText();
375 static tstring getNetworkStatusSimpleText(
const NETENV_STATE netEnvState,
376 const NETCTRL_STATE netCtrlState);
381 const NETENV_STATE netEnvState,
382 const NETCTRL_STATE netCtrlState);
386 bool savePreferences();
394 void setBanner(
const tstring &banner);
395 void setBannerResponse(
bool bResponse);
397 void setPreConnectReminder(
const tstring &tstrPreConnectReminder);
398 void setPreConnectReminderResponse();
400 bool getUserResponse();
401 bool isUserResponseSet();
403 void setCertBlocked(
const tstring &tstrUntrustedServer);
404 void setCertWarning(
const tstring &rtstrUntrustedServer,
405 const std::list<tstring> &rltstrCertErrors,
407 #if defined(PLATFORM_WIN_APP)
408 void setCertWarning(
const tstring &rtstrUntrustedServer,
409 const std::list<tstring> &rltstrCertErrors,
410 const std::vector<uint8_t>& rvServerCertDER,
413 bool getCertImportResponse();
415 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
416 void setCertBanner(
tstring tstrCertBannerSummary,
417 uint32_t nCertBannerCertLen,
418 const uint8_t *pCertBannerCertDer,
419 const std::list<tstring> &confirmReasons,
420 const std::list<CertConfirmReason> &confirmReasonEnums,
421 bool bImportAllowed);
423 void setCertBannerResponse(
bool bResponse,
bool bImportCert);
424 void importServerCert(std::vector<uint8_t> certData);
425 bool setFipsMode(
bool bEnableFips);
426 #if defined(PLATFORM_ANDROID)
427 bool setStrictMode(
bool bEnableStrictMode);
428 bool setRevocationEnabled(
bool bRevocationEnabled);
429 bool IsRevocationEnabled();
430 #endif // currently supported only for android
435 #if defined(PLATFORM_ANDROID)
436 void setClientCertResponse(std::vector< std::pair<uint32_t, uint8_t*> > &derList);
437 void setAgentDetached();
438 bool getClientCertificates();
441 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
442 void setSCEPEnrollInProgress(
bool bInProgress);
443 bool isSCEPEnrollInProgress();
446 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED)
447 void setImportPKCS12Result(
const std::vector<uint8_t> &certHash,
const tstring &tstrError);
448 bool requestImportPKCS12(
const std::vector<uint8_t> &data);
449 std::vector<uint8_t> importPKCS12WithPassword(
const std::vector<uint8_t> &data,
const tstring &password);
452 void setCertBlockedResponse(
bool bUnlock);
453 void setCertWarningResponse(
bool bConnect,
bool bImportCert);
457 void ExitNotice(
const tstring &tstrNotice,
const int code = 0);
459 void notice(
const tstring &tstrNotice,
461 bool bClearLastMsg =
false,
463 bool bStateMsg =
false,
464 bool bSensitiveMsg =
false);
466 void notice(MsgWithArg ¬ice,
468 bool bClearLastMsg =
false,
470 bool bStateMsg =
false,
471 bool bSensitiveMsg =
false);
477 void exportStats(
const tstring &tstrFilePath);
486 bool bUpdateStateMsg =
true,
487 bool bOnlyUpdateUI =
false);
489 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED)
490 IACImporterAsync *createACImporter(IACImporterAsyncCB *pCallback);
493 void setWMHint(
WMHint hint,
502 bool CanRemediateCaptivePortal();
503 bool policyAllowsCaptivePortalRemediation();
505 bool isEventShutdown();
507 bool isUsingEventModel();
509 time_t getLastDisconnectTime();
512 void resetConnectPromptPasswordData();
514 void setStandaloneConnection(
bool isStandalone);
516 void deliverActiveHost(
const tstring &activeHost,
517 ConnectProtocolType vpnProtocol = PROTOCOL_TYPE_UNKNOWN,
518 bool bActiveHostFriendlyName =
false);
520 bool isVPNServiceReady();
524 void resetLastDisconnectTime(time_t time = 1);
526 void processMinimize();
529 void setEnrollClientCert(CertObj* pCert);
533 void linuxCertImportWarnUser();
537 void linuxCertImportWarnUserResponse(
bool bAccept);
539 void setDefaultHost(
tstring &host);
541 #if defined(HOST_DATA_SUPPORTED)
542 void setDefaultHostProfile(
const IHostData &hostProfile);
543 IHostData* getDefaultHostData();
546 void setLastVpnError(
VPNError vpnError);
549 #if defined(PLATFORM_ANDROID)
550 bool requestClientCertificates();
553 bool requestImportLocalization(
const tstring tstrLocale,
554 const std::vector<unsigned char> &MoFileData);
557 void startAHS(
const unsigned int uiReason,
558 const ProxyIfc& proxy);
562 void AHSSelectedHost(
const unsigned int uiReason,
563 const std::vector<tstring> &headendList,
564 const long statusReturnCode,
566 std::vector<tstring> getAHSHostList();
567 unsigned int getAHSState();
569 bool IsAHSCachingRestricted();
571 bool suppressConnectionErrorPopups();
573 tstring getCaptivePortalDetectedMsg();
575 void setProxyAuthPrompts(ProxyIfc* pProxy,
578 #if defined(INTERPROCESS_COMMUNICATION_SUPPORTED)
579 bool handleIpcMessage(CIpcMessage *pIpcMessage);
581 bool IsCsdTokenVerified()
const;
583 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
584 virtual void SCEPEnrollStartCB();
585 virtual void SCEPEnrollExitCB();
588 void activateConnectMgrTunnelInitiationCompletionEvent();
589 bool isConnectRequestActive();
590 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
591 bool deleteProfileByName(
const tstring &profileName);
593 bool importProfile(
const tstring &profileName,
const tstring &profileContents);
596 bool syncProfileChange(
const tstring &profileName);
598 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
599 bool hasPrefilledCredentials();
601 void setPrefilledCredentials(CredentialPrefill *prefill);
604 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_APPLE_SSLVPN)
605 std::list<ManagedCertificate *> enumerateCertificates(CertificateType certType);
606 bool deleteCertificates(CertificateType certType,
const std::list<std::string> &idList);
607 bool deleteServerCertificates(
const std::list<std::string> &idList);
610 #if defined(ANYCONNECT_USE_SNAK) && !defined(PLATFORM_WIN_APP)
611 std::list<ManagedCertificate *> enumerateSNAKCertificates(SNAK_CertType certType);
612 SNAK_CertType getSNAKCertType(CertificateType certType);
613 bool deleteClientCertificates(
const std::list<std::string> &idList);
616 #if defined(PLATFORM_APPLE_SSLVPN)
617 bool canUseBackupServers();
622 tstring getMgmtTunnelHostname();
624 VPN_TUNNEL_SCOPE getVpnTunnelScope();
626 bool isStandaloneConnection();
630 void setExternalSSOLogoutUrlFromAgent(
const tstring& logoutUrl);
638 ClientIfcInternal* m_pClientIfcInternal;
653 #endif // _CLIENTIFCBASE_
ConnectPromptType
Definition: api.h:233
Definition: PreferenceInfo.h:26
WMHintReason
Definition: api.h:209
VPNState
Definition: api.h:144
Definition: ClientIfcBase.h:59
#define tstring
Definition: api.h:35
WMHint
Definition: api.h:190
Definition: ConnectPromptInfo.h:37
MessageType
Definition: api.h:108
OperatingMode
Definition: api.h:534
VPNSubState
Definition: api.h:168
VPNError
Definition: api.h:586
Definition: VPNStats.h:35