AnyConnect Secure Mobility Client  5.1.2.42
ProtocolInfo.h
1 /**************************************************************************
2 * Copyright (c) 2006, Cisco Systems, All Rights Reserved
3 ***************************************************************************
4 *
5 * File: ProtocolInfo.h
6 * Date: 12/2006
7 *
8 ***************************************************************************
9 *
10 * Protocol info class implementation for the Client API.
11 *
12 ***************************************************************************/
13 #ifndef _PROTOCOL_INFO_
14 #define _PROTOCOL_INFO_
15 
16 
17 #include "api.h"
18 #include <iostream>
19 
20 
21 class VPNStatsBase;
22 
23 /**
24  * Use this class to retrieve details regarding the protocol in use for the
25  * VPN tunnel. These details include State, Protocol, Cipher and Compression.
26  *
27  * It's possible multiple ProtocolInfo objects (for example, one each for TLS
28  * and DTLS protocol) are available. To check whether the Protocol for a given
29  * instance of ProtocolInfo is the currently active one, use the
30  * ProtocolInfo::isActive method.
31  */
32 
33 class VPN_VPNAPI ProtocolInfo
34 {
35  public:
36 
37  static tstring State; /**< Use ProtocolInfo::getProtocolValue
38  with this tag to get the current
39  state of the referenced protocol. The
40  returned state is a localized
41  string. */
42  static tstring Protocol; /**< Use ProtocolInfo::getProtocolValue
43  with this tag to get the protocol
44  value (for example, DTLS). */
45  static tstring Cipher; /**< Use ProtocolInfo::getProtocolValue
46  with this tag to get the Cipher
47  value (for example, RSA_AES_256_SHA1). */
48  static tstring Compression; /**< Use ProtocolInfo::getProtocolValue
49  with this tag to get the Compression
50  value (for example, Deflate). The returned
51  compression value is a localized
52  string. */
53 
54  /**
55  * Use this method to retrieve various protocol related values.
56  * The valid labels or tags to use in this retrieval include: State,
57  * Protocol, Cipher and Compression.
58  * (for example, getProtocolValue(State), getProtocolValue(Protocol), etc.)
59  */
60  const tstring &getProtocolValue(tstring &label);
61 
62  /**
63  * Alias for getProtocolValue.
64  */
65  const tstring &getValue(tstring &label) { return getProtocolValue(label); }
66 
67  /**
68  * Return true if this is the active protocol.
69  */
70  bool isActive();
71 
72  ProtocolInfo(const ProtocolInfo *pInfo);
73  ProtocolInfo(STATE tunnelState,
74  ProtocolVersion protocolVersion,
75  ProtocolCipher protocolCipher,
76  COMPR_ALGORITHM comprAlgorithm,
77  bool bIsActive);
78 
79  ~ProtocolInfo();
80 
81 
82  //This method is not intended to be used by a consumers of the API.
83  //
84  static const tstring::value_type* const* getProtocolInfoStringTable();
85 
86 protected:
87  static const tstring::value_type* const sm_pProtocolInfoStringTable[];
88 
89 private:
90 
91  static tstring EmptyString;
92 
93  bool mb_isActive;
94 
95  ApiStringMap mo_ProtocolNameValue;
96 
97  ApiStringMap &getProtocolMap();
98 
99  friend VPN_VPNAPI tostream& operator<<(tostream &outStream,
100  VPNStatsBase& stats);
101 };
102 
103 
104 #endif // _PROTOCOL_INFO_
static tstring Protocol
Definition: ProtocolInfo.h:42
static tstring Cipher
Definition: ProtocolInfo.h:45
#define tstring
Definition: api.h:35
Definition: ProtocolInfo.h:33
static tstring Compression
Definition: ProtocolInfo.h:48
static tstring State
Definition: ProtocolInfo.h:37
const tstring & getValue(tstring &label)
Definition: ProtocolInfo.h:65
Definition: VPNStatsBase.h:40