| AnyConnect Secure Mobility Client 5.1.10.233

VPNStatsBase.h
1/**************************************************************************
2* Copyright (c) 2008, Cisco Systems, All Rights Reserved
3***************************************************************************
4*
5* File: VpnStatsBase.h
6* Date: 01/2008
7*
8***************************************************************************
9*
10* VPN Statistics base class implementation for the Client API.
11*
12***************************************************************************/
13#ifndef _VPNSTATSBASE_
14#define _VPNSTATSBASE_
15
16#include <list>
17#if defined(_WIN32) && (_MSC_VER < 1800)
18 typedef unsigned long uint32_t;
19#else
20#include <stdint.h>
21#endif
22
23#include "ProtocolInfo.h"
24#include "RouteInfo.h"
25#include "api.h"
26
27
28// This is the base class for VPNStats. It provides underlying functionality
29// and data storage. The intent is to expose only what is needed by a user
30// of the API in the VPNStats class.
31//
32
33 class CStatisticsTlv;
34 class CStateTlv;
35 class CSessionInfoTlv;
36 class CManualLock;
37 class FirewallInfo;
38 class CExtensibleStats;
39
40 class VPN_VPNAPI VPNStatsBase
41{
42 public:
43
44 // various ctor
45 //
46 VPNStatsBase();
47 VPNStatsBase(const VPNStatsBase &existing);
48 VPNStatsBase & operator= (const VPNStatsBase &);
49
50 virtual ~VPNStatsBase();
51
52 // get a list of Secure Routes.
53 // Method returns a list of RouteInfo pointers
54 //
55 const std::list<RouteInfo *> &getSecureRoutes();
56
57 // Returns the number of applied secure routes for the specified IP protocol.
58 // This may be different from the number of routes
59 // pushed to UI, which cannot exceed 200.
60 //
61 uint16_t getAppliedSecureRouteCount(bool bIPv6)
62 {
63 return (bIPv6 ? m_uiAppliedSecureRouteCountV6 :
64 m_uiAppliedSecureRouteCountV4);
65 }
66
67 // get a list of Nonsecure Routes.
68 // Method returns a list of RouteInfo pointers
69 //
70 const std::list<RouteInfo *> &getNonsecureRoutes();
71
72 // Returns the number of applied non-secure routes for the specified IP protocol.
73 // This may be different from the number of routes
74 // pushed to UI, which cannot exceed 200.
75 uint16_t getAppliedNonsecureRouteCount(bool bIPv6)
76 {
77 return (bIPv6 ? m_uiAppliedNonsecureRouteCountV6 :
78 m_uiAppliedNonsecureRouteCountV4);
79 }
80
81 // get a list of protocol Info objects.
82 // Method returns a list of ProtocolInfo pointers
83 //
84 const std::list<ProtocolInfo *> &getProtocolInfo();
85
86 // get a list of firewall Info objects.
87 // Method returns a list of FirewallInfo pointers
88 //
89 const std::list<FirewallInfo *> &getFirewallInfo();
90
91 // method used to retireve statistices by name.
92 //
93 const tstring &getStatValue(tstring &label);
94
95 void setConnectionStatistics(CStatisticsTlv *connectionStats);
96
97 bool ClearConnectionStatistics();
98
99 bool ClearVPNSessionStats();
100
101 // these two methods are helpers used to make sure SessionInfo
102 // is available.
103 //
104 bool hasSessionInfo();
105
106 bool IsFirewallInfoEqual (VPNStatsBase &stats);
107
108 void setDisconnected();
109
110 // allow for updating state data. Returns the state that should
111 // be displayed to the user.
112 //
113 // TODO: Paul agreed to removing dependency on Gendefs
114 // he'll perform the actual commit for this
115 bool setStateInfo(CStateTlv* stateInfo,
116 STATE& rSessionState,
117 VPNCON_SUBSTATE& rSessionSubState,
118 STATE& rMgmtTunSessionState,
119 VPNCON_SUBSTATE& rMgmtTunSessionSubState,
120 NETENV_STATE& rNetEnvState,
121 NETCTRL_STATE& rNetCtrlState,
122 NETWORK_TYPE& rNetType);
123
124 // allow for updating sessionInfo data
125 //
126 void setSessionInfo(CSessionInfoTlv *sessionInfo);
127
128 // allow for updating strictly TND related data
129 //
130 void setTNDInfo(CSessionInfoTlv& sessionInfo);
131
132 // set the client operating Mode
133 //
134 void setClientOperatingMode(uint32_t operatingMode);
135
136 static const tstring::value_type* const* getVpnStatsStringTable();
137
138 void StreamStats(tostream &outStream);
139
140 protected:
141 static const tstring::value_type* const sm_pVpnStatsStringTable[];
142
143 private:
144 ApiStringMap mo_StatNameValue;
145 ApiStringMap mo_SessionStats;
146
147 tstring ms_CurrentState;
148 tstring ms_CurrentMgmtTunState;
149
150 bool mb_GotSessionInfo;
151
152 std::list<RouteInfo *> mlop_SecureRoutes;
153 uint16_t m_uiAppliedSecureRouteCountV4;
154 uint16_t m_uiAppliedSecureRouteCountV6;
155
156 std::list<RouteInfo *> mlop_NonsecureRoutes;
157 uint16_t m_uiAppliedNonsecureRouteCountV4;
158 uint16_t m_uiAppliedNonsecureRouteCountV6;
159
160 std::list<ProtocolInfo *> mlop_ProtocolInfo;
161
162 std::list<FirewallInfo *> mlop_FirewallInfo;
163
164 static CManualLock sm_statsLock;
165
166 static tstring EmptyString;
167 static tstring NotAvailable;
168
169 ApiStringMap &getStatsMap();
170 ApiStringMap &getSessionStatsMap();
171
172 void setStatValue(tstring &label, tstring value);
173 void setStatValue(ApiStringMap &map, tstring &label, tstring value);
174
175 void synchronizeLists(const VPNStatsBase &existing);
176
177 void clearProtocolInfo();
178 void clearSecureRoutes();
179 void clearNonSecureRoutes();
180 void clearFirewallInfo();
181
182 void init();
183
184 void setIndividualStats(CExtensibleStats *stats);
185
186 friend VPN_VPNAPI tostream& operator<<(tostream &outStream,
187 VPNStatsBase &stats);
188
189};
190
191
192#endif // _VPNSTATSBASE_
api.h
tstring
#define tstring
Definition api.h:35
FirewallInfo
Definition FirewallInfo.h:23