AnyConnect Secure Mobility Client 4.8.02045

include/ProtocolInfo.h

00001 /**************************************************************************
00002 *       Copyright (c) 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          * Alias for getProtocolValue.
00064          */
00065         const tstring &getValue(tstring &label) { return getProtocolValue(label); }
00066 
00067         /**
00068          * Return true if this is the active protocol.
00069          */
00070         bool isActive();
00071 
00072         ProtocolInfo(const ProtocolInfo *pInfo);
00073         ProtocolInfo(STATE tunnelState,
00074                      ProtocolVersion protocolVersion,
00075                      ProtocolCipher  protocolCipher,
00076                      COMPR_ALGORITHM comprAlgorithm,
00077                      bool bIsActive);
00078 
00079         ~ProtocolInfo();
00080 
00081 
00082         //This method is not intended to be used by a consumers of the API.
00083         //
00084         static const tstring::value_type* const* getProtocolInfoStringTable();
00085 
00086 protected:
00087         static const tstring::value_type* const sm_pProtocolInfoStringTable[];
00088 
00089 private:
00090 
00091         static tstring EmptyString;
00092 
00093         bool mb_isActive;
00094 
00095         ApiStringMap mo_ProtocolNameValue;
00096 
00097         ApiStringMap &getProtocolMap();
00098     
00099         friend VPN_VPNAPI tostream& operator<<(tostream &outStream,
00100                                                VPNStatsBase& stats);
00101 };
00102 
00103 
00104 #endif // _PROTOCOL_INFO_