AnyConnect Secure Mobility Client
3.1.07021
|
00001 /************************************************************************** 00002 * Copyright (c) 2008, Cisco Systems, All Rights Reserved 00003 *************************************************************************** 00004 * 00005 * File: VpnStatsBase.h 00006 * Date: 01/2008 00007 * 00008 *************************************************************************** 00009 * 00010 * VPN Statistics base class implementation for the Client API. 00011 * 00012 ***************************************************************************/ 00013 #ifndef _VPNSTATSBASE_ 00014 #define _VPNSTATSBASE_ 00015 00016 #include <list> 00017 #ifdef _WIN32 00018 typedef unsigned long uint32_t; 00019 #else 00020 #include <stdint.h> 00021 #endif 00022 00023 #include "ProtocolInfo.h" 00024 #include "RouteInfo.h" 00025 #include "api.h" 00026 00027 00028 // This is the base class for VPNStats. It provides underlying functionality 00029 // and data storage. The intent is to expose only what is needed by a user 00030 // of the API in the VPNStats class. 00031 // 00032 00033 class CStatisticsTlv; 00034 class CStateTlv; 00035 class CSessionInfoTlv; 00036 class CManualLock; 00037 class FirewallInfo; 00038 class CExtensibleStats; 00039 00040 class VPN_VPNAPI VPNStatsBase 00041 { 00042 public: 00043 00044 // various ctor 00045 // 00046 VPNStatsBase(); 00047 VPNStatsBase(const VPNStatsBase &existing); 00048 VPNStatsBase & operator= (const VPNStatsBase &); 00049 00050 virtual ~VPNStatsBase(); 00051 00052 // get a list of Secure Routes. 00053 // Method returns a list of RouteInfo pointers 00054 // 00055 const std::list<RouteInfo *> &getSecureRoutes(); 00056 00057 // get a list of Nonsecure Routes. 00058 // Method returns a list of RouteInfo pointers 00059 // 00060 const std::list<RouteInfo *> &getNonsecureRoutes(); 00061 00062 // get a list of protocol Info objects. 00063 // Method returns a list of ProtocolInfo pointers 00064 // 00065 const std::list<ProtocolInfo *> &getProtocolInfo(); 00066 00067 // get a list of firewall Info objects. 00068 // Method returns a list of FirewallInfo pointers 00069 // 00070 const std::list<FirewallInfo *> &getFirewallInfo(); 00071 00072 // method used to retireve statistices by name. 00073 // 00074 const tstring &getStatValue(tstring &label); 00075 00076 void setConnectionStatistics(CStatisticsTlv *connectionStats); 00077 00078 bool ClearConnectionStatistics(); 00079 00080 bool ClearVPNSessionStats(); 00081 00082 // these two methods are helpers used to make sure SessionInfo 00083 // is available. 00084 // 00085 bool hasSessionInfo(); 00086 00087 bool IsFirewallInfoEqual (VPNStatsBase &stats); 00088 00089 void setDisconnected(); 00090 00091 // allow for updating state data. Returns the state that should 00092 // be displayed to the user. 00093 // 00094 // TODO: Paul agreed to removing dependency on Gendefs 00095 // he'll perform the actual commit for this 00096 bool setStateInfo(CStateTlv* stateInfo, 00097 STATE& rSessionState, 00098 VPNCON_SUBSTATE& rSessionSubState, 00099 NETENV_STATE& rNetEnvState, 00100 NETCTRL_STATE& rNetCtrlState, 00101 NETWORK_TYPE& rNetType); 00102 00103 // allow for updating sessionInfo data 00104 // 00105 void setSessionInfo(CSessionInfoTlv *sessionInfo); 00106 00107 // set the client operating Mode 00108 // 00109 void setClientOperatingMode(uint32_t operatingMode); 00110 00111 static const tstring::value_type* const* getVpnStatsStringTable(); 00112 00113 void StreamStats(tostream &outStream); 00114 00115 protected: 00116 static const tstring::value_type* const sm_pVpnStatsStringTable[]; 00117 00118 private: 00119 ApiStringMap mo_StatNameValue; 00120 ApiStringMap mo_SessionStats; 00121 00122 tstring ms_CurrentState; 00123 00124 bool mb_GotSessionInfo; 00125 00126 std::list<RouteInfo *> mlop_SecureRoutes; 00127 std::list<RouteInfo *> mlop_NonsecureRoutes; 00128 00129 std::list<ProtocolInfo *> mlop_ProtocolInfo; 00130 00131 std::list<FirewallInfo *> mlop_FirewallInfo; 00132 00133 static CManualLock sm_statsLock; 00134 00135 static tstring EmptyString; 00136 static tstring NotAvailable; 00137 00138 ApiStringMap &getStatsMap(); 00139 ApiStringMap &getSessionStatsMap(); 00140 00141 void setStatValue(tstring &label, tstring value); 00142 void setStatValue(ApiStringMap &map, tstring &label, tstring value); 00143 00144 void synchronizeLists(const VPNStatsBase &existing); 00145 00146 void clearProtocolInfo(); 00147 void clearSecureRoutes(); 00148 void clearNonSecureRoutes(); 00149 void clearFirewallInfo(); 00150 00151 void init(); 00152 00153 void setIndividualStats(CExtensibleStats *stats); 00154 00155 friend VPN_VPNAPI tostream& operator<<(tostream &outStream, 00156 VPNStatsBase &stats); 00157 00158 }; 00159 00160 00161 #endif // _VPNSTATSBASE_