| AnyConnect Secure Mobility Client 5.1.0.136

- Main Page
- Related Pages
- Classes
- Files

# Required Implementation

You must implement the following methods for integration with the AnyConnect API.

## StatsCB

The StatsCB method provides a mechanism for the periodic delivery of VPN statistics, protocol and route data as well as the current state of the VPN. You can control or ignore the flow of this data as desired. For additional information about the method, see ClientIfc::StatsCB. To see an example of accessing the data delivered by this method, see CLIClientImpl::StatsCB and CLIClientImpl::getStats.

For a list of available statistics, see the Static Public Attributes section in the VPNStats class.

### Protocol Data

The VPNStats class also provides access to Protocol and compression data. This data can be accessed using the method VPNStats::getProtocolInfo. As with the VPNStats class, see the Static Public Attributes section for data available from an instance of the ProtocolInfo class.

### Route Data

Finally, the VPNStats class provides access to Route data. There can be one or more instances of Secure and Non-Secure routes. To retrieve this data, you can use the methods VPNStats::getSecureRoutes and VPNStats::getNonsecureRoutes. See the class RouteInfo for methods that can be used to access the data in a Secure or Non-Secure RouteInfo instance.

## StateCB

The StateCB method delivers the current state (see VPNState) and a localized string identifying that state textually. This method is called when your application calls ClientIfc::attach and then each time the state changes.

## BannerCB

This method delivers important notices. This method should return a true or false indicating acceptance or rejection of the notice. If used, the BannerCB method is called during authentication. If the response to a banner is false rejection the VPN connection attempt is terminated. If the reponse is true, the VPN connection attempt continues. Some examples of using banner include:

- When a server certificates from remote gateway is not recognized
- When an administrator has provisioned a banner on the gateway. Once authentication is complete the banner is delivered.

## NoticeCB

Messages are delivered via the NoticeCB and can come from multiple sources. There are four message types: error, warning, info and status. See the MessageType enum in api.h for the list.

For clients using the API as an embedded application (not user visible) there may be a desire to further characterize messages. One option here is to use the AnyConnect message catalog and assign message codes as the translations for various messages. An application could then track messages based on it's own error code scheme and resulting desired remedial action.

## ServiceReadyCB

Under normal operating conditions, this CB will be called as soon as the ClientIfc::attach method completes. In case the service (vpn agent) is not ready, this CB is not called until either the service is ready, or the attempt fails.

Any API calls made prior to this CB being called result in a NoticeCB error message.

## UserPromptCB

This method supports prompting for single or multiple values. It is the mechanism for displaying and setting values that are required by the secure gateway for authentication.

The ConnectPromptInfo object contains a list of PromptEntry instances. The labels and their default values (if any) can be found in this list. After the data has been collected from the user, it can be set into these same instances. When ready, the client application should call the method ClientIfc::UserSubmit to have the responses read by the API.

Two methods in the CLI example code demonstrate the delivery of ConnectPromptInfo, the parsing of PromptEntry and subsequent return of user entered values using the UserSubmit method. See the methods CLIClientImpl::UserPromptCB and CLIClientImpl::setUserData.