cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8659
Views
0
Helpful
4
Replies

Detect connection status for Cisco AnyConnect VPN client...

adzheng2011
Level 1
Level 1

Hello,

I need to write a small piece of code in C++ to detect whether the AnyConnect VPN client (v2.5 and above) has established the connection. I recall in Cisco 3000 VPN client when the connection gets established there is a registry value (TunnelEstablished) being set to 1. But with AnyConnect I don't see any changes in the registry.

Could you please let me know how to detect this in C++? A sample code will be highly appreciated!

Thanks,

Alex

2 Accepted Solutions

Accepted Solutions

clandrai
Cisco Employee
Cisco Employee

Hi Alex,

I think you will find just what you need in the Anyconnect VPN client API, the zip file includes a few examples, among which a C++ sample. All the documentation is also included.

The file you need is named anyconnect-win-vpnapi-3.0.3054.zip  (for currently latest version) and can be found here:

http://www.cisco.com/cisco/software/release.html?mdfid=283000185&flowid=17001&softwareid=282364313&release=3.0.3054&relind=AVAILABLE&rellifecycle=&reltype=latest

Similar API also exists for Linux platform.

I hope it helps.

Best regards,

Chris

View solution in original post

Hi Alex,

That file is indeed subjected to the same download restrictions than the other Anyconnect client files. You should contact the person who provided you with the Anyconnect  client installer, or who is managing the ASA that you are connecting  to, asking her/him to get the file and provide it to you - that person  should have the necessary access rights.

Alternatively there is a command line interface executable provided as part of the Anyconnect  client, which can return tunnel statistics (among which tunnel status) -  invoking that program and parsing the output should be doable from  pretty much any programming/scripting tool - not the most optimal  approach in C++ though, but you wouldn't need anything else than what is provided with the client software.

The executable is with the other Anyconnect client files and is named vpncli.exe.

Try vpncli -h to get the argument syntax.

I hope it helps, please let me know.

Best regards,

Christophe

View solution in original post

4 Replies 4

clandrai
Cisco Employee
Cisco Employee

Hi Alex,

I think you will find just what you need in the Anyconnect VPN client API, the zip file includes a few examples, among which a C++ sample. All the documentation is also included.

The file you need is named anyconnect-win-vpnapi-3.0.3054.zip  (for currently latest version) and can be found here:

http://www.cisco.com/cisco/software/release.html?mdfid=283000185&flowid=17001&softwareid=282364313&release=3.0.3054&relind=AVAILABLE&rellifecycle=&reltype=latest

Similar API also exists for Linux platform.

I hope it helps.

Best regards,

Chris

Hello Chris,

Thanks for your info. However, it seems like a valid service contract with Cisco is required to download the package.

Can you please confirm that or is there a way to download it without the service contract?

Thanks,

Alex

Hi Alex,

That file is indeed subjected to the same download restrictions than the other Anyconnect client files. You should contact the person who provided you with the Anyconnect  client installer, or who is managing the ASA that you are connecting  to, asking her/him to get the file and provide it to you - that person  should have the necessary access rights.

Alternatively there is a command line interface executable provided as part of the Anyconnect  client, which can return tunnel statistics (among which tunnel status) -  invoking that program and parsing the output should be doable from  pretty much any programming/scripting tool - not the most optimal  approach in C++ though, but you wouldn't need anything else than what is provided with the client software.

The executable is with the other Anyconnect client files and is named vpncli.exe.

Try vpncli -h to get the argument syntax.

I hope it helps, please let me know.

Best regards,

Christophe

Thanks Chris. Your help is highly appreciated!