| AnyConnect Secure Mobility Client 5.0.00556

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# examples/CLI/CLIClientImpl.h

    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 PreConnectReminderCB(const tstring &rtstrPreConnectReminder);
    00074
    00075         void NoticeCB(const tstring &notice,
    00076                       const MessageType type,
    00077                       const bool bSensitive = false);
    00078
    00079         void ExitNoticeCB(const tstring &notice,
    00080                           const int returnCode);
    00081
    00082         void ServiceReadyCB();
    00083
    00084         void UserPromptCB(ConnectPromptInfo &ConnectPrompt);
    00085
    00086         void CertBlockedCB(const tstring &rtstrUntrustedServer);
    00087         void CertWarningCB(const tstring &rtstrUntrustedServer,
    00088                            const std::list<tstring> &rltstrCertErrors,
    00089                            bool bAllowImport);
    00090
    00091
    00092     private:
    00093
    00094         RequestType me_RequestType;
    00095
    00096         tstring ms_user,
    00097                 ms_pswd,
    00098                 ms_group;
    00099
    00100         VPNStats mo_VPNStats;
    00101
    00102 };
    00103
    00104
    00105 #endif // _CLICLIENTIMPL_