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);
358 NETENV_STATE netEnvState = NES_NETWORK_ACCESSIBLE,
361 void setNetworkStates(NETENV_STATE netEnvState,
362 NETCTRL_STATE netCtrlState,
363 NETWORK_TYPE netType,
364 bool bACBrowserForCPRemediation,
366 void refreshOperatingModeForCurrentNetStates();
367 NETENV_STATE getCurrentNetEnvState();
368 NETENV_STATE getPreviousNetEnvState();
369 NETCTRL_STATE getCurrentNetCtrlState();
370 NETWORK_TYPE getCurrentNetType();
371 bool isACBrowserForCPRemediation();
373 static tstring getNetCtrlText(NETCTRL_STATE netCtrlState);
374 static tstring getNetEnvText(NETENV_STATE netEnvState,
375 bool bSimple =
false);
376 static tstring getNetTypeText(NETWORK_TYPE netType);
377 static tstring getQuarantinedStatusText();
378 static tstring getNetworkStatusSimpleText(
const NETENV_STATE netEnvState,
379 const NETCTRL_STATE netCtrlState);
384 const NETENV_STATE netEnvState,
385 const NETCTRL_STATE netCtrlState);
389 bool savePreferences();
397 void setBanner(
const tstring &banner);
398 void setBannerResponse(
bool bResponse);
400 void setPreConnectReminder(
const tstring &tstrPreConnectReminder);
401 void setPreConnectReminderResponse();
403 bool getUserResponse();
404 bool isUserResponseSet();
406 void setCertBlocked(
const tstring &tstrUntrustedServer);
407 void setCertWarning(
const tstring &rtstrUntrustedServer,
408 const std::list<tstring> &rltstrCertErrors,
410 #if defined(PLATFORM_WIN_APP)
411 void setCertWarning(
const tstring &rtstrUntrustedServer,
412 const std::list<tstring> &rltstrCertErrors,
413 const std::vector<uint8_t>& rvServerCertDER,
416 bool getCertImportResponse();
418 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
419 void setCertBanner(
tstring tstrCertBannerSummary,
420 uint32_t nCertBannerCertLen,
421 const uint8_t *pCertBannerCertDer,
422 const std::list<tstring> &confirmReasons,
423 const std::list<CertConfirmReason> &confirmReasonEnums,
424 bool bImportAllowed);
426 void setCertBannerResponse(
bool bResponse,
bool bImportCert);
427 void importServerCert(std::vector<uint8_t> certData);
428 bool setFipsMode(
bool bEnableFips);
429 #if defined(PLATFORM_ANDROID)
430 bool setStrictMode(
bool bEnableStrictMode);
431 bool setRevocationEnabled(
bool bRevocationEnabled);
432 bool IsRevocationEnabled();
433 #endif // currently supported only for android
438 #if defined(PLATFORM_ANDROID)
439 void setClientCertResponse(std::vector< std::pair<uint32_t, uint8_t*> > &derList);
440 void setAgentDetached();
441 bool getClientCertificates();
444 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
445 void setSCEPEnrollInProgress(
bool bInProgress);
446 bool isSCEPEnrollInProgress();
449 #if defined(MANUAL_PKCS12_IMPORT_SUPPORTED)
450 void setImportPKCS12Result(
const std::vector<uint8_t> &certHash,
const tstring &tstrError);
451 bool requestImportPKCS12(
const std::vector<uint8_t> &data);
452 std::vector<uint8_t> importPKCS12WithPassword(
const std::vector<uint8_t> &data,
const tstring &password);
455 void setCertBlockedResponse(
bool bUnlock);
456 void setCertWarningResponse(
bool bConnect,
bool bImportCert);
460 void ExitNotice(
const tstring &tstrNotice,
const int code = 0);
462 void notice(
const tstring &tstrNotice,
464 bool bClearLastMsg =
false,
466 bool bStateMsg =
false,
467 bool bSensitiveMsg =
false);
469 void notice(MsgWithArg ¬ice,
471 bool bClearLastMsg =
false,
473 bool bStateMsg =
false,
474 bool bSensitiveMsg =
false);
480 void exportStats(
const tstring &tstrFilePath);
489 bool bUpdateStateMsg =
true,
490 bool bOnlyUpdateUI =
false);
492 #if defined(PROGRAM_DATA_IMPORT_SUPPORTED)
493 IACImporterAsync *createACImporter(IACImporterAsyncCB *pCallback);
496 void setWMHint(
WMHint hint,
505 bool CanRemediateCaptivePortal();
506 bool policyAllowsCaptivePortalRemediation();
508 bool isEventShutdown();
510 bool isUsingEventModel();
512 time_t getLastDisconnectTime();
515 void resetConnectPromptPasswordData();
517 void setStandaloneConnection(
bool isStandalone);
519 void deliverActiveHost(
const tstring &activeHost,
520 ConnectProtocolType vpnProtocol = PROTOCOL_TYPE_UNKNOWN,
521 bool bActiveHostFriendlyName =
false);
523 bool isVPNServiceReady();
527 void resetLastDisconnectTime(time_t time = 1);
529 void processMinimize();
532 void setEnrollClientCert(CertObj* pCert);
536 void linuxCertImportWarnUser();
540 void linuxCertImportWarnUserResponse(
bool bAccept);
542 void setDefaultHost(
tstring &host);
544 #if defined(HOST_DATA_SUPPORTED)
545 void setDefaultHostProfile(
const IHostData &hostProfile);
546 IHostData* getDefaultHostData();
549 void setLastVpnError(
VPNError vpnError);
552 #if defined(PLATFORM_ANDROID)
553 bool requestClientCertificates();
556 bool requestImportLocalization(
const tstring tstrLocale,
557 const std::vector<unsigned char> &MoFileData);
560 void startAHS(
const unsigned int uiReason,
561 const ProxyIfc& proxy);
565 void AHSSelectedHost(
const unsigned int uiReason,
566 const std::vector<tstring> &headendList,
567 const long statusReturnCode,
569 std::vector<tstring> getAHSHostList();
570 unsigned int getAHSState();
572 bool IsAHSCachingRestricted();
574 bool suppressConnectionErrorPopups();
576 tstring getCaptivePortalDetectedMsg();
578 void setProxyAuthPrompts(ProxyIfc* pProxy,
581 #if defined(INTERPROCESS_COMMUNICATION_SUPPORTED)
582 bool handleIpcMessage(CIpcMessage *pIpcMessage);
584 bool IsCsdTokenVerified()
const;
586 #if defined(PLATFORM_APPLE_SSLVPN) || defined(PLATFORM_ANDROID)
587 virtual void SCEPEnrollStartCB();
588 virtual void SCEPEnrollExitCB();
591 void activateConnectMgrTunnelInitiationCompletionEvent();
592 bool isConnectRequestActive();
593 bool isConnectRequestCleanup();
594 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_CHROMEBOOK)
595 bool deleteProfileByName(
const tstring &profileName);
597 bool importProfile(
const tstring &profileName,
const tstring &profileContents);
600 bool syncProfileChange(
const tstring &profileName);
602 #if defined(CREDENTIAL_PREFILL_SUPPORTED)
603 bool hasPrefilledCredentials();
605 void setPrefilledCredentials(CredentialPrefill *prefill);
608 #if defined(PLATFORM_ANDROID) || defined(PLATFORM_APPLE_SSLVPN)
609 std::list<ManagedCertificate *> enumerateCertificates(CertificateType certType);
610 bool deleteCertificates(CertificateType certType,
const std::list<std::string> &idList);
611 bool deleteServerCertificates(
const std::list<std::string> &idList);
614 #if defined(ANYCONNECT_USE_SNAK) && !defined(PLATFORM_WIN_APP)
615 std::list<ManagedCertificate *> enumerateSNAKCertificates(SNAK_CertType certType);
616 SNAK_CertType getSNAKCertType(CertificateType certType);
617 bool deleteClientCertificates(
const std::list<std::string> &idList);
620 #if defined(PLATFORM_APPLE_SSLVPN)
621 bool canUseBackupServers();
626 tstring getMgmtTunnelHostname();
628 VPN_TUNNEL_SCOPE getVpnTunnelScope();
630 bool isStandaloneConnection();
634 void setExternalSSOLogoutUrlFromAgent(
const tstring& logoutUrl);
642 std::unique_ptr<ClientIfcInternal> m_upClientIfcInternal;
655 #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