![]() |
AnyConnect Secure Mobility Client 4.4.00243
|
00001 /******************************************************************************\ 00002 * This sample is supplied as is with no implied warranty. 00003 * It is designed to assist you in using the Cisco AnyConnect VPN API. 00004 * It is assumed that you will build a production application and 00005 * refer to this sample as a reference only. 00006 \*****************************************************************************/ 00007 00008 #ifndef _CLICLIENTIMPL_ 00009 #define _CLICLIENTIMPL_ 00010 00011 00012 #include <stdio.h> 00013 #include <stdlib.h> 00014 #include "ClientIfc.h" 00015 00016 enum RequestType { REQ_CONNECT, REQ_GROUPLIST, REQ_END }; 00017 00018 /** 00019 * This is an example application demonstrating the implementation of the 00020 * AnyConnect API 00021 */ 00022 00023 00024 class CLIClientImpl : public ClientIfc 00025 { 00026 public: 00027 00028 CLIClientImpl(); 00029 virtual ~CLIClientImpl(); 00030 00031 // The following methods are for support and not considered part of 00032 // the main API interface. 00033 00034 void printHostList(); 00035 00036 void printDefaultHost(); 00037 00038 void connect(std::string host, std::string user, 00039 std::string password, std::string group); 00040 00041 void disconnect(); 00042 00043 void showGroups(std::string host); 00044 00045 /** 00046 * This method demonstrates accessing the statistics data delivered 00047 * via the ClientIfc::StatsCB method. 00048 */ 00049 void getStats(); 00050 00051 /** 00052 * Method with example of parsing ConnectPromptInfo. 00053 * 00054 * This method is triggered by an API call on the method 00055 * UserPromptCB(ConnectPromptInfo &). 00056 */ 00057 void setUserData(ConnectPromptInfo &ConnectPrompt); 00058 00059 void printGroupList(ConnectPromptInfo &ConnectPrompt); 00060 00061 std::wstring convertMultiByteToWide(const std::string &sInputData); 00062 00063 protected: 00064 00065 void StatsCB(VPNStats &stats); 00066 00067 void StateCB(const VPNState state, 00068 const VPNSubState subState, 00069 const tstring stateString); 00070 00071 void BannerCB(const tstring &banner); 00072 00073 void NoticeCB(const tstring notice, 00074 const MessageType type); 00075 00076 void ExitNoticeCB(const tstring ¬ice, 00077 const int returnCode); 00078 00079 void ServiceReadyCB(); 00080 00081 void UserPromptCB(ConnectPromptInfo &ConnectPrompt); 00082 00083 void CertBlockedCB(const tstring &rtstrUntrustedServer); 00084 void CertWarningCB(const tstring &rtstrUntrustedServer, 00085 const std::list<tstring> &rltstrCertErrors, 00086 bool bAllowImport); 00087 00088 00089 private: 00090 00091 RequestType me_RequestType; 00092 00093 tstring ms_user, 00094 ms_pswd, 00095 ms_group; 00096 00097 VPNStats mo_VPNStats; 00098 00099 }; 00100 00101 00102 #endif // _CLICLIENTIMPL_