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