14 #ifndef _CLIENTIFCBASE_ 15 #define _CLIENTIFCBASE_ 21 #include "ClientIfcCommon.h" 23 #if defined(PLATFORM_DARWIN) 24 #include "ApprovalStatus.h" 27 #if defined(ANYCONNECT_USE_SNAK) 28 #include "SNAK_CertPlugin.h" 31 #if defined(HOST_DATA_SUPPORTED) 43 class ClientIfcInternal;
45 #if defined(VPNAPI_TRANSMIGRATION_SUPPORTED) 46 class CSharedAccessLock;
49 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED) 50 class CEventNotificationTlv;
53 #if defined(CREDENTIAL_PREFILL_SUPPORTED) 54 class CredentialPrefill;
57 #if (defined(ANYCONNECT_USE_SNAK) || defined(PLATFORM_APPLE_SSLVPN)) && !defined(PLATFORM_WIN_APP) 58 class ManagedCertificate;
61 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED) 62 class IACImporterAsync;
63 class IACImporterAsyncCB;
68 friend class EventMgr;
69 friend class ClientIfcInternal;
86 virtual void StatsCB(
VPNStats &stats) = 0;
95 virtual void StateCB(
const VPNState state,
111 virtual void BannerCB(
const tstring &banner) = 0;
126 virtual void PreConnectReminderCB(
const tstring &rtstrPreConnectReminder);
140 virtual void NoticeCB(
const tstring ¬ice,
142 const bool bSensitive =
false) = 0;
144 #if defined(PLATFORM_DARWIN) 151 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK) 152 virtual void CertBannerCB(
const tstring &certBannerSummary,
153 const uint32_t nCertBannerCertLen,
154 const uint8_t *pCertBannerCertDer,
155 const std::list<tstring> &confirmReasons,
156 const std::list<CertConfirmReason> &confirmReasonEnums,
157 bool bImportAllowed =
true) = 0;
175 virtual void ExitNoticeCB(
const tstring &tstrNotice,
176 const int returnCode);
187 virtual void ServiceReadyCB() = 0;
217 virtual void WMHintCB(
const WMHint hint,
232 virtual void deliverWebLaunchHostCB(
const tstring &activeHost);
244 virtual void CertBlockedCB(
const tstring &rtstrUntrustedServer) = 0;
259 virtual void CertWarningCB(
const tstring &rtstrUntrustedServer,
260 const std::list<tstring> &rltstrCertErrors,
261 bool bAllowImport) = 0;
263 #if defined(PLATFORM_WIN_APP) 267 virtual void CertWarningCB(
const tstring &rtstrUntrustedServer,
268 const std::list<tstring> &rltstrCertErrors,
269 const std::vector<uint8_t> &rvServerCertDER,
270 bool bAllowImport) = 0;
286 virtual void EventAvailable();
288 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED) 289 virtual void ImportPKCS12ResultCB(
const std::vector<uint8_t> &certHash,
292 #if defined(PLATFORM_ANDROID) 293 virtual void ClientCertificateCB(std::vector< std::pair<uint32_t, uint8_t*> > certList) = 0;
294 virtual void AgentDetachedCB();
297 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED) 301 virtual void EventNotificationInternalCB(
302 const std::shared_ptr<CEventNotificationTlv>& spEventNtfctnTlv) = 0;
309 void ResetQuarantinedReconnect();
311 void ClientIfcTransmigration();
315 bool attach(
const ClientType clientType = ClientType_GUI,
316 const bool requestFullCapabilities =
true,
317 const bool suppressAutoConnect =
true,
318 const bool bSuppressEventAvailableCB =
false);
322 void ProcessEvents();
324 bool hasFullCapabilities();
326 bool isConnected(
bool bSilent =
false);
330 std::list<tstring> getHostNames();
332 std::list<HostEntry> getHostEntries();
337 #
if defined(HOST_DATA_SUPPORTED)
338 const IHostData& host);
344 #
if defined(HOST_DATA_SUPPORTED)
345 const IHostData& host,
349 unsigned int origin);
351 bool setNewTunnelGroup(
const tstring & group);
367 STATE getCurrentState();
374 NETENV_STATE netEnvState = NES_NETWORK_ACCESSIBLE,
377 void setNetworkStates(NETENV_STATE netEnvState,
378 NETCTRL_STATE netCtrlState,
379 NETWORK_TYPE netType,
380 bool bACBrowserForCPRemediation,
382 void refreshOperatingModeForCurrentNetStates();
383 NETENV_STATE getCurrentNetEnvState();
384 NETENV_STATE getPreviousNetEnvState();
385 NETCTRL_STATE getCurrentNetCtrlState();
386 NETWORK_TYPE getCurrentNetType();
387 bool isACBrowserForCPRemediation();
389 static tstring getNetCtrlText(NETCTRL_STATE netCtrlState);
390 static tstring getNetEnvText(NETENV_STATE netEnvState,
391 bool bSimple =
false);
392 static tstring getNetTypeText(NETWORK_TYPE netType);
393 static tstring getQuarantinedStatusText();
394 static tstring getNetworkStatusSimpleText(
const NETENV_STATE netEnvState,
395 const NETCTRL_STATE netCtrlState);
400 const NETENV_STATE netEnvState,
401 const NETCTRL_STATE netCtrlState);
405 bool savePreferences();
413 void setBanner(
const tstring &banner);
414 void setBannerResponse(
bool bResponse);
416 void setPreConnectReminder(
const tstring &tstrPreConnectReminder);
417 void setPreConnectReminderResponse();
419 bool getUserResponse();
420 bool isUserResponseSet();
422 void setCertBlocked(
const tstring &tstrUntrustedServer);
423 void setCertWarning(
const tstring &rtstrUntrustedServer,
424 const std::list<tstring> &rltstrCertErrors,
426 #if defined(PLATFORM_WIN_APP) 427 void setCertWarning(
const tstring &rtstrUntrustedServer,
428 const std::list<tstring> &rltstrCertErrors,
429 const std::vector<uint8_t>& rvServerCertDER,
432 bool getCertImportResponse();
434 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK) 435 void setCertBanner(
tstring tstrCertBannerSummary,
436 uint32_t nCertBannerCertLen,
437 const uint8_t *pCertBannerCertDer,
438 const std::list<tstring> &confirmReasons,
439 const std::list<CertConfirmReason> &confirmReasonEnums,
440 bool bImportAllowed);
442 void setCertBannerResponse(
bool bResponse,
bool bImportCert);
443 void importServerCert(std::vector<uint8_t> certData);
444 bool setFipsMode(
bool bEnableFips);
445 #if defined(PLATFORM_ANDROID) 446 bool setStrictMode(
bool bEnableStrictMode);
447 bool setRevocationEnabled(
bool bRevocationEnabled);
448 bool IsRevocationEnabled();
449 #endif // currently supported only for android 454 #if defined(PLATFORM_ANDROID) 455 void setClientCertResponse(std::vector< std::pair<uint32_t, uint8_t*> > &derList);
456 void setAgentDetached();
457 bool getClientCertificates();
460 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) 461 void setSCEPEnrollInProgress(
bool bInProgress);
462 bool isSCEPEnrollInProgress();
465 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED) 466 void setImportPKCS12Result(
const std::vector<uint8_t> &certHash,
const tstring &tstrError);
467 bool requestImportPKCS12(
const std::vector<uint8_t> &data);
468 std::vector<uint8_t> importPKCS12WithPassword(
const std::vector<uint8_t> &data,
const tstring &password);
471 void setCertBlockedResponse(
bool bUnlock);
472 void setCertWarningResponse(
bool bConnect,
bool bImportCert);
476 void ExitNotice(
const tstring &tstrNotice,
const int code = 0);
478 void notice(
const tstring &tstrNotice,
480 bool bClearLastMsg =
false,
482 bool bStateMsg =
false,
483 bool bSensitiveMsg =
false);
485 void notice(MsgWithArg ¬ice,
487 bool bClearLastMsg =
false,
489 bool bStateMsg =
false,
490 bool bSensitiveMsg =
false);
496 void exportStats(
const tstring &tstrFilePath);
505 bool bUpdateStateMsg =
true,
506 bool bOnlyUpdateUI =
false);
508 #if defined(PLATFORM_DARWIN) 512 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED) 513 IACImporterAsync *createACImporter(IACImporterAsyncCB *pCallback);
516 void setWMHint(
WMHint hint,
525 bool CanRemediateCaptivePortal();
526 bool policyAllowsCaptivePortalRemediation();
528 bool isEventShutdown();
530 bool isUsingEventModel();
532 time_t getLastDisconnectTime();
535 void resetConnectPromptPasswordData();
537 void setStandaloneConnection(
bool isStandalone);
539 void deliverActiveHost(
const tstring &activeHost,
540 ConnectProtocolType vpnProtocol = PROTOCOL_TYPE_UNKNOWN,
541 bool bActiveHostFriendlyName =
false);
543 bool isVPNServiceReady();
547 void resetLastDisconnectTime(time_t time = 1);
549 void processMinimize();
552 void setEnrollClientCert(CertObj* pCert);
556 void linuxCertImportWarnUser();
560 void linuxCertImportWarnUserResponse(
bool bAccept);
562 void setDefaultHost(
tstring &host);
564 #if defined(HOST_DATA_SUPPORTED) 565 void setDefaultHostProfile(
const IHostData &hostProfile);
566 IHostData* getDefaultHostData();
569 void setLastVpnError(
VPNError vpnError);
572 #if defined(PLATFORM_ANDROID) 573 bool requestClientCertificates();
576 bool requestImportLocalization(
const tstring tstrLocale,
577 const std::vector<unsigned char> &MoFileData);
580 void startAHS(
const unsigned int uiReason,
581 const ProxyIfc& proxy);
585 void AHSSelectedHost(
const unsigned int uiReason,
586 const std::vector<tstring> &headendList,
587 const long statusReturnCode,
589 std::vector<tstring> getAHSHostList();
590 unsigned int getAHSState();
592 bool IsAHSCachingRestricted();
594 bool suppressConnectionErrorPopups();
596 tstring getCaptivePortalDetectedMsg();
598 void setProxyAuthPrompts(ProxyIfc* pProxy,
601 #if defined(INTERPROCESS_COMMUNICATION_SUPPORTED) 602 bool handleIpcMessage(CIpcMessage *pIpcMessage);
603 #if defined(VPNAPI_EVENT_NOTIFICATION_SUPPORTED) 604 void eventNotification(
const int &eventCode);
605 void signalDisconnectedToEventNtfctnThread();
606 #endif // VPNAPI_EVENT_NOTIFICATION_SUPPORTED 607 #endif // INTERPROCESS_COMMUNICATION_SUPPORTED 608 bool IsCsdTokenVerified()
const;
610 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) 611 virtual void SCEPEnrollStartCB();
612 virtual void SCEPEnrollExitCB();
615 void activateConnectMgrTunnelInitiationCompletionEvent();
616 bool isConnectRequestActive();
617 bool isConnectRequestCleanup();
618 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK) 619 bool deleteProfileByName(
const tstring &profileName);
621 bool importProfile(
const tstring &profileName,
const tstring &profileContents);
624 bool syncProfileChange(
const tstring &profileName);
626 #if defined(CREDENTIAL_PREFILL_SUPPORTED) 627 bool hasPrefilledCredentials();
629 void setPrefilledCredentials(CredentialPrefill *prefill);
632 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_APPLE_SSLVPN) 633 std::list<ManagedCertificate *> enumerateCertificates(CertificateType certType);
634 bool deleteCertificates(CertificateType certType,
const std::list<std::string> &idList);
635 bool deleteServerCertificates(
const std::list<std::string> &idList);
638 #if defined(ANYCONNECT_USE_SNAK) && !defined(PLATFORM_WIN_APP) 639 std::list<ManagedCertificate *> enumerateSNAKCertificates(SNAK_CertType certType);
640 SNAK_CertType getSNAKCertType(CertificateType certType);
641 bool deleteClientCertificates(
const std::list<std::string> &idList);
644 #if defined(PLATFORM_APPLE_SSLVPN) 645 bool canUseBackupServers();
650 tstring getMgmtTunnelHostname();
652 VPN_TUNNEL_SCOPE getVpnTunnelScope();
654 bool isStandaloneConnection();
658 void setExternalSSOLogoutUrlFromAgent(
const tstring& logoutUrl);
666 #if defined(VPNAPI_TRANSMIGRATION_SUPPORTED) 667 std::shared_ptr<CSharedAccessLock> m_spClientIfcInternalPtrSharedAccessLock;
669 std::unique_ptr<ClientIfcInternal> m_upClientIfcInternal;
682 #endif // _CLIENTIFCBASE_
ConnectPromptType
Definition: api.h:244
Definition: PreferenceInfo.h:26
Definition: ApprovalStatus.h:35
WMHintReason
Definition: api.h:220
VPNDisconnectReason
Definition: api.h:188
VPNState
Definition: api.h:146
Definition: ClientIfcBase.h:66
#define tstring
Definition: api.h:35
WMHint
Definition: api.h:201
Definition: ConnectPromptInfo.h:37
MessageType
Definition: api.h:108
OperatingMode
Definition: api.h:545
VPNSubState
Definition: api.h:170
VPNError
Definition: api.h:597
Definition: VPNStats.h:35