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;
297 void ResetQuarantinedReconnect();
299 void ClientIfcTransmigration();
303 bool attach(
const ClientType clientType = ClientType_GUI,
304 const bool requestFullCapabilities =
true,
305 const bool suppressAutoConnect =
true,
306 const bool bSuppressEventAvailableCB =
false);
310 void ProcessEvents();
312 bool hasFullCapabilities();
314 bool isConnected(
bool bSilent =
false);
318 std::list<tstring> getHostNames();
320 std::list<HostEntry> getHostEntries();
325 #
if defined(HOST_DATA_SUPPORTED)
326 const IHostData& host);
332 #
if defined(HOST_DATA_SUPPORTED)
333 const IHostData& host,
337 unsigned int origin);
339 bool setNewTunnelGroup(
const tstring & group);
353 STATE getCurrentState();
360 NETENV_STATE netEnvState = NES_NETWORK_ACCESSIBLE,
363 void setNetworkStates(NETENV_STATE netEnvState,
364 NETCTRL_STATE netCtrlState,
365 NETWORK_TYPE netType,
366 bool bACBrowserForCPRemediation,
368 void refreshOperatingModeForCurrentNetStates();
369 NETENV_STATE getCurrentNetEnvState();
370 NETENV_STATE getPreviousNetEnvState();
371 NETCTRL_STATE getCurrentNetCtrlState();
372 NETWORK_TYPE getCurrentNetType();
373 bool isACBrowserForCPRemediation();
375 static tstring getNetCtrlText(NETCTRL_STATE netCtrlState);
376 static tstring getNetEnvText(NETENV_STATE netEnvState,
377 bool bSimple =
false);
378 static tstring getNetTypeText(NETWORK_TYPE netType);
379 static tstring getQuarantinedStatusText();
380 static tstring getNetworkStatusSimpleText(
const NETENV_STATE netEnvState,
381 const NETCTRL_STATE netCtrlState);
386 const NETENV_STATE netEnvState,
387 const NETCTRL_STATE netCtrlState);
391 bool savePreferences();
399 void setBanner(
const tstring &banner);
400 void setBannerResponse(
bool bResponse);
402 void setPreConnectReminder(
const tstring &tstrPreConnectReminder);
403 void setPreConnectReminderResponse();
405 bool getUserResponse();
406 bool isUserResponseSet();
408 void setCertBlocked(
const tstring &tstrUntrustedServer);
409 void setCertWarning(
const tstring &rtstrUntrustedServer,
410 const std::list<tstring> &rltstrCertErrors,
412 #if defined(PLATFORM_WIN_APP)
413 void setCertWarning(
const tstring &rtstrUntrustedServer,
414 const std::list<tstring> &rltstrCertErrors,
415 const std::vector<uint8_t>& rvServerCertDER,
418 bool getCertImportResponse();
420 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
421 void setCertBanner(
tstring tstrCertBannerSummary,
422 uint32_t nCertBannerCertLen,
423 const uint8_t *pCertBannerCertDer,
424 const std::list<tstring> &confirmReasons,
425 const std::list<CertConfirmReason> &confirmReasonEnums,
426 bool bImportAllowed);
428 void setCertBannerResponse(
bool bResponse,
bool bImportCert);
429 void importServerCert(std::vector<uint8_t> certData);
430 bool setFipsMode(
bool bEnableFips);
431 #if defined(PLATFORM_ANDROID)
432 bool setStrictMode(
bool bEnableStrictMode);
433 bool setRevocationEnabled(
bool bRevocationEnabled);
434 bool IsRevocationEnabled();
435 #endif // currently supported only for android
440 #if defined(PLATFORM_ANDROID)
441 void setClientCertResponse(std::vector< std::pair<uint32_t, uint8_t*> > &derList);
442 void setAgentDetached();
443 bool getClientCertificates();
446 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
447 void setSCEPEnrollInProgress(
bool bInProgress);
448 bool isSCEPEnrollInProgress();
451 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED)
452 void setImportPKCS12Result(
const std::vector<uint8_t> &certHash,
const tstring &tstrError);
453 bool requestImportPKCS12(
const std::vector<uint8_t> &data);
454 std::vector<uint8_t> importPKCS12WithPassword(
const std::vector<uint8_t> &data,
const tstring &password);
457 void setCertBlockedResponse(
bool bUnlock);
458 void setCertWarningResponse(
bool bConnect,
bool bImportCert);
462 void ExitNotice(
const tstring &tstrNotice,
const int code = 0);
464 void notice(
const tstring &tstrNotice,
466 bool bClearLastMsg =
false,
468 bool bStateMsg =
false,
469 bool bSensitiveMsg =
false);
471 void notice(MsgWithArg ¬ice,
473 bool bClearLastMsg =
false,
475 bool bStateMsg =
false,
476 bool bSensitiveMsg =
false);
482 void exportStats(
const tstring &tstrFilePath);
491 bool bUpdateStateMsg =
true,
492 bool bOnlyUpdateUI =
false);
494 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED)
495 IACImporterAsync *createACImporter(IACImporterAsyncCB *pCallback);
498 void setWMHint(
WMHint hint,
507 bool CanRemediateCaptivePortal();
508 bool policyAllowsCaptivePortalRemediation();
510 bool isEventShutdown();
512 bool isUsingEventModel();
514 time_t getLastDisconnectTime();
517 void resetConnectPromptPasswordData();
519 void setStandaloneConnection(
bool isStandalone);
521 void deliverActiveHost(
const tstring &activeHost,
522 ConnectProtocolType vpnProtocol = PROTOCOL_TYPE_UNKNOWN,
523 bool bActiveHostFriendlyName =
false);
525 bool isVPNServiceReady();
529 void resetLastDisconnectTime(time_t time = 1);
531 void processMinimize();
534 void setEnrollClientCert(CertObj* pCert);
538 void linuxCertImportWarnUser();
542 void linuxCertImportWarnUserResponse(
bool bAccept);
544 void setDefaultHost(
tstring &host);
546 #if defined(HOST_DATA_SUPPORTED)
547 void setDefaultHostProfile(
const IHostData &hostProfile);
548 IHostData* getDefaultHostData();
551 void setLastVpnError(
VPNError vpnError);
554 #if defined(PLATFORM_ANDROID)
555 bool requestClientCertificates();
558 bool requestImportLocalization(
const tstring tstrLocale,
559 const std::vector<unsigned char> &MoFileData);
562 void startAHS(
const unsigned int uiReason,
563 const ProxyIfc& proxy);
567 void AHSSelectedHost(
const unsigned int uiReason,
568 const std::vector<tstring> &headendList,
569 const long statusReturnCode,
571 std::vector<tstring> getAHSHostList();
572 unsigned int getAHSState();
574 bool IsAHSCachingRestricted();
576 bool suppressConnectionErrorPopups();
578 tstring getCaptivePortalDetectedMsg();
580 void setProxyAuthPrompts(ProxyIfc* pProxy,
583 #if defined(INTERPROCESS_COMMUNICATION_SUPPORTED)
584 bool handleIpcMessage(CIpcMessage *pIpcMessage);
585 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED)
586 void signalDisconnectedToEventNtfctnThread();
589 bool IsCsdTokenVerified()
const;
591 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
592 virtual void SCEPEnrollStartCB();
593 virtual void SCEPEnrollExitCB();
596 void activateConnectMgrTunnelInitiationCompletionEvent();
597 bool isConnectRequestActive();
598 bool isConnectRequestCleanup();
599 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
600 bool deleteProfileByName(
const tstring &profileName);
602 bool importProfile(
const tstring &profileName,
const tstring &profileContents);
605 bool syncProfileChange(
const tstring &profileName);
607 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
608 bool hasPrefilledCredentials();
610 void setPrefilledCredentials(CredentialPrefill *prefill);
613 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_APPLE_SSLVPN)
614 std::list<ManagedCertificate *> enumerateCertificates(CertificateType certType);
615 bool deleteCertificates(CertificateType certType,
const std::list<std::string> &idList);
616 bool deleteServerCertificates(
const std::list<std::string> &idList);
619 #if defined(ANYCONNECT_USE_SNAK) && !defined(PLATFORM_WIN_APP)
620 std::list<ManagedCertificate *> enumerateSNAKCertificates(SNAK_CertType certType);
621 SNAK_CertType getSNAKCertType(CertificateType certType);
622 bool deleteClientCertificates(
const std::list<std::string> &idList);
625 #if defined(PLATFORM_APPLE_SSLVPN)
626 bool canUseBackupServers();
631 tstring getMgmtTunnelHostname();
633 VPN_TUNNEL_SCOPE getVpnTunnelScope();
635 bool isStandaloneConnection();
639 void setExternalSSOLogoutUrlFromAgent(
const tstring& logoutUrl);
647 std::unique_ptr<ClientIfcInternal> m_upClientIfcInternal;
660 #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:536
VPNSubState
Definition: api.h:168
VPNError
Definition: api.h:588
Definition: VPNStats.h:35