| AnyConnect Secure Mobility Client 5.1.3.62

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# include/VPNStatsBase.h

    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 #if defined(_WIN32) && (_MSC_VER < 1800)
    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         // Returns the number of applied secure routes for the specified IP protocol.
    00058         // This may be different from the number of routes
    00059         // pushed to UI, which cannot exceed 200.
    00060         //
    00061         uint16_t getAppliedSecureRouteCount(bool bIPv6)
    00062         {
    00063             return (bIPv6 ? m_uiAppliedSecureRouteCountV6 :
    00064                             m_uiAppliedSecureRouteCountV4);
    00065         }
    00066
    00067         // get a list of Nonsecure Routes.
    00068         // Method returns a list of RouteInfo pointers
    00069         //
    00070         const std::list<RouteInfo *> &getNonsecureRoutes();
    00071
    00072         // Returns the number of applied non-secure routes for the specified IP protocol.
    00073         // This may be different from the number of routes
    00074         // pushed to UI, which cannot exceed 200.
    00075         uint16_t getAppliedNonsecureRouteCount(bool bIPv6)
    00076         {
    00077             return (bIPv6 ? m_uiAppliedNonsecureRouteCountV6 :
    00078                             m_uiAppliedNonsecureRouteCountV4);
    00079         }
    00080
    00081         // get a list of protocol Info objects.
    00082         // Method returns a list of ProtocolInfo pointers
    00083         //
    00084         const std::list<ProtocolInfo *> &getProtocolInfo();
    00085
    00086         // get a list of firewall Info objects.
    00087         // Method returns a list of FirewallInfo pointers
    00088         //
    00089         const std::list<FirewallInfo *> &getFirewallInfo();
    00090
    00091         // method used to retireve statistices by name.
    00092         //
    00093         const tstring &getStatValue(tstring &label);
    00094
    00095         void setConnectionStatistics(CStatisticsTlv *connectionStats);
    00096
    00097         bool ClearConnectionStatistics();
    00098
    00099         bool ClearVPNSessionStats();
    00100
    00101         // these two methods are helpers used to make sure SessionInfo
    00102         // is available.
    00103         //
    00104         bool hasSessionInfo();
    00105
    00106         bool IsFirewallInfoEqual (VPNStatsBase &stats);
    00107
    00108         void setDisconnected();
    00109
    00110         // allow for updating state data.  Returns the state that should
    00111         // be displayed to the user.
    00112         //
    00113         // TODO: Paul agreed to removing dependency on Gendefs
    00114         // he'll perform the actual commit for this
    00115         bool setStateInfo(CStateTlv* stateInfo,
    00116                           STATE& rSessionState,
    00117                           VPNCON_SUBSTATE& rSessionSubState,
    00118                           STATE& rMgmtTunSessionState,
    00119                           VPNCON_SUBSTATE& rMgmtTunSessionSubState,
    00120                           NETENV_STATE& rNetEnvState,
    00121                           NETCTRL_STATE& rNetCtrlState,
    00122                           NETWORK_TYPE& rNetType);
    00123
    00124         // allow for updating sessionInfo data
    00125         //
    00126         void setSessionInfo(CSessionInfoTlv *sessionInfo);
    00127
    00128         // allow for updating strictly TND related data
    00129         //
    00130         void setTNDInfo(CSessionInfoTlv& sessionInfo);
    00131
    00132         // set the client operating Mode
    00133         //
    00134         void setClientOperatingMode(uint32_t operatingMode);
    00135
    00136         static const tstring::value_type* const* getVpnStatsStringTable();
    00137
    00138         void StreamStats(tostream &outStream);
    00139
    00140 protected:
    00141         static const tstring::value_type* const sm_pVpnStatsStringTable[];
    00142
    00143 private:
    00144         ApiStringMap mo_StatNameValue;
    00145         ApiStringMap mo_SessionStats;
    00146
    00147         tstring ms_CurrentState;
    00148         tstring ms_CurrentMgmtTunState;
    00149
    00150         bool mb_GotSessionInfo;
    00151
    00152         std::list<RouteInfo *> mlop_SecureRoutes;
    00153         uint16_t m_uiAppliedSecureRouteCountV4;
    00154         uint16_t m_uiAppliedSecureRouteCountV6;
    00155
    00156         std::list<RouteInfo *> mlop_NonsecureRoutes;
    00157         uint16_t m_uiAppliedNonsecureRouteCountV4;
    00158         uint16_t m_uiAppliedNonsecureRouteCountV6;
    00159
    00160         std::list<ProtocolInfo *> mlop_ProtocolInfo;
    00161
    00162         std::list<FirewallInfo *> mlop_FirewallInfo;
    00163
    00164         static CManualLock sm_statsLock;
    00165
    00166         static tstring EmptyString;
    00167         static tstring NotAvailable;
    00168
    00169         ApiStringMap &getStatsMap();
    00170         ApiStringMap &getSessionStatsMap();
    00171
    00172         void setStatValue(tstring &label, tstring value);
    00173         void setStatValue(ApiStringMap &map, tstring &label, tstring value);
    00174
    00175         void synchronizeLists(const VPNStatsBase &existing);
    00176
    00177         void clearProtocolInfo();
    00178         void clearSecureRoutes();
    00179         void clearNonSecureRoutes();
    00180         void clearFirewallInfo();
    00181
    00182         void init();
    00183
    00184         void setIndividualStats(CExtensibleStats *stats);
    00185
    00186         friend VPN_VPNAPI tostream& operator<<(tostream &outStream,
    00187                                                VPNStatsBase &stats);
    00188
    00189 };
    00190
    00191
    00192 #endif // _VPNSTATSBASE_