14 #ifndef _CLIENTIFCBASE_
15 #define _CLIENTIFCBASE_
22 #include "ClientIfcCommon.h"
24 #if defined(ANYCONNECT_USE_SNAK)
25 #include "SNAK_CertPlugin.h"
28 #if defined(HOST_DATA_SUPPORTED)
40 class CEventNotificationTlv;
41 class ClientIfcInternal;
43 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
44 class CredentialPrefill;
47 #if (defined(ANYCONNECT_USE_SNAK) || defined(PLATFORM_APPLE_SSLVPN)) && !defined(PLATFORM_WIN_APP)
48 class ManagedCertificate;
49 #endif // ANYCONNECT_USE_SNAK || PLATFORM_APPLE_SSLVPN
51 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED)
52 class IACImporterAsync;
53 class IACImporterAsyncCB;
58 friend class EventMgr;
59 friend class ClientIfcInternal;
133 const bool bSensitive =
false) = 0;
135 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
136 virtual void CertBannerCB(
const tstring &certBannerSummary,
137 const uint32_t nCertBannerCertLen,
138 const uint8_t *pCertBannerCertDer,
139 const std::list<tstring> &confirmReasons,
140 const std::list<CertConfirmReason> &confirmReasonEnums,
141 bool bImportAllowed =
true) = 0;
160 const int returnCode);
244 const std::list<tstring> &rltstrCertErrors,
245 bool bAllowImport) = 0;
247 #if defined(PLATFORM_WIN_APP)
251 virtual void CertWarningCB(
const tstring &rtstrUntrustedServer,
252 const std::list<tstring> &rltstrCertErrors,
253 const std::vector<uint8_t> &rvServerCertDER,
254 bool bAllowImport) = 0;
272 #ifdef MANUAL_PKCS12_IMPORT_SUPPORTED
273 virtual void ImportPKCS12ResultCB(
const std::vector<uint8_t> &certHash,
276 #ifdef PLATFORM_ANDROID
277 virtual void ClientCertificateCB(std::vector< std::pair<uint32_t, uint8_t*> > certList) = 0;
278 virtual void AgentDetachedCB();
285 const std::shared_ptr<CEventNotificationTlv>& spEventNtfctnTlv) = 0;
295 bool attach(
const ClientType clientType = ClientType_GUI,
296 const bool requestFullCapabilities =
true,
297 const bool suppressAutoConnect =
true,
298 const bool bSuppressEventAvailableCB =
false);
302 void ProcessEvents();
304 bool hasFullCapabilities();
306 bool isConnected(
bool bSilent =
false);
310 std::list<tstring> getHostNames();
312 std::list<HostEntry> getHostEntries();
317 #
if defined(HOST_DATA_SUPPORTED)
318 const IHostData& host);
324 #
if defined(HOST_DATA_SUPPORTED)
325 const IHostData& host,
329 unsigned int origin);
331 bool setNewTunnelGroup(
const tstring & group);
350 NETENV_STATE netEnvState = NES_NETWORK_ACCESSIBLE,
353 void setNetworkStates(NETENV_STATE netEnvState,
354 NETCTRL_STATE netCtrlState,
355 NETWORK_TYPE netType,
356 bool bACBrowserForCPRemediation,
358 void refreshOperatingModeForCurrentNetStates();
359 NETENV_STATE getCurrentNetEnvState();
360 NETENV_STATE getPreviousNetEnvState();
361 NETCTRL_STATE getCurrentNetCtrlState();
362 NETWORK_TYPE getCurrentNetType();
363 bool isACBrowserForCPRemediation();
365 static tstring getNetCtrlText(NETCTRL_STATE netCtrlState);
366 static tstring getNetEnvText(NETENV_STATE netEnvState,
367 bool bSimple =
false);
368 static tstring getNetTypeText(NETWORK_TYPE netType);
369 static tstring getQuarantinedStatusText();
370 static tstring getNetworkStatusSimpleText(
const NETENV_STATE netEnvState,
371 const NETCTRL_STATE netCtrlState);
376 const NETENV_STATE netEnvState,
377 const NETCTRL_STATE netCtrlState);
381 bool savePreferences();
389 void setBanner(
const tstring &banner);
390 void setBannerResponse(
bool bResponse);
392 void setPreConnectReminder(
const tstring &tstrPreConnectReminder);
393 void setPreConnectReminderResponse();
395 bool getUserResponse();
396 bool isUserResponseSet();
398 void setCertBlocked(
const tstring &tstrUntrustedServer);
399 void setCertWarning(
const tstring &rtstrUntrustedServer,
400 const std::list<tstring> &rltstrCertErrors,
402 #if defined(PLATFORM_WIN_APP)
403 void setCertWarning(
const tstring &rtstrUntrustedServer,
404 const std::list<tstring> &rltstrCertErrors,
405 const std::vector<uint8_t>& rvServerCertDER,
408 bool getCertImportResponse();
410 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
411 void setCertBanner(
tstring tstrCertBannerSummary,
412 uint32_t nCertBannerCertLen,
413 const uint8_t *pCertBannerCertDer,
414 const std::list<tstring> &confirmReasons,
415 const std::list<CertConfirmReason> &confirmReasonEnums,
416 bool bImportAllowed);
418 void setCertBannerResponse(
bool bResponse,
bool bImportCert);
419 void importServerCert(std::vector<uint8_t> certData);
420 bool setFipsMode(
bool bEnableFips);
421 #if defined(PLATFORM_ANDROID)
422 bool setStrictMode(
bool bEnableStrictMode);
423 bool setRevocationEnabled(
bool bRevocationEnabled);
424 bool IsRevocationEnabled();
425 #endif // currently supported only for android
430 #ifdef PLATFORM_ANDROID
431 void setClientCertResponse(std::vector< std::pair<uint32_t, uint8_t*> > &derList);
432 void setAgentDetached();
433 bool getClientCertificates();
436 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
437 void setSCEPEnrollInProgress(
bool bInProgress);
438 bool isSCEPEnrollInProgress();
439 #endif // PLATFORM_APPLE_SSLVPN || PLATFORM_ANDROID
441 #ifdef MANUAL_PKCS12_IMPORT_SUPPORTED
442 void setImportPKCS12Result(
const std::vector<uint8_t> &certHash,
const tstring &tstrError);
443 bool requestImportPKCS12(
const std::vector<uint8_t> &data);
444 std::vector<uint8_t> importPKCS12WithPassword(
const std::vector<uint8_t> &data,
const tstring &password);
447 void setCertBlockedResponse(
bool bUnlock);
448 void setCertWarningResponse(
bool bConnect,
bool bImportCert);
452 void ExitNotice(
const tstring &tstrNotice,
const int code = 0);
454 void notice(
const tstring &tstrNotice,
456 bool bClearLastMsg =
false,
458 bool bStateMsg =
false,
459 bool bSensitiveMsg =
false);
461 void notice(MsgWithArg ¬ice,
463 bool bClearLastMsg =
false,
465 bool bStateMsg =
false,
466 bool bSensitiveMsg =
false);
472 void exportStats(
const tstring &tstrFilePath);
481 bool bUpdateStateMsg =
true,
482 bool bOnlyUpdateUI =
false);
484 #ifdef PROGRAM_DATA_IMPORT_SUPPORTED
485 IACImporterAsync *createACImporter(IACImporterAsyncCB *pCallback);
488 void setWMHint(
WMHint hint,
497 bool CanRemediateCaptivePortal();
498 bool policyAllowsCaptivePortalRemediation();
500 bool isEventShutdown();
502 bool isUsingEventModel();
504 time_t getLastDisconnectTime();
507 void resetConnectPromptPasswordData();
509 void setStandaloneConnection(
bool isStandalone);
511 void deliverActiveHost(
const tstring &activeHost,
512 ConnectProtocolType vpnProtocol = PROTOCOL_TYPE_UNKNOWN,
513 bool bActiveHostFriendlyName =
false);
515 bool isVPNServiceReady();
519 void resetLastDisconnectTime(time_t time = 1);
521 void processMinimize();
524 void setEnrollClientCert(CertObj* pCert);
528 void linuxCertImportWarnUser();
532 void linuxCertImportWarnUserResponse(
bool bAccept);
534 void setDefaultHost(
tstring &host);
536 #if defined(HOST_DATA_SUPPORTED)
537 void setDefaultHostProfile(
const IHostData &hostProfile);
538 IHostData* getDefaultHostData();
539 #endif // HOST_DATA_SUPPORTED
541 void setLastVpnError(
VPNError vpnError);
544 #ifdef PLATFORM_ANDROID
545 bool requestClientCertificates();
548 bool requestImportLocalization(
const tstring tstrLocale,
549 const std::vector<unsigned char> &MoFileData);
552 void startAHS(
const unsigned int uiReason,
553 const ProxyIfc& proxy);
557 void AHSSelectedHost(
const unsigned int uiReason,
558 const std::vector<tstring> &headendList,
559 const long statusReturnCode,
561 std::vector<tstring> getAHSHostList();
562 unsigned int getAHSState();
565 bool suppressConnectionErrorPopups();
567 tstring getCaptivePortalDetectedMsg();
569 void setProxyAuthPrompts(ProxyIfc* pProxy,
572 #if defined(INTERPROCESS_COMMUNICATION_SUPPORTED)
573 bool handleIpcMessage(CIpcMessage *pIpcMessage);
575 bool IsCsdTokenVerified()
const;
577 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
578 virtual void SCEPEnrollStartCB();
579 virtual void SCEPEnrollExitCB();
580 #endif // PLATFORM_APPLE_SSLVPN || PLATFORM_ANDROID
582 void activateConnectMgrTunnelInitiationCompletionEvent();
583 bool isConnectRequestActive();
584 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
585 bool deleteProfileByName(
const tstring &profileName);
587 bool importProfile(
const tstring &profileName,
const tstring &profileContents);
588 #endif // PLATFORM_ANDROID || PLATFORM_CHROMEBOOK
590 bool syncProfileChange(
const tstring &profileName);
592 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
593 bool hasPrefilledCredentials();
595 void setPrefilledCredentials(CredentialPrefill *prefill);
598 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_APPLE_SSLVPN)
599 std::list<ManagedCertificate *> enumerateCertificates(CertificateType certType);
600 bool deleteCertificates(CertificateType certType,
const std::list<std::string> &idList);
601 bool deleteServerCertificates(
const std::list<std::string> &idList);
602 #endif // ANYCONNECT_USE_SNAK || PLATFORM_APPLE_SSLVPN
604 #if defined(ANYCONNECT_USE_SNAK) && !defined(PLATFORM_WIN_APP)
605 std::list<ManagedCertificate *> enumerateSNAKCertificates(SNAK_CertType certType);
606 SNAK_CertType getSNAKCertType(CertificateType certType);
607 bool deleteClientCertificates(
const std::list<std::string> &idList);
608 #endif // ANYCONNECT_USE_SNAK
610 #if defined(PLATFORM_APPLE_SSLVPN)
611 bool canUseBackupServers();
613 #endif //PLATFORM_APPLE_SSLVPN
617 tstring getMgmtTunnelHostname();
619 VPN_TUNNEL_SCOPE getVpnTunnelScope();
621 bool isStandaloneConnection();
625 void setExternalSSOLogoutUrlFromAgent(
const tstring& logoutUrl);
633 ClientIfcInternal* m_pClientIfcInternal;
646 #endif // _CLIENTIFCBASE_