AnyConnect Secure Mobility Client 4.4.00243

include/ProtocolInfo.h

00001 /**************************************************************************
00002 *       Copyright © 2006, Cisco Systems, All Rights Reserved
00003 ***************************************************************************
00004 *
00005 *  File:    ProtocolInfo.h
00006 *  Date:    12/2006
00007 *
00008 ***************************************************************************
00009 *
00010 *   Protocol info class implementation for the Client API.
00011 *
00012 ***************************************************************************/
00013 #ifndef _PROTOCOL_INFO_
00014 #define _PROTOCOL_INFO_
00015 
00016 
00017 #include "api.h"
00018 #include <iostream>
00019 
00020 
00021 class VPNStatsBase;
00022 
00023 /**
00024  * Use this class to retrieve details regarding the protocol in use for the
00025  * VPN tunnel.  These details include State, Protocol, Cipher and Compression.
00026  *
00027  * It's possible multiple ProtocolInfo objects (for example, one each for TLS
00028  * and DTLS protocol) are available.  To check whether the Protocol for a given
00029  * instance of ProtocolInfo is the currently active one, use the
00030  * ProtocolInfo::isActive method.
00031  */
00032 
00033 class VPN_VPNAPI ProtocolInfo
00034 {
00035     public:
00036 
00037         static tstring State;       /**< Use ProtocolInfo::getProtocolValue
00038                                          with this tag to get the current
00039                                          state of the referenced protocol.  The
00040                                          returned state is a localized
00041                                          string. */ 
00042         static tstring Protocol;    /**< Use ProtocolInfo::getProtocolValue
00043                                          with this tag to get the protocol
00044                                          value (for example, DTLS). */
00045         static tstring Cipher;      /**< Use ProtocolInfo::getProtocolValue
00046                                          with this tag to get the Cipher
00047                                          value (for example, RSA_AES_256_SHA1). */
00048         static tstring Compression; /**< Use ProtocolInfo::getProtocolValue
00049                                          with this tag to get the Compression
00050                                          value (for example, Deflate).  The returned
00051                                          compression value is a localized
00052                                          string. */
00053 
00054         /**
00055          * Use this method to retrieve various protocol related values.
00056          * The valid labels or tags to use in this retrieval include: State,
00057          * Protocol, Cipher and Compression.
00058          * (for example, getProtocolValue(State), getProtocolValue(Protocol), etc.)
00059          */
00060         const tstring &getProtocolValue(tstring &label);
00061 
00062         /**
00063          * Return true if this is the active protocol.
00064          */
00065         bool isActive();
00066 
00067         ProtocolInfo(const ProtocolInfo *pInfo);
00068         ProtocolInfo(STATE tunnelState,
00069                      ProtocolVersion protocolVersion,
00070                      ProtocolCipher  protocolCipher,
00071                      COMPR_ALGORITHM comprAlgorithm,
00072                      bool bIsActive);
00073 
00074         ~ProtocolInfo();
00075 
00076 
00077         //This method is not intended to be used by a consumers of the API.
00078         //
00079         static const tstring::value_type* const* getProtocolInfoStringTable();
00080 
00081 protected:
00082         static const tstring::value_type* const sm_pProtocolInfoStringTable[];
00083 
00084 private:
00085 
00086         static tstring EmptyString;
00087 
00088         bool mb_isActive;
00089 
00090         ApiStringMap mo_ProtocolNameValue;
00091 
00092         ApiStringMap &getProtocolMap();
00093     
00094         friend VPN_VPNAPI tostream& operator<<(tostream &outStream,
00095                                                VPNStatsBase& stats);
00096 };
00097 
00098 
00099 #endif // _PROTOCOL_INFO_