08-10-2011 06:33 PM - edited 02-21-2020 05:30 PM
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
Solved! Go to Solution.
08-24-2011 01:38 AM
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:
Similar API also exists for Linux platform.
I hope it helps.
Best regards,
Chris
08-25-2011 05:17 AM
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
08-24-2011 01:38 AM
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:
Similar API also exists for Linux platform.
I hope it helps.
Best regards,
Chris
08-24-2011 01:55 PM
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
08-25-2011 05:17 AM
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
08-26-2011 09:35 AM
Thanks Chris. Your help is highly appreciated!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide