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

1333 lines
41 KiB
C

/* ipl2tp_api_session.h - IPL2TP Session API. */
/*
DESCRIPTION
API for Layer 2 Tunneling Protocol session routines.
*/
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp_api_session.h,v $ $Revision: 1.4.16.1 $
* $Source: /home/interpeak/CVSRoot/ipl2tp/include/ipl2tp_api_session.h,v $
* $Author: astephen $ $Date: 2012-01-12 19:48:53 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPL2TP_API_SESSION_H
#define IPL2TP_API_SESSION_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipl2tp_api_session_attribute_set - Set session attributes.
*
* Set session 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. If the session ident value in the skey is set to zero, the
* default session attributes for the provided version is modified.
*
* 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 data.
* 'key' | - | Tunnel/Session identifier.
* 'integer64' | - | 64-bit unsigned integer.
* \te
*
* Use codes are:
* \ts
* 'default' | - | May be used as session default in the ipl2tp_api_open() call.
* 'open' | - | May be used in the ipl2tp_api_session_open() call.
* 'control' | - | May be used in the ipl2tp_api_session_attribute_set() and ipl2tp_api_session_attribute_get() calls.
* 'all' | - | May be used in any context.
* \te
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_attribute_set(Ipl2tp_key *skey, Ipl2tp_attrobj attrobj);
* \ce
*
* PARAMETERS
* \is
* \i 'skey' Session ID.
* \i 'attrobj' Session attributes.
* \ie
*
* ATTRIBUTES
* \is
*
* \i 'IPL2TP_SATTR_SET_AUTH_METHOD'
* \ts
* Use: default, open.
* Type: integer.
* Set the proxy authentication type. Setting this attribute to a non-zero value enables a Proxy Authen Type AVP in the ICCN message. Refer to RFC2661 for additional information about proxy authentication.
* Currently defined values are:
* 1 - Textual username/password exchange
* 2 - PPP CHAP
* 3 - PPP PAP
* 4 - No Authentication
* 5 - Microsoft CHAP Version 1 (MSCHAPv1)
* \te
*
* \i 'IPL2TP_SATTR_SET_BEARER_TYPE'
* \ts
* Use: default, open.
* Type: integer.
* Set the bearer type of the session.
* Valid values are:
* 'IPL2TP_MIB_BEARER_NONE'
* 'IPL2TP_MIB_BEARER_DIGITAL'
* 'IPL2TP_MIB_BEARER_ANALOG'
* 'IPL2TP_MIB_BEARER_DIGITAL_ANALOG'
* \te
*
* \i 'IPL2TP_SATTR_SET_CALLED_NUMBER'
* \ts
* Use: open.
* Type: string.
* Set the called number information string. Setting this attribute enables a Called Number AVP in the ICRQ message.
* \te
*
* \i 'IPL2TP_SATTR_SET_CALLING_NUMBER'
* \ts
* Use: open.
* Type: string.
* Set the calling number information string. Setting this attribute enables a Calling Number AVP in the ICRQ message.
* \te
*
* \i 'IPL2TP_SATTR_SET_DATA_CALLBACK'
* \ts
* Use: all.
* Type: pointer.
* Set the function pointer of the data callback routine. The callback is called when sending PPP data to a remote device. The callback routine uses the Ipl2tp_data_callback() prototype.
* \te
*
* \i 'IPL2TP_SATTR_SET_FIRST_RECEIVED_CONFREQ'
* \ts
* Use: open.
* Type: vector.
* Set the first received CONFREQ packet from the PPP LCP negotiation. Setting this attribute enables an Initial Received LCP CONFREQ AVP in the ICCN message. Using this attribute may eliminate the need for the LNS to renegotiate LCP.
* Refer to RFC2661 for additional information about proxy LCP.
* \te
*
* \i 'IPL2TP_SATTR_SET_FRAMING_TYPE'
* \ts
* Use: default, open, control (see note).
* Type: integer.
* Set the framing type of the session.
* Valid values are:
* 'IPL2TP_MIB_FRAMING_NONE'
* 'IPL2TP_MIB_FRAMING_SYNC'
* 'IPL2TP_MIB_FRAMING_ASYNC'
* 'IPL2TP_MIB_FRAMING_SYNC_ASYNC'
* \te
* Note: The only allowed control context for this attribute is the window between an IPL2TP_STATUS_REQUEST session status callback and an establishment confirmation with the ipl2tp_outgoing_session_established() call.
*
* \i 'IPL2TP_SATTR_SET_LAST_RECEIVED_CONFREQ'
* \ts
* Use: open.
* Type: vector.
* Set the last received CONFREQ packet from the PPP LCP negotiation. Setting this attribute enables a Last Received LCP CONFREQ AVP in the ICCN message. Using this attribute may eliminate the need for the LNS to renegotiate LCP.
* Refer to RFC2661 for additional information about proxy LCP.
* \te
*
* \i 'IPL2TP_SATTR_SET_LAST_SENT_CONFREQ'
* \ts
* Use: open.
* Type: vector.
* Set the last sent CONFREQ packet from the PPP LCP negotiation. Setting this attribute enables a Last Sent LCP CONFREQ AVP in the ICCN message. Using this attribute may eliminate the need for the LNS to renegotiate LCP.
* Refer to RFC2661 for additional information about proxy LCP.
* \te
*
* \i 'IPL2TP_SATTR_SET_MAXIMUM_BPS'
* \ts
* Use: control.
* Type: integer.
* Set the highest acceptable line speed for an outgoing call.
* \te
*
* \i 'IPL2TP_SATTR_SET_MINIMUM_BPS'
* \ts
* Use: control.
* Type: integer.
* Set the lowest acceptable line speed for an outgoing call.
* \te
*
* \i 'IPL2TP_SATTR_SET_PHYS_CHAN_ID'
* \ts
* Use: default, open, control (see note).
* Type: integer.
* Set the physical channel ID, used for logging purposes.
* Setting this attribute enables a Physical Channel ID AVP in the ICRQ and OCRP messages.
* Note: The only allowed control context for this attribute is in the session status callback, when it is called with a status of 'IPL2TP_STATUS_REQUEST'.
* \te
*
* \i 'IPL2TP_SATTR_SET_PRIVATE_GROUP_ID'
* \ts
* Use: open.
* Type: string.
* Set the private group ID, used by the LNS to associate sessions to a particular network. Setting this attribute enables a Private Group ID AVP in the ICCN message.
* \te
*
* \i 'IPL2TP_SATTR_SET_PROXY_AUTHEN_CHALLENGE'
* \ts
* Use: open.
* Type: vector.
* Set the proxy authentication challenge. Setting this attribute enables a Proxy Authen Challenge AVP in the ICCN message.
* Refer to RFC2661 for additional information about proxy authentication.
* \te
*
* \i 'IPL2TP_SATTR_SET_PROXY_AUTHEN_ID'
* \ts
* Use: open.
* Type: integer.
* Set the proxy authentication ID. Setting this attribute to a non-zero value enables a Proxy Authen ID AVP in the ICCN message.
* Refer to RFC2661 for additional information about proxy authentication.
* \te
*
* \i 'IPL2TP_SATTR_SET_PROXY_AUTHEN_NAME'
* \ts
* Use: open.
* Type: string.
* Set the proxy authentication name. Setting this attribute enables a Proxy Authen Name AVP in the ICCN message.
* Refer to RFC2661 for additional information about proxy authentication.
* \te
*
* \i 'IPL2TP_SATTR_SET_PROXY_AUTHEN_RESPONSE'
* \ts
* Use: open.
* Type: vector.
* Set the proxy authentication response. Setting this attribute enables a Proxy Authen Response AVP in the ICCN message.
* Refer to RFC2661 for additional information about proxy authentication.
* \te
*
* \i 'IPL2TP_SATTR_SET_RX_CONNECT_SPEED'
* \ts
* Use: default, open, control (see note).
* Type: integer.
* Set the Rx connect speed in bits per second, i.e. the speed from the remote system to the LAC.
* Note: The only allowed control context for this attribute is the window between an 'IPL2TP_STATUS_REQUEST' session status callback and an establishment confirmation with the ipl2tp_outgoing_session_established() call.
* \te
*
* \i 'IPL2TP_SATTR_SET_SLI_CALLBACK'
* \ts
* Use: all.
* Type: pointer.
* Set the function pointer of the SLI callback routine. The callback is called when an SLI message is received from the peer host. The callback routine uses the Ipl2tp_sli_callback() prototype.
* \te
*
* \i 'IPL2TP_SATTR_SET_STATUS_CALLBACK'
* \ts
* Use: all.
* Type: pointer.
* Set the function pointer of the session status callback routine. The callback is called whenever there is a change in session status. The callback routine uses the Ipl2tp_status_callback() prototype.
* \te
*
* \i 'IPL2TP_SATTR_SET_SUB_ADDRESS'
* \ts
* Use: open.
* Type: string.
* Set the sub address, used to send additional dialing information to the LNS. Setting this attribute enables a Sub-Address AVP in the ICRQ message.
* \te
*
* \i 'IPL2TP_SATTR_SET_TX_CONNECT_SPEED'
* \ts
* Use: default, open, control (see note).
* Type: integer.
* Set the Tx connect speed in bits per second, i.e. the speed from the LAC to the remote system. This attribute is also used for Rx connect speed (remote system to LAC) if the 'IPL2TP_SATTR_SET_RX_CONNECT_SPEED' attribute is missing.
* Note: The only allowed control context for this attribute is the window between an IPL2TP_STATUS_REQUEST session status callback and an establishment confirmation with the ipl2tp_outgoing_session_established() call.
* \te
*
* \i 'IPL2TP_SATTR_SET_USER_DATA'
* \ts
* Use: all.
* Type: pointer.
* Set the user-defined pointer that is passed as a parameter to all the session callbacks. This pointer can for example be used to point to a set of application-specific variables.
* \te
*
* \i 'IPL2TP_SATTR_SET_l2tpSessionStatsIfIndex'
* \ts
* Use: open, control (see note).
* Type: integer.
* Set the index of the interface that PPP packets are being tunneled from.
* Note: The only allowed control context for this attribute is in the session status callback, when it is called with a status of 'IPL2TP_STATUS_REQUEST'.
* \te
*
* \i 'IPL2TP_SATTR_SET_PSEUDOWIRE_TYPE'
* \ts
* Use: control.
* Type: integer.
* Specifies the pseudowire type for this session.
* \te
*
* \i 'IPL2TP_SATTR_SET_REMOTE_END_ID'
* \ts
* Use: control.
* Type: vector.
* Specifies the remote end id for the circuit.
* \te
*
* \i 'IPL2TP_SATTR_SET_LOCAL_CIRCUIT_STATUS'
* \ts
* Use: control.
* Type: integer.
* Specifies the local circuit status.
* Valid values are:
* 'IPL2TP_MIB_UP'
* 'IPL2TP_MIB_DOWN'
* \te
*
* \i 'IPL2TP_SATTR_SET_DATA_SEQUENCING'
* \ts
* Use: control.
* Type: integer.
* Specifies the data sequencing.
* Valid values are:
* 'IPL2TP_ATTR_DATA_SEQUENCING_NEVER'
* 'IPL2TP_ATTR_DATA_SEQUENCING_NONIPONLY'
* 'IPL2TP_ATTR_DATA_SEQUENCING_ALWAYS'
* \te
*
* \i 'IPL2TP_SATTR_SET_L2_SUBLAYER'
* \ts
* Use: control.
* Type: integer
* Specifies the L2 sublayer.
* Valid values are:
* 'IPL2TP_ATTR_L2_SUBLAYER_NONE'
* 'IPL2TP_ATTR_L2_SUBLAYER_DEFAULT'
* \te
*
* \i 'IPL2TP_SATTR_SET_TX_CONNECT_SPEED64'
* \ts
* Use: control.
* Type: integer64.
* Specifies the 64 bit TX connect speed.
* \te
*
* \i 'IPL2TP_SATTR_SET_RX_CONNECT_SPEED64'
* \ts
* Use: control.
* Type: integer64.
* Specifies the RX connect speed.
* \te
*
* \i 'IPL2TP_SATTR_SET_L2_OUT_OF_ORDER_RESET'
* \ts
* Use: control.
* Type: integer.
* Specifies the number of sequenced data packets that should be internally sequential, but outside the data sequence window, before we reset the data sequence window to the currently used/seen sequence numbers.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the session 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_SATTR_RW_TX_CONNECT_SPEED, 38400);
*
* /@ Get parameter @/
* ipl2tp_api_session_attribute_set(session_id, 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_session_attribute_set(Ipl2tp_key *key,
Ipl2tp_attrobj attr);
/*******************************************************************************
*
* ipl2tp_api_session_attribute_get - Get session attributes.
*
* Get session 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 data.
* 'key' | - | Tunnel/Session identifier.
* 'integer64' | - | 64-bit unsigned integer.
* \te
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_attribute_get(Ipl2tp_key *skey, Ipl2tp_attrobj attrobj, Ipl2tp_attrobj *replies);
* \ce
*
* PARAMETERS
* \is
* \i 'skey' Session ID.
* \i 'attrobj' Session attributes.
* \i 'replies' Placeholder for the answers.
* \ie
*
* ATTRIBUTES
* \is
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsAuthMethod' or 'IPL2TP_SATTR_GET_AUTH_METHOD'
* \ts
* Type: integer.
* Get the proxy authentication type.
* Refer to RFC2661 for additional information about proxy authentication.
* Currently defined values are:
* 1 - Textual username/password exchange
* 2 - PPP CHAP
* 3 - PPP PAP
* 4 - No Authentication
* 5 - Microsoft CHAP Version 1 (MSCHAPv1)
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsCallBearerType' or 'IPL2TP_SATTR_GET_BEARER_TYPE'
* \ts
* Type: integer.
* Get the bearer type of the session.
* Valid values are:
* 'IPL2TP_MIB_BEARER_NONE'
* 'IPL2TP_MIB_BEARER_DIGITAL'
* 'IPL2TP_MIB_BEARER_ANALOG'
* 'IPL2TP_MIB_BEARER_DIGITAL_ANALOG'
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsDNIS' or 'IPL2TP_SATTR_GET_CALLED_NUMBER'
* \ts
* Type: string.
* Get the called number information string. Setting this attribute enables a Called Number AVP in the ICRQ message.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsCLID' or 'IPL2TP_SATTR_GET_CALLING_NUMBER'
* \ts
* Type: string.
* Get the calling number information string. Setting this attribute enables a Calling Number AVP in the ICRQ message.
* \te
*
* \i 'IPL2TP_SATTR_GET_DATA_CALLBACK'
* \ts
* Type: pointer.
* Get the function pointer of the data callback routine.
* \te
*
* \i 'IPL2TP_SATTR_GET_FIRST_RECEIVED_CONFREQ'
* \ts
* Type: vector.
* Get the first received CONFREQ packet from the PPP LCP negotiation.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsFramingType' or 'IPL2TP_SATTR_GET_FRAMING_TYPE'
* \ts
* Type: integer.
* Get the framing type of the session.
* Valid values are:
* 'IPL2TP_MIB_FRAMING_NONE'
* 'IPL2TP_MIB_FRAMING_SYNC'
* 'IPL2TP_MIB_FRAMING_ASYNC'
* 'IPL2TP_MIB_FRAMING_SYNC_ASYNC'
* \te
*
* \i 'IPL2TP_SATTR_GET_LAST_RECEIVED_CONFREQ'
* \ts
* Type: vector.
* Get the last received CONFREQ packet from the PPP LCP negotiation.
* \te
*
* \i 'IPL2TP_SATTR_GET_LAST_SENT_CONFREQ'
* \ts
* Type: vector.
* Get the last sent CONFREQ packet from the PPP LCP negotiation.
* \te
*
* \i 'IPL2TP_SATTR_GET_MAXIMUM_BPS'
* \ts
* Type: integer.
* Get the highest acceptable line speed for an outgoing call.
* \te
*
* \i 'IPL2TP_SATTR_GET_MINIMUM_BPS'
* \ts
* Type: integer.
* Get the lowest acceptable line speed for an outgoing call.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsPhysChanId' or 'IPL2TP_SATTR_GET_PHYS_CHAN_ID'
* \ts
* Type: integer.
* Get the physical channel ID used for logging purposes.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsPrivateGroupID' or 'IPL2TP_SATTR_GET_PRIVATE_GROUP_ID'
* \ts
* Type: string.
* Get the private group ID used by the LNS to associate sessions to a particular network.
* \te
*
* \i 'IPL2TP_SATTR_GET_PROXY_AUTHEN_CHALLENGE'
* \ts
* Type: vector.
* Get the proxy authentication challenge.
* \te
*
* \i 'IPL2TP_SATTR_GET_PROXY_AUTHEN_ID'
* \ts
* Type: integer.
* Get the proxy authentication ID.
* \te
*
* \i 'IPL2TP_SATTR_GET_PROXY_AUTHEN_NAME'
* \ts
* Type: string.
* Get the proxy authentication name.
* \te
*
* \i 'IPL2TP_SATTR_GET_PROXY_AUTHEN_RESPONSE'
* \ts
* Type: vector.
* Get the proxy authentication response.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsRxConnectSpeed' or 'IPL2TP_SATTR_GET_RX_CONNECT_SPEED'
* \ts
* Type: integer.
* Get the Rx connect speed in bits per second, i.e. the speed from the remote system to the LAC.
* \te
*
* \i 'IPL2TP_SATTR_GET_SLI_CALLBACK'
* \ts
* Type: pointer.
* Get the function pointer of the SLI callback routine.
* \te
*
* \i 'IPL2TP_SATTR_GET_STATUS_CALLBACK'
* \ts
* Type: pointer.
* Get the function pointer of the session status callback routine.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsSubAddress' or 'IPL2TP_SATTR_GET_SUB_ADDRESS'
* \ts
* Type: string.
* Get the sub address used to send additional dialing information to the LNS.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsTxConnectSpeed' or 'IPL2TP_SATTR_GET_TX_CONNECT_SPEED'
* \ts
* Type: integer.
* Get TX connect speed in bits per second, i.e. the speed from the LAC to the remote system.
* \te
*
* \i 'IPL2TP_SATTR_GET_USER_DATA'
* \ts
* Type: pointer.
* Get the user-defined pointer that is passed as a parameter to all the session callbacks.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsCallSerialNumber'
* \ts
* Type: integer.
* Get the call serial number which is used to identify sessions.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsCallType'
* \ts
* Type: integer.
* Get the direction of the call.
* Valid values are:
* 'IPL2TP_MIB_LAC_INCOMING' Incoming call
* 'IPL2TP_MIB_LAC_OUTGOING' Outgoing call
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsIfIndex'
* \ts
* Type: integer.
* Get the index of the interface that PPP packets are being tunneled from.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsLocalSID'
* \ts
* Type: address.
* Get the session ID.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsOutSequence'
* \ts
* Type: integer.
* Get the number of out-of-sequence packets received.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsProxyLcp'
* \ts
* Type: integer.
* Get the proxy LCP flag, which is non-zero if proxy LCP was performed for this session. Proxy LCP is selected by setting the 'IPL2TP_SATTR_SET_AUTH_METHOD' attribute to a non-zero value.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsReassemblyTimeouts'
* \ts
* Type: integer.
* Get the number of reassembly timeouts for this session.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsRecvSeq'
* \ts
* Type: integer.
* Get the next expected receive sequence number.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsRemoteSID'
* \ts
* Type: address.
* Get the remote assigned session ID.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsSendSeq'
* \ts
* Type: integer.
* Get the next send sequence number.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsSequencingState'
* \ts
* Type: integer.
* Get the current sequencing state of the session.
* Valid values are:
* 'IPL2TP_MIB_NONE' No sequencing
* 'IPL2TP_MIB_LOCAL' Enabled by the LAC
* 'IPL2TP_MIB_REMOTE' Enabled by the LNS
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsState'
* \ts
* Type: integer.
* Get the current session status.
* Valid values are:
* 'IPL2TP_MIB_IDLE' Session is idle
* 'IPL2TP_MIB_CONNECTING' Session is connecting
* 'IPL2TP_MIB_ESTABLISHED' Session is established
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsTunnelIfIndex'
* \ts
* Type: integer.
* Get the interface index of the tunnel in which this session resides.
* \te
*
* \i 'IPL2TP_SATTR_GET_l2tpSessionStatsUserName'
* \ts
* Type: string.
* Get the available login name of the remote user.
* \te
*
* \i 'IPL2TP_SATTR_GET_PSEUDOWIRE_TYPE'
* \ts
* Type: integer.
* Retrieves the pseudowire type for this session.
* \te
*
* \i 'IPL2TP_SATTR_GET_REMOTE_END_ID'
* \ts
* Type: vector.
* Get the remote end id for the circuit.
* \te
*
* \i 'IPL2TP_SATTR_GET_LOCAL_CIRCUIT_STATUS'
* \ts
* Type: integer.
* Get the local circuit status.
* Valid values are:
* 'IPL2TP_MIB_UP'
* 'IPL2TP_MIB_DOWN'
* \te
*
* \i 'IPL2TP_SATTR_GET_REMOTE_CIRCUIT_STATUS'
* \ts
* Type: integer.
* Get the remote circuit status.
* Valid values are:
* 'IPL2TP_MIB_UP'
* 'IPL2TP_MIB_DOWN'
* \te
*
* \i 'IPL2TP_SATTR_GET_DATA_SEQUENCING'
* \ts
* Type: integer.
* Get the data sequencing.
* Valid values are:
* 'IPL2TP_ATTR_DATA_SEQUENCING_NEVER'
* 'IPL2TP_ATTR_DATA_SEQUENCING_NONIPONLY'
* 'IPL2TP_ATTR_DATA_SEQUENCING_ALWAYS'
* \te
*
* \i 'IPL2TP_SATTR_GET_L2_SUBLAYER'
* \ts
* Type: integer.
* Get the L2 sublayer.
* Valid values: are:
* 'IPL2TP_ATTR_L2_SUBLAYER_NONE'
* 'IPL2TP_ATTR_L2_SUBLAYER_DEFAULT'
* \te
*
* \i 'IPL2TP_SATTR_GET_TX_CONNECT_SPEED64'
* \ts
* Type: integer64.
* Get the 64 bit TX connect speed in bits/s.
* \te
*
* \i 'IPL2TP_SATTR_GET_RX_CONNECT_SPEED64'
* \ts
* Type: integer64.
* Get the 64 bit the RX connect speed in bits/s.
* \te
*
* \i 'IPL2TP_SATTR_GET_L2_OUT_OF_ORDER_RESET'
* \ts
* Type: integer.
* Get the number of sequenced data packets that should be internally sequential, but outside the data sequence window, before the data sequence window is reset to the currently used/seen sequence numbers.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the session 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_SATTR_GET_TX_CONNECT_SPEED);
*
* /@ Get parameter @/
* ipl2tp_api_session_attribute_get(session_id, attrobj, &replies);
* a = ipl2tp_attr_first(replies);
* printf("Connect speed 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_session_attribute_get(Ipl2tp_key *key,
Ipl2tp_attrobj attr,
Ipl2tp_attrobj *replies);
/*
*===========================================================================
* ipl2tp_api_session_attribute_query
*===========================================================================
* Description: Get a singular session parameter
* Parameters: key - The session key.
* query - The query
* replies - Where the replies are to be stored.
* Returns:
*
* \NOMANUAL
*/
IP_EXTERN void ipl2tp_api_session_attribute_query(Ipl2tp_key *key,
int query,
Ipl2tp_attrobj *replies);
/*******************************************************************************
*
* ipl2tp_api_session_open - Open a session to a peer L2TP device.
*
* Open a session to a peer L2TP device. If there already exists a tunnel to the peer,
* and if the attributes allow, the existing tunnel is used. Otherwise, a new
* tunnel is created with a new session.
*
* 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_SATTR_STATUS_CALLBACK
* attribute. The callback is called when there is a change of status in the session.
*
* The version of the session is determined either by the version field in the tunnel
* key 'tkey', or by the version field in 'sidp' in case no tunnel is specified.
*
* The ID and version of the new session is stored in a location pointed to by the 'sidp'
* argument.
*
* The new session may be created in a specific tunnel by entering a tunnel key in the
* 'tkey' parameter. If any tunnel can be used, set 'tkey' to IP_NULL.
*
* Refer to the functions ipl2tp_tunnel_control() and ipl2tp_session_control()
* for a description of available attributes.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_open(Ipl2tp_key *sidp, Ipl2tp_key *tkey, union Ip_sockaddr_union *addr, Ipl2tp_attrobj tattr, Ipl2tp_attrobj sattr, Ip_bool incoming);
* \ce
*
* PARAMETERS
* \is
* \i 'sidp' Session ID pointer.
* \i 'tkey' If possible, establish session in this tunnel.
* \i 'addr' IP address to peer.
* \i 'tattr' Tunnel attributes.
* \i 'sattr' Session attributes.
* \i 'incoming' IP_TRUE if it is an incoming call, IP_FALSE if it is an outgoing call.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_DRAIN' if session creation is disabled.
* \i 'IPL2TP_STATUS_NOMEM' if out of memory.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* struct Ip_in_addr ipaddr;
* Ipl2tp_attrobj tattr = IP_NULL;
* Ipl2tp_attrobj sattr = IP_NULL;
* Ipl2tp_key skey;
* 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);
*
* /@ Set session attributes @/
* ipl2tp_attr_iappend(&sattr,
* IPL2TP_SATTR_RW_TX_CONNECT_SPEED, 9600);
*
* ipl2tp_attr_iappend(&sattr,
* IPL2TP_SATTR_RW_FRAMING_TYPE,
* IPL2TP_MIB_FRAMING_SYNC);
*
* /@ Set CONFREQ attributes @/
* ipl2tp_attr_vappend(&sattr,
* IPL2TP_SATTR_RW_FIRST_RECEIVED_CONFREQ,
* first_rec_confreq.data,
* first_rec_confreq.length);
*
* ipl2tp_attr_vappend(&sattr,
* IPL2TP_SATTR_RW_LAST_RECEIVED_CONFREQ,
* last_rec_confreq.data,
* last_rec_confreq.length);
*
* ipl2tp_attr_vappend(&sattr,
* IPL2TP_SATTR_RW_LAST_SENT_CONFREQ,
* last_sent_confreq.data,
* last_sent_confreq.length);
*
* /@ Open session @/
* skey.version = IPL2TP_VERSION_L2TPV2;
* if (ipl2tp_api_session_open(&skey, 0, &saddr, tattr, sattr, IP_TRUE) != IPL2TP_STATUS_OK)
* {
* printf("Failed at session_open()\n");
* }
*
* /@ Delete attribute objects @/
* ipl2tp_attr_delete(&tattr);
* ipl2tp_attr_delete(&sattr);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_session_close()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_open(Ipl2tp_key *sidp,
Ipl2tp_key *key,
union Ip_sockaddr_union *addr,
Ipl2tp_attrobj tattr,
Ipl2tp_attrobj sattr,
Ip_bool incoming);
/*******************************************************************************
*
* ipl2tp_api_session_close - Close a session to a peer L2TP device.
*
* Close a session to a peer L2TP device. 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 in ipl2tp_api_session_open() is called
* when the close operation is complete.
*
* The session ID is obtained when calling ipl2tp_api_session_open().
*
* If this is the last session in the tunnel, the tunnel is also closed.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_close(Ipl2tp_key *skey);
* \ce
*
* PARAMETERS
* \is
* \i 'skey' Session ID
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the session ID is invalid.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_session_close(session_id) != IPL2TP_STATUS_OK)
* {
* printf("Error closing session %d\n", skey->ident);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_session_open()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_close(Ipl2tp_key *key);
/*
*===========================================================================
* ipl2tp_api_session_is_closed
*===========================================================================
* Description: Determine whether the session with the given ID has been closed.
* Parameters: key - Session identifier
* Returns: IP_TRUE if session has been closed.
* IP_FALSE if otherwise.
*/
IP_EXTERN Ip_bool ipl2tp_api_session_is_closed(Ipl2tp_key *key);
/*
*===========================================================================
* ipl2tp_api_session_next
*===========================================================================
* Description: Retrieves the tunnel identifier
* Parameters: tkey - The tunnel identifier
* last - Last session 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_session_next(Ipl2tp_key *tkey,
Ipl2tp_key *last,
Ipl2tp_key *next);
/*
*===========================================================================
* ipl2tp_api_session_type
*===========================================================================
* Description: Human readable description of type of session
* Parameters: key - The session key
* Returns: The human readable description.
*
* \NOMANUAL
*/
IP_EXTERN const char *ipl2tp_api_session_type(Ipl2tp_key *key);
/*******************************************************************************
*
* ipl2tp_api_session_ppp_input - Send a PPP packet to IPL2TP for processing.
*
* Send a PPP packet to IPL2TP for processing.
*
* The 'offset' parameter is an indication of how many octets
* that may be used by IPL2TP to insert an L2TP header. Using the original PPP
* buffer eliminates an additional memory allocation and copy operation, thus
* increasing performance. An offset of 12 octets is sufficient for all L2TP
* messages sent by IPL2TP.
*
* The 'align' parameter informs IPL2TP of alignment constraints on the resulting
* output buffer. Note that the alignment constraint may increase the required offset.
* An align parameter of 8 would, for example, require an offset of 16 to be able to use
* the original PPP buffer.
*
* The 'is_ip parameter indicates whether or not this is an IP frame. This is used mainly in
* session data sequencing for L2TPv3.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_ppp_input(Ipl2tp_key *session_key, void *buffer, int length, int offset, int align, Ip_bool is_ip);
* \ce
*
* PARAMETERS
* \is
* \i 'session_key' The session ID of the packet.
* \i 'buffer' PPP packet.
* \i 'length' Length of the PPP packet.
* \i 'offset' Number of buffer bytes that may be used.
* \i 'align' Alignment requirement for the output buffer.
* \i 'is_ip' Is this an IP frame.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the session ID is invalid.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_session_ppp_input(sesid, pppbuf, length, 12, 4, IP_TRUE) != IPL2TP_STATUS_OK)
* {
* printf("Error sending PPP packet to session %d\n", sesid->ident);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_l2tp_input(), Ipl2tp_write_callback(), Ipl2tp_data_callback()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_ppp_input(Ipl2tp_key *key,
void *buffer,
int length,
int offset,
int align,
Ip_bool is_ip);
/*******************************************************************************
*
* ipl2tp_api_session_ethernet_input - Send an ethernet packet to IPL2TP for processing.
*
* Send an ethernet packet to IPL2TP for processing.
*
* The 'offset' parameter is an indication of how many octets of memory
* that may be used by IPL2TP to insert an L2TP header. Using the original ethernet
* buffer eliminates an additional memory allocation and copy operation, thus
* increasing performance. An offset of 12 octets is sufficient for all L2TP
* messages sent by IPL2TP.
*
* The 'align' parameter informs IPL2TP of alignment constraints on the resulting
* output buffer. Note that the alignment constraint may increase the required offset.
* An align parameter of 8 would for example require an offset of 16 to be able to use
* the original ethernet buffer.
*
* The 'is_ip' parameter indicates whether or not this is an IP frame. This is used mainly in
* session data sequencing for L2TPv3.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_ethernet_input(Ipl2tp_key *session_key, void *buffer, int length, int offset, int align, Ip_bool is_ip);
* \ce
*
* PARAMETERS
* \is
* \i 'session_key' The session ID the packet belongs to.
* \i 'buffer' Ethernet packet.
* \i 'length' Length of the Ethernet packet.
* \i 'offset' Number of buffer bytes that may be used.
* \i 'align' Alignment requirement for the output buffer.
* \i 'is_ip' Is this an IP frame.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the session ID is invalid.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_session_ethernet_input(sesid, pppbuf, length, 12, 4, IP_TRUE) != IPL2TP_STATUS_OK)
* {
* printf("Error sending ethernet packet to session %d\n", sesid->ident);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_l2tp_input(), Ipl2tp_write_callback(), Ipl2tp_data_callback()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_ethernet_input(Ipl2tp_key *key,
void *buffer,
int length,
int offset,
int align,
Ip_bool is_ip);
/*******************************************************************************
*
* ipl2tp_api_session_outgoing_established - Inform IPL2TP that an outgoing session is established.
*
* Inform IPL2TP that an outgoing session is established. This happens when the
* LNS has requested an outgoing call and the LAC has actually established, or
* failed to establish the call.
*
* Note that the session establishment timeout, defined in the attribute
* IPL2TP_ATTR_SET_ESTABLISH_TIMEOUT, is enabled during outgoing
* session establishment. This means that there may be a teardown of the session
* before ipl2tp_outgoing_session_established() is called. In that case, the error
* IPL2TP_STATUS_BADID is returned.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_outgoing_established(Ipl2tp_key *session_key, Ip_u16 result_code, Ip_u16 error_code, CONST char *error_message);
* \ce
*
* PARAMETERS
* \is
* \i 'session_key' Session ID.
* \i 'result_code' Result code as defined in RFC2661.
* \i 'error_code' Error code as defined in RFC2661.
* \i 'error_message' Error message as defined in RFC2661.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_STATE' if wrong state.
* \i 'IPL2TP_STATUS_BADID' if a bad session ID is present.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attr = IP_NULL;
*
* /@ Call is established, set attributes @/
* ipl2tp_attr_iappend(&attr, IPL2TP_SATTR_RW_TX_CONNECT_SPEED, 9600);
*
* ipl2tp_attr_iappend(&attr, IPL2TP_SATTR_RW_FRAMING_TYPE, IPL2TP_MIB_FRAMING_ASYNC);
*
* ipl2tp_api_session_attribute_set(session_key, attr);
* ipl2tp_attr_delete(&attr);
*
* /@ Inform IPL2TP about the establishment @/
* ipl2tp_api_outgoing_session_established(session_key, 0, "");
* }
* \ce
*
*
* SEE ALSO
*
* Ipl2tp_status_callback()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_outgoing_established(Ipl2tp_key *key,
Ip_u16 result_code,
Ip_u16 error_code,
CONST char *error_message);
/*******************************************************************************
*
* ipl2tp_api_session_incoming_established - Inform IPL2TP that an incoming session is established.
*
* Inform IPL2TP that an incoming session is established. This happens when the
* LNS has requested an incoming call and the LAC has actually established, or
* failed to establish the call.
*
* Note that the session establishment timeout, defined in the attribute
* IPL2TP_ATTR_SET_ESTABLISH_TIMEOUT, is enabled during outgoing
* session establishment. This means that there may be a teardown of the session
* before ipl2tp_outgoing_session_established() is called. In that case, the error
* IPL2TP_STATUS_BADID is returned.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_session_incoming_established(Ipl2tp_key *session_key, Ip_u16 result_code, Ip_u16 error_code, CONST char *error_message);
* \ce
*
* PARAMETERS
* \is
* \i 'session_key' Session ID.
* \i 'result_code' Result code as defined in RFC2661.
* \i 'error_code' Error code as defined in RFC2661.
* \i 'error_message' Error message as defined in RFC2661.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_STATE' if wrong state.
* \i 'IPL2TP_STATUS_BADID' if a bad session ID is present.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attr = IP_NULL;
*
* /@ Call is established, set attributes @/
* ipl2tp_attr_iappend(&attr, IPL2TP_SATTR_RW_TX_CONNECT_SPEED, 9600);
* ipl2tp_attr_iappend(&attr, IPL2TP_SATTR_RW_FRAMING_TYPE, IPL2TP_MIB_FRAMING_ASYNC);
* ipl2tp_api_session_attribute_set(session_key, attr);
* ipl2tp_attr_delete(&attr);
*
* /@ Inform IPL2TP about the establishment @/
* ipl2tp_api_incoming_session_established(session_key, 0, "");
* }
* \ce
*
*
* SEE ALSO
*
* Ipl2tp_status_callback()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_session_incoming_established(Ipl2tp_key *key,
Ip_u16 result_code,
Ip_u16 error_code,
CONST char *error_message);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/