Files
2026-07-30 11:19:44 +05:30

1295 lines
39 KiB
C

/* ipl2tp_api_tunnel.h - IPL2TP Tunnel API. */
/*
DESCRIPTION
API for the Layer 2 tunneling protocol.
*/
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp_api_tunnel.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipl2tp/include/ipl2tp_api_tunnel.h,v $
* $Author: tneale $ $Date: 2009-10-27 14:37:05 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPL2TP_API_TUNNEL_H
#define IPL2TP_API_TUNNEL_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipl2tp_api_interface_attribute_set - Set the attributes of a tunnel interface.
*
* Set the attributes of a tunnel interface. This function is equivalent to
* ipl2tp_api_tunnel_attribute_set(), but the tunnel is specified with an interface
* index instead of a tunnel key.
*
* Note that a tunnel must be assigned an interface index before this function is used.
* The assignment is done with the 'IPL2TP_TATTR_SET_tunnelIfIndex' attribute.
*
* Refer to the attribute functions named ipl2tp_attr_xxx() for information on
* how to enter values into and obtain values from an attribute object.
*
* A return status of IPL2TP_STATUS_BADPARAM indicates that at least one of
* the attributes had an invalid value. The invalid attribute may be located by using
* the ipl2tp_attr_status() function. The offending attribute has a status of
* IPL2TP_STATUS_BADPARAM.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_interface_attribute_set(Ip_u16 ifindex, Ipl2tp_attrobj attrobj);
* \ce
*
* PARAMETERS
* \is
* \i 'ifindex' Interface index.
* \i 'attrobj' Tunnel attributes.
* \ie
*
* ATTRIBUTES
*
* This function supports the same attributes as ipl2tp_api_tunnel_attribute_set().
* Refer to that function for a complete attribute list.
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the tunnel ID is invalid.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attrobj = IP_NULL;
*
* /@ Create attribute object @/
* ipl2tp_attr_iappend(&attrobj, IPL2TP_TATTR_SET_l2tpTunnelConfigControlRWS, 100);
*
* /@ Set parameter @/
* ipl2tp_api_interface_attribute_set(ifindex, attrobj);
*
* /@ Free attribute object @/
* ipl2tp_attr_delete(&attrobj);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_attr_new(), ipl2tp_attr_delete(), ipl2tp_attr_iappend(),
* ipl2tp_attr_pappend(), ipl2tp_attr_first(), ipl2tp_attr_next(), ipl2tp_attr_tag(),
* ipl2tp_attr_idata(), ipl2tp_attr_pdata()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_interface_attribute_set(Ip_u32 ifindex,
Ipl2tp_attrobj attr);
/*******************************************************************************
*
* ipl2tp_api_interface_attribute_get - Get the attributes of a tunnel interface.
*
* Get the attributes of a tunnel interface. This function is equivalent to
* ipl2tp_api_tunnel_attribute_get(), but the tunnel is specified with an interface
* index instead of a tunnel key.
*
* Note that a tunnel must be assigned an interface index before this function is used.
* The assignment is done with the 'IPL2TP_TATTR_SET_tunnelIfIndex' attribute.
*
* Refer to the attribute functions named ipl2tp_attr_xxx() for information on
* how to enter values into and obtain values from an attribute object.
*
* A return status of IPL2TP_STATUS_BADPARAM indicates that at least one of
* the attributes had an invalid value. The invalid attribute may be located by using
* the ipl2tp_attr_status() function. The offending attribute has a status of
* IPL2TP_STATUS_BADPARAM.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_interface_attribute_get(Ip_u16 ifindex, Ipl2tp_attrobj attrobj, Ipl2tp_attrobj *replies);
* \ce
*
* PARAMETERS
* \is
* \i 'ifindex' Interface index.
* \i 'attrobj' Tunnel attributes.
* \i 'replies' The placeholder for the return values.
* \ie
*
* ATTRIBUTES
*
* This function supports the same attributes as ipl2tp_api_tunnel_attribute_get().
* Refer to that function for a complete attribute list.
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the tunnel ID is invalid.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attrobj = IP_NULL;
* Ipl2tp_attrobj replies = IP_NULL;
* Ipl2tp_attr a;
*
* /@ Create attribute object @/
* ipl2tp_attr_add_query(&attrobj, IPL2TP_TATTR_RW_l2tpTunnelConfigControlRWS);
*
* /@ Get parameter @/
* ipl2tp_api_interface_attribute_get(ifindex, attrobj, &replies);
* a = ipl2tp_attr_first(replies);
* printf("Window size is %d\n", ipl2tp_attr_idata(a));
*
* /@ Free attribute object @/
* ipl2tp_attr_delete(&attrobj);
* ipl2tp_attr_delete(&replies);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_attr_new(), ipl2tp_attr_delete(), ipl2tp_attr_iappend(),
* ipl2tp_attr_pappend(), ipl2tp_attr_first(), ipl2tp_attr_next(), ipl2tp_attr_tag(),
* ipl2tp_attr_idata(), ipl2tp_attr_pdata()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_interface_attribute_get(Ip_u32 ifindex,
Ipl2tp_attrobj attr,
Ipl2tp_attrobj *replies);
/*******************************************************************************
*
* ipl2tp_api_tunnel_attribute_set - Set the tunnel attributes.
*
* Set the tunnel attributes. Refer to the attribute functions named
* ipl2tp_attr_xxx() for information of how to enter values into and obtain values
* from an attribute object.
*
* A return status of IPL2TP_STATUS_BADPARAM indicates that at least one of
* the attributes had an invalid value. The invalid attribute may be located by using
* the ipl2tp_attr_status() function. The offending attribute has a status of
* IPL2TP_STATUS_BADPARAM.
*
* Attribute types are:
* \ts
* 'integer' | - | 32-bit unsigned integer.
* 'pointer' | - | General-purpose pointer.
* 'string' | - | Pointer to null-terminated character string.
* 'vector' | - | General-purpose vector with variable length.
* 'address' | - | Address.
* 'integer64' | - | 64-bit unsigned integer.
* 'key' | - | Tunnel/Session key.
* \te
*
* Use codes are:
* \ts
* 'default' | - | May be used as tunnel default in the ipl2tp_open() call.
* 'open' | - | May be used in the ipl2tp_tunnel_open() and ipl2tp_session_open() calls.
* 'idle' | - | May be used on a non-established tunnel in the ipl2tp_tunnel_control() call.
* 'control' | - | May be used on an established tunnel in the ipl2tp_tunnel_control() call.
* 'all' | - | May be used in any context.
* \te
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_tunnel_attribute_set(Ipl2tp_key *tkey, Ipl2tp_attrobj attrobj);
* \ce
*
* PARAMETERS
* \is
* \i 'tkey' Tunnel ID.
* \i 'attrobj' Tunnel attributes.
* \ie
*
* ATTRIBUTES
* \is
*
* \i 'IPL2TP_TATTR_SET_BEARER_CAPABILITIES'
* \ts
* Use: default, open, idle.
* Type: integer.
* Set the bearer capabilities of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_BEARER_NONE'
* 'IPL2TP_MIB_BEARER_DIGITAL'
* 'IPL2TP_MIB_BEARER_ANALOG'
* 'IPL2TP_MIB_BEARER_DIGITAL_ANALOG'
* \te
*
* \i 'IPL2TP_TATTR_SET_FRAMING_CAPABILITIES'
* \ts
* Use: default, open, idle.
* Type: integer.
* Set the framing capabilities of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_FRAMING_NONE'
* 'IPL2TP_MIB_FRAMING_SYNC'
* 'IPL2TP_MIB_FRAMING_ASYNC'
* 'IPL2TP_MIB_FRAMING_SYNC_ASYNC'
* \te
*
* \i 'IPL2TP_TATTR_SET_HIDE_AVP'
* \ts
* Use: all.
* Type: integer.
* Set the hide flag for the tunnel. When the hide flag is enabled, transmitted AVP values are hidden using an MD5 algorithm.
* Note that hiding only takes place if there is a shared secret configured for the tunnel. This is done with the 'IPL2TP_TATTR_SET_l2tpTunnelConfigSecret' attribute.
* \te
*
* \i 'IPL2TP_TATTR_SET_PEER_HOST_NAME'
* \ts
* Use: open, idle.
* Type: string.
* Set the expected name of the peer host. This name is used in the simple (host name) authentication scheme.
* \te
*
* \i 'IPL2TP_TATTR_SET_STATUS_CALLBACK'
* \ts
* Use: all.
* Type: pointer.
* Set the function pointer of the tunnel status callback routine.
* The callback is called whenever there is a change in tunnel status.
* The callback routine uses the Ipl2tp_status_callback() prototype.
* \te
*
* \i 'IPL2TP_TATTR_SET_USER_DATA'
* \ts
* Use: all.
* Type: pointer.
* Set the user-defined pointer that is passed as a parameter to the tunnel status callback. This pointer can be used to point to a set of application-specific variables.
* \te
*
* \i 'IPL2TP_TATTR_SET_ifAdminStatus'
* \ts
* Use: idle, control.
* Type: integer.
* Set the administrative status of a tunnel.
* Valid values are:
* 'IPL2TP_MIB_DOWN' Tunnel is down
* 'IPL2TP_MIB_UP' Tunnel is up
* \te
* Note that getting this attribute may not necessarily show the actual status of the tunnel, rather the status that the tunnel is aiming at. For a correct snapshot of the current status, use the 'IPL2TP_TATTR_GET_ifOperStatus' attribute.
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigAuthentication'
* \ts
* Use: default, open, idle.
* Type: integer.
* Set the authentication model to use when establishing the tunnel.
* Valid values are:
* 'IPL2TP_MIB_AUTH_NONE' No authentication.
* 'IPL2TP_MIB_AUTH_SIMPLE' Host name authentication.
* 'IPL2TP_MIB_AUTH_CHALLENGE' Challenge authentication.
* 'IPL2TP_MIB_AUTH_DIGEST' MD5 or SHA digest for L2TPV3
* \te
* Note that simple authentication requires setting of the 'IPL2TP_TATTR_RW_PEER_HOST_NAME' attribute, and that challenge authentication requires setting of the 'IPL2TP_TATTR_SET_l2tpTunnelConfigSecret' attribute.
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigControlMaxRetransmissionTimeout'
* \ts
* Use: all.
* Type: integer.
* Set the maximum timeout between control channel retransmissions. The first retransmission timeout is controlled by the 'IPL2TP_ATTR_SET_FIRST_RETRANSMIT_SEC' attribute, and further retransmission timeouts are doubled at each unsuccessful retry. This attribute places a cap on the retransmission timeout.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigControlMaxRetransmissions'
* \ts
* Use: all.
* Type: integer.
* Set the maximum number of retransmissions. Note that the initial transmission is not included, so entering a value of 5 is given a total of 6 transmissions.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigControlRWS'
* \ts
* Use: all.
* Type: integer.
* Set the control channel receive window size, specifying how many packets the peer host may send without waiting for an acknowledgement.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigDrainTunnel'
* \ts
* Use: open, idle, control.
* Type: integer.
* Set the draining state of this tunnel. When draining is enabled, no additional session establishments are accepted.
* Valid values are:
* 'IPL2TP_MIB_YES' Enable draining
* 'IPL2TP_MIB_NO' Disable draining
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigHelloInterval'
* \ts
* Use: all.
* Type: integer.
* Set the interval between HELLO messages, which are sent on the tunnel when there is no control channel activity from the peer host.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigIdleTimeout'
* \ts
* Use: all.
* Type: integer.
* Set the number of seconds a tunnel is kept in the established state after all sessions are deleted. The only supported value is 0.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigPayloadSequencing'
* \ts
* Use: all.
* Type: integer.
* Set the state of data channel sequencing.
* Valid values are:
* 'IPL2TP_MIB_NEVER' The LAC never initiates payload sequencing, but enables it if requested by the LNS.
* 'IPL2TP_MIB_ALWAYS' The LAC sends the Sequencing Required AVP during session establishment, which forces payload sequencing to be used.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigReassemblyTimeout'
* \ts
* Use: all.
* Type: integer.
* Set the number of milliseconds to wait until processing out-of-order payload packets. The only supported value is 0.
* \te
*
* \i 'IPL2TP_TATTR_SET_l2tpTunnelConfigSecret'
* \ts
* Use: open, idle.
* Type: vector.
* Set the shared secret used in the challenge authentication AVP hiding or digest schemes.
* \te
*
* \i 'IPL2TP_TATTR_SET_tunnelIfIndex'
* \ts
* Use: open, idle.
* Type: integer.
* Set the interface index of the tunnel. This index must be set before using the function ipl2tp_interface_control() and the attributes 'IPL2TP_ATTR_GET_NEXT_IFINDEX' and 'IPL2TP_SATTR_GET_l2tpSessionStatsTunnelIfIndex'.
* \te
*
* \i 'IPL2TP_TATTR_SET_LOCAL_ROUTER_ID'
* \ts
* Use: idle, control.
* Type: integer.
* Set the local router identification.
* \te
*
* \i 'IPL2TP_TATTR_SET_LOCAL_PREFERRED_LANGUAGE'
* \ts
* Use: idle, control.
* Type: string.
* Set the local preferred language.
* \te
*
* \i 'IPL2TP_TATTR_SET_LOCAL_PSEUDOWIRE_CAPABILITIES_LIST'
* \ts
* Use: idle, control.
* Type: vector
* Vector of 16-bit values containing the pseudowire capabilities.
* \te
*
* \i 'IPL2TP_TATTR_SET_TRANSPORT'
* \ts
* Use: idle, control.
* Type: integer
* The transport to be used, either 'IPL2TP_ATTR_TRANSPORT_UDP' or 'IPL2TP_ATTR_TRANSPORT_IP'.
* \te
*
* \i 'IPL2TP_TATTR_SET_HMAC'
* \ts
* Use: idle, control.
* Type: integer
* The HNAC algorithm to be used when using the digest authentication mechanism, either 'IPL2TP_MIB_AUTH_MD5' or 'IPL2TP_MIB_AUTH_SHA'.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the tunnel ID is invalid.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attrobj = IP_NULL;
*
* /@ Create attribute object @/
* ipl2tp_attr_iappend(&attrobj, IPL2TP_TATTR_SET_HMAC, IPL2TP_MIB_AUTH_SHA);
*
* /@ Get parameter @/
* ipl2tp_api_tunnel_attribute_set(tkey, attrobj);
*
* /@ Free attribute object @/
* ipl2tp_attr_delete(&attrobj);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_attr_new(), ipl2tp_attr_delete(), ipl2tp_attr_iappend(),
* ipl2tp_attr_pappend(), ipl2tp_attr_first(), ipl2tp_attr_next(), ipl2tp_attr_tag(),
* ipl2tp_attr_idata(), ipl2tp_attr_pdata()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_attribute_set(Ipl2tp_key *key,
Ipl2tp_attrobj attr);
/*******************************************************************************
*
* ipl2tp_api_tunnel_attribute_get - Get the tunnel attributes.
*
* Get the tunnel attributes. Refer to the attribute functions named
* ipl2tp_attr_xxx() for information of how to enter values into and obtain values
* from an attribute object.
*
* A return status of IPL2TP_STATUS_BADPARAM indicates that at least one of
* the attributes had an invalid value. The invalid attribute may be located by using
* the ipl2tp_attr_status() function. The offending attribute has a status of
* IPL2TP_STATUS_BADPARAM.
*
* Attribute types are:
* \ts
* 'integer' | - | 32-bit unsigned integer.
* 'pointer' | - | General-purpose pointer.
* 'string' | - | Pointer to null-terminated character string.
* 'vector' | - | General-purpose vector with variable length.
* 'address' | - | Address.
* 'integer64' | - | 64-bit unsigned integer.
* 'key' | - | Tunnel/Session key.
* \te
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_tunnel_attribute_get(Ipl2tp_key *tkey, Ipl2tp_attrobj attrobj, Ipl2tp_attrobj *replies);
* \ce
*
* PARAMETERS
* \is
* \i 'tkey' Tunnel ID.
* \i 'attrobj' Tunnel attributes.
* \i 'replies' Tunnel attribute replies.
* \ie
*
* ATTRIBUTES
* \is
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsBearerCapabilities' or 'IPL2TP_TATTR_GET_BEARER_CAPABILITIES'
* \ts
* Type: integer.
* Get the bearer capabilities of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_BEARER_NONE'
* 'IPL2TP_MIB_BEARER_DIGITAL'
* 'IPL2TP_MIB_BEARER_ANALOG'
* 'IPL2TP_MIB_BEARER_DIGITAL_ANALOG'
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsFramingCapabilities' or 'IPL2TP_TATTR_GET_FRAMING_CAPABILITIES'
* \ts
* Type: integer.
* Get the framing capabilities of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_FRAMING_NONE'
* 'IPL2TP_MIB_FRAMING_SYNC'
* 'IPL2TP_MIB_FRAMING_ASYNC'
* 'IPL2TP_MIB_FRAMING_SYNC_ASYNC'
* \te
*
* \i 'IPL2TP_TATTR_GET_HIDE_AVP'
* \ts
* Type: integer.
* Get the hide flag for the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_PEER_HOST_NAME'
* \ts
* Type: string.
* Get the expected name of the peer host. This name is used in the simple (host name) authentication scheme.
* \te
*
* \i 'IPL2TP_TATTR_GET_STATUS_CALLBACK'
* \ts
* Type: pointer.
* Get the function pointer of the tunnel status callback routine.
* \te
*
* \i 'IPL2TP_TATTR_GET_USER_DATA'
* \ts
* Type: pointer.
* Get the user-defined pointer that is passed as a parameter to the tunnel status callback.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifAdminStatus'
* \ts
* Type: integer.
* Get the administrative status of a tunnel.
* Valid values are:
* 'IPL2TP_MIB_DOWN' Tunnel is down
* 'IPL2TP_MIB_UP' Tunnel is up
* \te
* Note that getting this attribute may not necessarily show the actual status of the tunnel, rather the status that the tunnel is aiming at.
* For a correct snapshot of the current status, use the 'IPL2TP_TATTR_GET_ifOperStatus' attribute.
*
* \i 'IPL2TP_TATTR_GET_ifDescr'
* \ts
* Type: string.
* Get a string that describes the vendor, product name, and product revision of the tunnel interface.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifInDiscards'
* \ts
* Type: integer.
* Get the number of discarded packets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifInErrors'
* \ts
* Type: integer.
* Get the number of erroneous packets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifInOctets'
* \ts
* Type: integer.
* Get the number of received octets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifInUcastPkts'
* \ts
* Type: integer.
* Get the number of received packets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifOperStatus'
* \ts
* Type: integer.
* Get the operative status of a tunnel.
* Valid values are:
* 'IPL2TP_MIB_DOWN' Tunnel is down
* 'IPL2TP_MIB_UP' Tunnel is up
* \te
*
* \i 'IPL2TP_TATTR_GET_ifOutOctets'
* \ts
* Type: integer.
* Get the number of sent octets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_ifOutUcastPkts'
* \ts
* Type: integer.
* Get the number of sent packets in the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigAuthentication'
* \ts
* Type: integer.
* Get the authentication model to use when establishing the tunnel.
* Valid values are:
* 'IPL2TP_MIB_AUTH_NONE' No authentication.
* 'IPL2TP_MIB_AUTH_SIMPLE' Host name authentication.
* 'IPL2TP_MIB_AUTH_CHALLENGE' Challenge authentication.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigControlMaxRetransmissionTimeout'
* \ts
* Type: integer.
* Get the maximum timeout between control channel retransmissions.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigControlMaxRetransmissions'
* \ts
* Type: integer.
* Get the maximum number of retransmissions.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigControlRWS'
* \ts
* Type: integer.
* Get the control channel receive window size. The value specifies how many packets the peer host may send without waiting for an acknowledgement.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigDrainTunnel'
* \ts
* Type: integer.
* Get the draining state of this tunnel. Note that getting this attribute always returns IPL2TP_MIB_NO. To check the current state, use the 'IPL2TP_TATTR_GET_l2tpTunnelStatsDrainingTunnel' attribute.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigHelloInterval'
* \ts
* Type: integer.
* Get the interval between HELLO messages, which are sent on the tunnel when there is no control channel activity from the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigIdleTimeout'
* \ts
* Type: integer.
* Get the number of seconds a tunnel is kept in the established state after all sessions are deleted. The only supported value is 0.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigPayloadSequencing'
* \ts
* Type: integer.
* Get the state of data channel sequencing.
* Valid values are:
* 'IPL2TP_MIB_NEVER' The LAC never initiates payload sequencing, but enables it if requested by the LNS.
* 'IPL2TP_MIB_ALWAYS' The LAC sends the Sequencing Required AVP during session establishment, which forces payload sequencing to be used.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigReassemblyTimeout'
* \ts
* Type: integer.
* Get the number of milliseconds to wait until processing out-of-order payload packets. The only supported value is 0.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelConfigSecret'
* \ts
* Type: vector.
* Get the shared secret used in the challenge authentication scheme.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsActiveSessions'
* \ts
* Type: integer.
* Get the number of active sessions in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlAckTimeouts'
* \ts
* Type: integer.
* Get the number of control channel timeouts that have occurred in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlOutOfSequence'
* \ts
* Type: integer.
* Get the number of out-of-sequence control messages that have been received in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlOutOfWindow'
* \ts
* Type: integer.
* Get the number of out-of-window control messages that have been received in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlRecvPackets'
* \ts
* Type: integer.
* Get the number of control messages that have been received in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlRecvZLB'
* \ts
* Type: integer.
* Get the number of ZLB messages that have been received in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlSendPackets'
* \ts
* Type: integer.
* Get the number of control messages that have been sent in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsControlSendZLB'
* \ts
* Type: integer.
* Get the number of ZLB messages that have been sent in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsCurrentRemoteRWS'
* \ts
* Type: integer.
* Get the current value of the remote receive window.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsDrainingTunnel'
* \ts
* Type: integer.
* Get the draining state of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_YES' Draining is enabled
* 'IPL2TP_MIB_NO' Draining is disabled
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsFailedSessions'
* \ts
* Type: integer.
* Get the number of session establishments that have failed in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsInitialRemoteRWS'
* \ts
* Type: integer.
* Get the initial remote receive window size as reported by the peer host at tunnel establishment.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsInitiated'
* \ts
* Type: integer.
* Get an indication if the tunnel was opened locally or by the LNS.
* Valid values are:
* 'IPL2TP_MIB_LOCALLY' Opened by the LAC
* 'IPL2TP_MIB_REMOTELY' Opened by the LNS
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsLastErrorCode'
* \ts
* Type: integer.
* Return the last error code that caused the tunnel to disconnect.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsLastErrorMessage'
* \ts
* Type: string.
* Return the last error message that caused the tunnel to disconnect.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsLastResultCode'
* \ts
* Type: integer.
* Return the last result code that caused the tunnel to disconnect.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsLocalTID'
* \ts
* Type: integer.
* Get the local tunnel ID.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRecvSeq'
* \ts
* Type: integer.
* Get the next expected receive sequence number.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRecvSeqAck'
* \ts
* Type: integer.
* Get the last receive sequence number that was acknowledged by the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteFirmwareRevision'
* \ts
* Type: integer.
* Get the firmware revision of the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteHostName'
* \ts
* Type: string.
* Get the name of the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteProtocolVersion'
* \ts
* Type: vector.
* Get the protocol version and revision supported by the peer host. The value is returned as a vector of two octets, where the first octet indicates the version, and the second contains the revision.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteTID'
* \ts
* Type: integer.
* Get the tunnel ID assigned by the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteVendorName'
* \ts
* Type: string.
* Get the vendor name of the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsSendSeq'
* \ts
* Type: integer.
* Get the next send sequence number.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsSendSeqAck'
* \ts
* Type: integer.
* Get the last send sequence number that was acknowledged by the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsState'
* \ts
* Type: integer.
* Get the current state of the tunnel.
* Valid values are:
* 'IPL2TP_MIB_IDLE' Tunnel is idle.
* 'IPL2TP_MIB_ESTABLISHED' Tunnel is established.
* 'IPL2TP_MIB_DISCONNECTING' Tunnel is disconnecting.
* 'IPL2TP_MIB_CONNECTING' Tunnel is connecting.
* \te
*
* \i 'IPL2TP_TATTR_GET_l2tpTunnelStatsTotalSessions'
* \ts
* Type: integer.
* Get the total number of sessions that have been established in this tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_tunnelEncapsMethod'
* \ts
* Type: integer.
* Get the encapsulation method used. This always returns 'IPL2TP_MIB_L2TP'.
* \te
*
* \i 'IPL2TP_TATTR_GET_tunnelIfIndex'
* \ts
* Type: integer.
* Get the interface index of the tunnel.
* \te
*
* \i 'IPL2TP_TATTR_GET_tunnelRemoteAddress'
* \ts
* Type: integer.
* Get the IP address of the peer host.
* \te
*
* \i 'IPL2TP_TATTR_GET_LOCAL_ROUTER_ID'
* \ts
* Type: integer.
* Get the local router identification.
* \te
*
* \i 'IPL2TP_TATTR_GET_REMOTE_ROUTER_ID'
* \ts
* Type: integer.
* Get the remote router identification.
* \te
*
* \i 'IPL2TP_TATTR_GET_LOCAL_PREFERRED_LANGUAGE'
* \ts
* Type: string.
* Get the local preferred language.
* \te
*
* \i 'IPL2TP_TATTR_GET_REMOTE_PREFERRED_LANGUAGE'
* \ts
* Type: string.
* Get the remote preferred language.
* \te
*
* \i 'IPL2TP_TATTR_GET_LOCAL_PSEUDOWIRE_CAPABILITIES_LIST'
* \ts
* Type: vector
* Vector of 16-bit values containing the local pseudowire capabilities
* \te
*
* \i 'IPL2TP_TATTR_GET_REMOTE_PSEUDOWIRE_CAPABILITIES_LIST'
* \ts
* Type: vector
* Vector of 16-bit values containing the remote pseudowire capabilities.
* \te
*
* \i 'IPL2TP_TATTR_GET_TRANSPORT'
* \ts
* Type: integer
* The transport to be used, either 'IPL2TP_ATTR_TRANSPORT_UDP' or 'IPL2TP_ATTR_TRANSPORT_IP'.
* \te
*
* \i 'IPL2TP_TATTR_GET_HMAC'
* \ts
* Type: integer
* The HMAC algorithm to be used when using the digest authentication mechanism, ether: 'IPL2TP_MIB_AUTH_MD5' or 'IPL2TP_MIB_AUTH_SHA'.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the tunnel ID is invalid.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attrobj = IP_NULL;
* Ipl2tp_attrobj replies = IP_NULL;
* Ipl2tp_attr a;
*
* /@ Create attribute object @/
* ipl2tp_attr_add_query(&attrobj, IPL2TP_TATTR_RO_l2tpTunnelStatsCurrentRemoteRWS);
*
* /@ Get parameter @/
* ipl2tp_api_tunnel_attribute_get(tkey, attrobj, &replies);
* a = ipl2tp_attr_first(replies);
* printf("Window size is %d\n", ipl2tp_attr_idata(a));
*
* /@ Free attribute object @/
* ipl2tp_attr_delete(&attrobj);
* ipl2tp_attr_delete(&replies);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_attr_new(), ipl2tp_attr_delete(), ipl2tp_attr_iappend(),
* ipl2tp_attr_pappend(), ipl2tp_attr_first(), ipl2tp_attr_next(), ipl2tp_attr_tag(),
* ipl2tp_attr_idata(), ipl2tp_attr_pdata()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_attribute_get(Ipl2tp_key *key,
Ipl2tp_attrobj attr,
Ipl2tp_attrobj *replies);
/*
*===========================================================================
* ipl2tp_api_tunnel_attribute_query
*===========================================================================
* Description: Get a singular tunnel parameter
* Parameters: key - The tunnel key.
* query - The query
* replies - Where the replies are to be stored.
* Returns:
*
* \NOMANUAL
*/
IP_EXTERN void ipl2tp_api_tunnel_attribute_query(Ipl2tp_key *key,
int query,
Ipl2tp_attrobj *replies);
/*******************************************************************************
*
* ipl2tp_api_tunnel_open - Open a tunnel to a peer L2TP device.
*
* Open a tunnel to a peer L2TP device. The ID of the new tunnel is stored in a
* location pointed to by the 'tidp' argument. 'tidp' is considered to be an array of keys,
* which is required to be at least one entry long if 'hs' is IP_FALSE and two entries if 'hs' is
* IP_TRUE. 'hs' specifies whether or not we try to use version negotiation. That
* is, an attempt is made to open an L2TPv3 tunnel, but the format of the request is
* such that an L2TPv2 reply is accepted. This requires that you set the
* 'tattr' attributes so that it can deal with both L2TPv2 and L2TPv3 tunnels.
* ipl2tp_api_tunnel_negotiation() can be used afterwards to retrieve the correct
* instance and version of the tunnel.
*
* The establish parameter controls whether the tunnel should be established immediately
* or be created in an idle state. An idle tunnel may have its attributes changed by
* means of the ipl2tp_api_tunnel_attribute_set() call, and eventually be established
* by using the 'IPL2TP_ATTR_SET_ifAdminStatus' attribute.
*
* Since this operation may take a while to complete, only the basic operations are
* performed during the actual function call. The continued progress is monitored
* with the callback routine entered in the 'IPL2TP_TATTR_STATUS_CALLBACK'
* attribute. The callback is called when there is a change of status in the tunnel.
*
* Note that tunnel creation is inhibited if there already exists a tunnel to the peer
* L2TP device, and the 'IPL2TP_ATTR_SET_OPEN_EXCLUSIVE' attribute is zero.
* In this case, IPL2TP_STATUS_EXISTS is returned, and the ID of the existing
* tunnel is stored in the location pointed to by the 'tidp[0]' argument.
*
* The version of the tunnel is specified by the 'tidp[0]->version' field.
*
* Refer to the function ipl2tp_api_tunnel_attribute_set() for a description of
* available attributes.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_tunnel_open(Ipl2tp_key *tidp, union Ip_sockaddr_union *addr, Ipl2tp_attrobj tattr, int establish, Ip_bool hs);
* \ce
*
* PARAMETERS
* \is
* \i 'tidp' Tunnel ID key array.
* \i 'addr' IP address to peer.
* \i 'tattr' Tunnel attributes.
* \i 'establish' Establish tunnel immediately if non-zero.
* \i 'hs' Version negotiation.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_DRAIN' if tunnel creation is disabled.
* \i 'IPL2TP_STATUS_NOMEM' if out of memory.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \i 'IPL2TP_STATUS_EXISTS' if there already exists a tunnel to the peer.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj tattr = IP_NULL;
* Ipl2tp_key tkey;
* struct Ip_sockaddr_in saddr;
*
* /@ Setup AF_INET peer @/
* saddr.sin_family = IP_AF_INET;
* saddr.sin_len = sizeof(saddr);
* saddr.sin_addr.s_addr = inet_addr("192.168.0.2");
*
* /@ Set tunnel attributes @/
* ipl2tp_attr_iappend(&tattr, IPL2TP_TATTR_RW_FRAMING_CAPABILITIES, IPL2TP_MIB_FRAMING_SYNC);
* ipl2tp_attr_iappend(&tattr, IPL2TP_TATTR_RW_BEARER_CAPABILITIES, IPL2TP_MIB_BEARER_DIGITAL);
*
* /@ Open tunnel @/
* tkey.version = IPL2TP_VERSION_L2TPV2;
* if (ipl2tp_api_tunnel_open(&tkey, &addr, tattr, 1, IP_FALSE) != IPL2TP_STATUS_OK)
* {
* printf("Failed at ipl2tp_api_tunnel_open()\n");
* }
*
* /@ Delete attribute object @/
* ipl2tp_attr_delete(&tattr);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_tunnel_close()
*
* ERRNO
* None
*/
IP_PUBLIC Ipl2tp_status ipl2tp_api_tunnel_open(Ipl2tp_key *tidp,
union Ip_sockaddr_union *addr,
Ipl2tp_attrobj tattr,
int establish,
Ip_bool hs);
/*******************************************************************************
*
* ipl2tp_api_tunnel_close - Close a tunnel to a peer L2TP device.
*
* Close a tunnel to a peer L2TP device, and all the sessions that reside in it.
*
* Since this operation may take a while to complete, only the basic operations are
* performed during the actual function call. The status callback routine, registered as
* an attribute to ipl2tp_tunnel_open() is called when the close operation is
* complete.
*
* The tunnel key is obtained when calling ipl2tp_api_tunnel_open().
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_tunnel_close(Ipl2tp_key *key);
* \ce
*
* PARAMETERS
* \is
* \i 'tkey' Tunnel ID.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the tunnel ID is invalid.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_tunnel_close(tkey) != IPL2TP_STATUS_OK)
* {
* printf("Error closing tunnel %d\n", tkey->ident);
* }
* }
* \ce
*
* SEE ALSO
*
* ipl2tp_api_tunnel_open()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_close(Ipl2tp_key *key);
/*
*===========================================================================
* ipl2tp_api_ifindex_next
*===========================================================================
* Description: Retrieves the next interface
* Parameters: last - Last ifindex, or 0 if first.
* next - [OUT] next ifindex.
* Returns: IPL2TP_STATUS_OK if next has been properly filled in.
*
* \NOMANUAL
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_ifindex_next(Ip_u32 last,
Ip_u32 *next);
/*
*===========================================================================
* ipl2tp_api_tunnel_next
*===========================================================================
* Description: Retrieves the tunnel identifier
* Parameters: last - Last tunnel we retrieved, or IP_NULL if first
* next - [OUT] next tunnel key.
* Returns: IPL2TP_STATUS_OK if next has been properly filled in.
*
* \NOMANUAL
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_next(Ipl2tp_key *last,
Ipl2tp_key *next);
/*******************************************************************************
*
* ipl2tp_api_tunnel_negotiation - Retrieve the tunnel identifier.
*
* Retrieves the tunnel identifier. Call this function to determine which one of
* the 'tidp' elements was used for the version handshaked tunnel.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_tunnel_negotiation(Ipl2tp_key *tidp, Ipl2tp_key **key);
* \ce
*
* PARAMETERS
* \is
* \i 'tidp' Tunnel ID array.
* \i 'key' Placeholder where the real tunnel key is stored.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success and key contains the key.
* \i 'IPL2TP_STATUS_ERROR' if the tunnel failed.
* \i 'IPL2TP_STATUS_NEGOTIATION' if the tunnel is still negotiating.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_key *key;
*
* if (ipl2tp_api_tunnel_negotiation(tidp, &key) == IPL2TP_STATUS_OK)
* {
* printf("Tunnel is v%d %d\n", key->version, key> ident);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_tunnel_open()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_negotiation(Ipl2tp_key *tidp,
Ipl2tp_key **key);
/*******************************************************************************
*
* ipl2tp_api_tunnel_authentication_established - Verify the authentication method.
*
* Inform IPL2TP that the authentication method is installed so the establishment
* of an outgoing tunnel can continue. This method must be invoked once the
* IPL2TP_OUTGOING_AUTHENTICATION tunnel status code is being invoked,
* for the tunnel to continue to connect.
*
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_authentication_established(Ipl2tp_key *key);
* \ce
*
* PARAMETERS
* \is
* \i 'key' Tunnel ID.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_ERROR' if error.
* \ie
*
*
* SEE ALSO
*
* ipl2tp_api_close(), ipl2tp_api_attribute_set(), ipl2tp_api_attribute_get(),
* ipl2tp_api_session_attribute_get(), ipl2tp_api_session_attribute_set()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_tunnel_authentication_established(Ipl2tp_key *key);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/