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

893 lines
25 KiB
C

/* ipl2tp_api.h - IPL2TP API. */
/*
DESCRIPTION
API for Layer 2 Tunneling Protocol.
*/
/*
******************************************************************************
* SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp_api.h,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipl2tp/include/ipl2tp_api.h,v $
* $Author: tneale $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
*
******************************************************************************
*/
#ifndef _IPL2TP_API_H_
#define _IPL2TP_API_H_
/*
****************************************************************************
* DESCRIPTION
****************************************************************************
*
* Public IPL2TP Application Programming Interface.
*/
/*
****************************************************************************
* INCLUDE FILES
****************************************************************************
*/
#include "ipl2tp_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* DEFINES
****************************************************************************
*/
/*
****************************************************************************
* TYPES
****************************************************************************
*/
/*
****************************************************************************
* PUBLIC DATA
****************************************************************************
*/
IP_EXTERN int ipl2tp_occupied;
/*
****************************************************************************
* PUBLIC FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipl2tp_api_version - Get the IPL2TP API version.
*
* Get the IPL2TP API version.
*
* SYNOPSIS
* \cs
* int ipl2tp_api_version(void);
* \ce
*
* PARAMETERS
* \is
* \i None
* \ie
*
* RETURNS
* \is
* \i API version.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* printf("IPL2TP API version: %d\n", ipl2tp_api_version());
* }
* \ce
*
* SEE ALSO
*
* ERRNO
* None
*/
IP_EXTERN const char *ipl2tp_version(void);
/*
*===========================================================================
* ipl2tp_api_version_api
*===========================================================================
* Description: Returns the API version number. This function can be used
* for applications to support older versions of IPL2TP.
* Parameters:
* Returns: The IPL2TP API version number.
*
* \NOMANUAL
*
*/
IP_EXTERN int ipl2tp_api_version(void);
/*******************************************************************************
*
* ipl2tp_api_init - Initialize IPL2TP.
*
* Perform initialization of IPL2TP, i.e. setup internal data structures, allocate
* memory buffers and initialize library modules.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_init(void);
* \ce
*
* PARAMETERS
* \is
* \i None
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_NOMEM' if out of memory.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_init() != IPL2TP_STATUS_OK)
* {
* error(-1);
* }
* }
* \ce
*
* SEE ALSO
*
* ipl2tp_exit()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_init(void);
/*******************************************************************************
*
* ipl2tp_api_exit - Terminate IPL2TP.
*
* Terminate IPL2TP. This means returning all allocated memory, and clearing
* internal data.
*
* Note that all tunnels and sessions must be closed before calling ipl2tp_api_exit().
* This is done with a call to ipl2tp_api_close(). If tunnels and sessions take a while
* to close, e.g. in the case of network congestion, ipl2tp_api_exit() may fail.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_exit(void);
* \ce
*
* PARAMETERS
* \is
* \i None
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_STATE' if wrong state.
* \i 'IPL2TP_STATUS_BUSY' if tunnels/sessions open.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_exit() != IPL2TP_STATUS_OK)
* {
* error(-1);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_init()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_exit(void);
/*******************************************************************************
*
* ipl2tp_api_open - Open and configure IPL2TP.
*
* Open and configure IPL2TP, which means that global attributes, default tunnel
* attributes and default session attributes are set.
*
* Refer to the functions ipl2tp_control(), ipl2tp_tunnel_control() and
* ipl2tp_session_control() for a description of available attributes.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_open(Ipl2tp_attrobj attr, Ipl2tp_attrobj tattr_v2, Ipl2tp_attrobj tattr_v3, Ipl2tp_attrobj sattr_v2, Ipl2tp_attrobj sattr_v3);
* \ce
*
* PARAMETERS
* \is
* \i 'attr' Global IPL2TP attributes.
* \i 'tattr_v2' Default tunnel attributes for L2TPV2.
* \i 'tattr_v3 Default' tunnel attributes for L2TPV3.
* \i 'sattr_v2 Default' session attributes for L2TPV2.
* \i 'sattr_v3 Default' session attributes for L2TPV3.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_STATE' if wrong state.
* \i 'IPL2TP_STATUS_BADPARAM' if a bad attribute object(s) is present.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_attrobj attr = IP_NULL;
*
* /@ Initialize @/
* ipl2tp_api_init();
*
* /@ Create attribute object @/
* ipl2tp_attr_strappend(&attr, IPL2TP_ATTR_SET_HOST_NAME, "myname");
* ipl2tp_api_open(attr, IP_NULL, IP_NULL, IP_NULL, IP_NULL);
* ipl2tp_attr_delete(&attr);
* }
* \ce
*
*
* 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_open(Ipl2tp_attrobj attr,
Ipl2tp_attrobj tattr_v2,
Ipl2tp_attrobj tattr_v3,
Ipl2tp_attrobj sattr_v2,
Ipl2tp_attrobj sattr_v3);
/*******************************************************************************
*
* ipl2tp_api_close - Close IPL2TP.
*
* Close IPL2TP, which means that all tunnels and sessions are terminated. Note that
* the close operations are only started with this call. The actual completion may take
* several seconds depending on the number of open tunnels/sessions and on network
* congestion.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_close(void);
* \ce
*
* PARAMETERS
* \is
* \i None
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_STATE' if wrong state.
* \ie
*
*
* EXAMPLE
* \cs
* void example(void)
* {
* if (ipl2tp_api_close() != IPL2TP_STATUS_OK)
* {
* printf("Close error\n");
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_api_open()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_close(void);
/*******************************************************************************
*
* ipl2tp_api_attribute_set - Set global IPL2TP attributes.
*
* Set the global IPL2TP 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.
* 'integer64': 64-bit unsigned integer
* 'pointer': General-purpose pointer.
* 'string': Pointer to null-terminated character string.
* 'vector': General-purpose vector with variable length.
* 'address': Address.
* 'key': Tunnel/Session key information.
* \te
* All attributes that set a value may also be used in the ipl2tp_api_open() call.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_attribute_set(Ipl2tp_attrobj attrobj);
* \ce
*
* PARAMETERS
* \is
* \i 'attrobj' Global IPL2TP attributes.
* \ie
*
* ATTRIBUTES
* \is
* \i 'IPL2TP_ATTR_SET_ENABLE_OUTGOING'
* \ts
* Type: integer.
* Set the outgoing flag that selects if outgoing tunnels or sessions may be created. A non-zero value enables the outgoing functionality.
* \te
*
* \i 'IPL2TP_ATTR_SET_ESTABLISH_TIMEOUT_SEC'
* \ts
* Type: integer.
* Set the timeout for tunnel and session establishment. If a tunnel or session establishment has not been completed within this time, a teardown is performed. Note that a tunnel that is created in the idle state is not affected by this timeout.
* \te
*
* \i 'IPL2TP_ATTR_SET_FIRST_RETRANSMIT_SEC'
* \ts
* Type: integer.
* Set the number of seconds until the first retransmission of a control message.
* \te
*
* \i 'IPL2TP_ATTR_SET_HELLO_TICK_SEC'
* \ts
* Type: integer.
* Set the resolution of the HELLO message transmission. A small value creates more accurate HELLO message intervals, to the expense of increased overhead.
* \te
*
* \i 'IPL2TP_ATTR_SET_HOST_NAME'
* \ts
* Type: string.
* Set the IPL2TP host name, reported to the peer host.
* \te
*
* \i 'IPL2TP_ATTR_SET_L2TP_WRITE_CALLBACK'
* \ts
* Type: pointer.
* Set the function pointer of the L2TP write callback routine. The callback is called whenever there is an L2TP message that should be transported to the LNS. This is typically a routine that writes to an UDP socket. The callback routine uses the Ipl2tp_write_callback() prototype.
* \te
*
* \i 'IPL2TP_ATTR_SET_OPEN_EXCLUSIVE'
* \ts
* Type: integer.
* Set the exclusive tunnel flag. IPL2TP_MIB_YES means that it is possible to create multiple tunnels to the same LNS, and that IPL2TP tries to create new tunnels for all future sessions.
* \te
*
* \i 'IPL2TP_ATTR_SET_TUNNEL_ZOMBIE_SEC'
* \ts
* Type: integer.
* Set the number of seconds a tunnel is kept alive after a teardown. This time is to ensure that the reliable control channel is able to complete the delivery of a message before the tunnel disappears.
* \te
*
* \i 'IPL2TP_ATTR_SET_l2tpAdminState'
* \ts
* Type: integer.
* Set the global administrative state of IPL2TP.
* Valid values are:
* 'IPL2TP_MIB_ENABLED' Enable IPL2TP
* 'IPL2TP_MIB_DISABLED' Disable IPL2TP
* When setting IPL2TP to the disabled state, an immediate teardown of all open tunnels is performed.
* \te
*
* \i 'IPL2TP_ATTR_SET_l2tpDrainTunnels'
* \ts
* Type: integer.
* Set the global draining state of IPL2TP. When draining is enabled, no additional tunnel or session establishments are accepted.
* Valid values are:
* 'IPL2TP_MIB_YES' Enable draining
* 'IPL2TP_MIB_NO' Disable draining
* When draining is enabled and the last tunnel is closed, the administrative state of IPL2TP transitions to 'IPL2TP_MIB_DISABLED'.
* \te
*
* \i 'IPL2TP_ATTR_SET_l2tpFirmwareRev'
* \ts
* Type: integer.
* Set IPL2TP firmware revision number. For example, version 1.0.5 is returned as the decimal number 105.
* \te
*
* \i 'IPL2TP_ATTR_SET_l2tpVendorName'
* \ts
* Type: string.
* Set the IPL2TP vendor name.
* \te
*
* \i 'IPL2TP_ATTR_SET_ENABLE_L2TP_V2'
* \ts
* Type: integer.
* Enable or disable L2TP version 2.
* A value of 'IPL2TP_MIB_YES' means enabled, and a value of 'IPL2TP_MIB_NO' means disabled.
* \te
*
* \i 'IPL2TP_ATTR_SET_ENABLE_L2TP_V3'
* \ts
* Type: integer.
* Enable or disable L2TP version 3.
* A value of 'IPL2TP_MIB_YES' means enabled and a value of 'IPL2TP_MIB_NO' means disabled.
* \te
*
* \i 'IPL2TP_ATTR_SET_CLOSE_UNUSED_TUNNELS'
* \ts
* Type: integer.
* If 'IPL2TP_MIB_YES' (default), the L2TP system closes tunnels when all sessions belonging to it are closed. If 'IPL2TP_MIB_NO', the tunnels remain open.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \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_ATTR_SET_ENABLE_OUTGOING, IPL2TP_MIB_YES);
*
* /@ Set parameter and free attribute object @/
* ipl2tp_api_attribute_set(attrobj);
* ipl2tp_attr_delete(&attrobj);
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_attr_new(), ipl2tp_attr_delete(), ipl2tp_attr_iappend(),
* ipl2tp_attr_pappend()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_attribute_set(Ipl2tp_attrobj attr);
/*******************************************************************************
*
* ipl2tp_api_attribute_get - Get global IPL2TP attributes.
*
* Get the global IPL2TP 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.
* 'integer64' 64-bit unsigned integer.
* 'pointer' General-purpose pointer.
* 'string' Pointer to null-terminated character string.
* 'vector' General-purpose vector with variable length.
* 'address' Address.
* 'key' Tunnel/Session key information.
* \te
* All attributes that set a value may also be used in the ipl2tp_api_open() call.
*
* When invoking 'ipl2tp_api_attribute_get', the replies are appended to the
* 'replies' variable. The 'replies' variable is dynamically allocated by the system,
* and need only be initialized to IP_NULL prior to the call.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_attribute_get(Ipl2tp_attrobj attrobj, Ipl2tp_attrobj *replies);
* \ce
*
* PARAMETERS
* \is
* \i 'attrobj' Global IPL2TP attributes.
*
* \i 'replies' Pointer to the attribute object that contains the replies.
* \ie
*
* ATTRIBUTES
* \is
* \i 'IPL2TP_ATTR_GET_ENABLE_OUTGOING'
*\ts
* Type: integer.
* Get the outgoing flag that selects if outgoing tunnels or sessions may be created. A non-zero value enables the outgoing functionality.
* \te
*
* \i 'IPL2TP_ATTR_GET_ESTABLISH_TIMEOUT_SEC'
* \ts
* Type: integer.
* Get the timeout for tunnel and session establishment. If a tunnel or session establishment has not been completed within this time, a teardown is performed.
* Note that a tunnel that is created in the idle state is not affected by this timeout.
* \te
*
* \i 'IPL2TP_ATTR_GET_FIRST_RETRANSMIT_SEC'
* \ts
* Type: integer.
* Get the number of seconds until the first retransmission of a control message.
* \te
*
* \i 'IPL2TP_ATTR_GET_HELLO_TICK_SEC'
* \ts
* Type: integer.
* Get the resolution of the HELLO message transmission. A small value creates more accurate HELLO message intervals, to the expense of increased overhead.
* \te
*
* \i 'IPL2TP_ATTR_GET_HOST_NAME'
* \ts
* Type: string.
* Get the IPL2TP host name reported to the peer host.
* \te
*
* \i 'IPL2TP_ATTR_GET_L2TP_WRITE_CALLBACK'
* \ts
* Type: pointer.
* Get the function pointer of the L2TP write callback routine. The callback is called whenever there is an L2TP message that should be transported to the LNS. This is typically a routine that writes to an UDP socket. The callback routine uses the Ipl2tp_write_callback() prototype.
* \te
*
* \i 'IPL2TP_ATTR_GET_OPEN_EXCLUSIVE'
* \ts
* Type: integer.
* Get the exclusive tunnel flag.
* 'IPL2TP_MIB_YES' means that it is possible to create multiple tunnels to the same LNS, and that IPL2TP tries to create new tunnels for all future sessions.
* \te
*
* \i 'IPL2TP_ATTR_GET_OPEN_SESSIONS'
* \ts
* Type: integer.
* Get the number of currently open sessions in all tunnels.
* \te
*
* \i 'IPL2TP_ATTR_GET_OPEN_TUNNELS'
* \ts
* Type: integer.
* Get the number of currently open tunnels.
* Note that this also includes tunnels in the zombie state, i.e. tunnels that have been torn down and are waiting for the reliable transport to complete their operation.
* \te
*
* \i 'IPL2TP_ATTR_GET_TUNNEL_ZOMBIE_SEC'
* \ts
* Type: integer.
* Get the number of seconds a tunnel is kept alive after a teardown. This time is to ensure that the reliable control channel is able to complete the delivery of a message before the tunnel disappears.
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpAdminState'
* \ts
* Type: integer.
* Get the global administrative state of IPL2TP.
* Valid values are:
* 'IPL2TP_MIB_ENABLED' IPL2TP enabled
* 'IPL2TP_MIB_DISABLED' IPL2TP disabled
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpDrainTunnels'
* \ts
* Type: integer.
* Get the global draining state of IPL2TP.
* Note that getting this attribute always returns 'IPL2TP_MIB_NO'. To check the current state, use the 'IPL2TP_ATTR_GET_l2tpDrainingTunnels' attribute.
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpDrainingTunnels'
* \ts
* Type: integer.
* Get the global draining state of IPL2TP.
* Valid values are:
* 'IPL2TP_MIB_YES' Draining is enabled
* 'IPL2TP_MIB_NO' Draining is disabled
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpFirmwareRev'
* \ts
* Type: integer.
* Get the IPL2TP firmware revision number. For example, version 1.0.5 is returned as the decimal number 105.
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpProtocolVersion'
* \ts
* Type: vector.
* Get the supported L2TP protocol versions. The value is returned as a vector of octet pairs, where the first octet indicates the version, and the second contains the revision.
* \te
*
* \i 'IPL2TP_ATTR_GET_l2tpVendorName'
* \ts
* Type: string.
* Get the IPL2TP vendor name.
* \te
*
* \i 'IPL2TP_ATTR_GET_ENABLE_L2TP_V2'
* \ts
* Type: integer.
* Get the L2TP enabled value for version 2.
* A value of 'IPL2TP_MIB_YES' means enabled, and a value of 'IPL2TP_MIB_NO' means disabled.
* \te
*
* \i 'IPL2TP_ATTR_GET_ENABLE_L2TP_V3'
* \ts
* Type: integer.
* Get the L2TP enabled value for version 3.
* A value of 'IPL2TP_MIB_YES' means enabled and a value of 'IPL2TP_MIB_No' means disabled.
* \te
*
* \i 'IPL2TP_ATTR_GET_CLOSE_UNUSED_TUNNELS'
* \ts
* Type: integer.
* If 'IPL2TP_MIB_YES' (default), the L2TP system closes tunnels when all sessions belonging to it are closed. If 'IPL2TP_MIB_NO', tunnels remains open.
* \te
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \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;
*
* /@ Create attribute object @/
* ipl2tp_attr_add_query(&attrobj, IPL2TP_ATTR_SET_ENABLE_OUTGOING);
* ipl2tp_api_attribute_get(attrobj, &replies);
*
* /@ Free attribute object @/
* ipl2tp_attr_delete(&attrobj);
* ipl2tp_attr_delete(&replies);
* }
* \ce
*
* SEE ALSO
*
* ipl2tp_api_attribute_set()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_attribute_get(Ipl2tp_attrobj attr,
Ipl2tp_attrobj *replies);
/*******************************************************************************
*
* ipl2tp_api_l2tp_input - Send an L2TP packet to IPL2TP for processing.
*
* The buffer pointer is a pointer to the original starting point of the buffer. Payload points to the
* beginning of the input. If the IP transport method is used, payload must point
* PAST the IP header. That is, the IP header must be EXCLUDED from the data
* sent into the function.
*
* SYNOPSIS
* \cs
* Ipl2tp_status ipl2tp_api_l2tp_input(void *buffer, void *payload, Ip_u16 length, union Ip_sockaddr_union *addr, int transport);
* \ce
*
* PARAMETERS
* \is
* \i 'buffer' Pointer to original buffer.
* \i 'payload' Pointer to the packet payload, i.e. the L2TP header.
* \i 'length' Length of payload.
* \i 'addr' IP address of sender.
* \i 'transport' The transport method is either 'IPL2TP_ATTR_TRANSPORT_UDP' or 'IPL2TP_ATTR_TRANSPORT_IP'.
* \ie
*
* RETURNS
* \is
* \i 'IPL2TP_STATUS_OK' if success.
* \i 'IPL2TP_STATUS_BADID' if the message session ID is invalid.
* \i 'IPL2TP_STATUS_NOTL2TP' if this is a non-L2TP message.
* \i 'IPL2TP_STATUS_MALFORMED' if the message is malformed.
* \i 'IPL2TP_STATUS_IGNORE' if the message is ignored.
* \i 'IPL2TP_STATUS_TEARDOWN'' if a tunnel or session teardown is required.
* \i Additional error codes may be returned by the user-specified data callback routine.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* struct Ip_sockaddr_in in4;
* Ip_u8 *buffer;
* int length;
*
* /@ Get buffer @/
* buffer = malloc(IPL2TP_MAX_MESSAGE_SIZE + EXTRA);
* in4.sin_family = IP_AF_INET;
* in4.sin_len = sizeof(in4);
*
* /@ Read from socket @/
* if ((length = read_socket(buffer + EXTRA, &in4.sin_addr)) > 0)
* {
* ipl2tp_api_l2tp_input(buffer + EXTRA, (Ip_u16)length,
* &in4, buffer, IPL2TP_ATTR_TRANSPORT_UDP);
* }
* }
* \ce
*
*
* SEE ALSO
*
* ipl2tp_ppp_input(), Ipl2tp_write_callback(), Ipl2tp_data_callback()
*
* ERRNO
* None
*/
IP_EXTERN Ipl2tp_status ipl2tp_api_l2tp_input(void *buffer,
void *payload,
Ip_u16 length,
union Ip_sockaddr_union *addr,
int transport);
/*******************************************************************************
*
* ipl2tp_api_errname - Return a textual description of an error code.
*
* Return a textual description of an error code.
*
* SYNOPSIS
* \cs
* char *ipl2tp_api_errname(Ipl2tp_status status);
* \ce
*
* PARAMETERS
* \is
* \i 'status' Status code obtained in an IPL2TP call.
* \ie
*
* RETURNS
* \is
* \i A string describing the error.
* \ie
*
* EXAMPLE
* \cs
* void example(void)
* {
* Ipl2tp_status status;
*
* if ((status = ipl2tp_api_exit()) != IPL2TP_STATUS_OK)
* {
* printf("Error %s\n", ipl2tp_api_errname(status));
* }
* }
* \ce
*
* SEE ALSO
*
* ERRNO
* None
*/
IP_EXTERN CONST char *ipl2tp_api_errname(Ipl2tp_status status);
/*
*===========================================================================
* ipl2tp_api_attribute_find
*===========================================================================
* Description: Locate an attribute in the list based on name using strtok.
* Parameters: info - The attribute list.
* name - The attribute name
* value - The pointer to where the attribute value starts.
* Returns: The attribute information structure.
*
* \NOMANUAL
*
*/
IP_EXTERN Ipl2tp_attr_info *ipl2tp_api_attribute_find(Ipl2tp_attr_info *info,
char *name,
char **value);
/*
*===========================================================================
* ipl2tp_api_attribute_parse
*===========================================================================
* Description: Parse an attribute value using strtok
* Parameters: attr - The attribute to append the value to.
* info - The attribute information object
* value - The pointer containing the value offset
* Returns:
*
* \NOMANUAL
*
*/
IP_PUBLIC Ip_bool ipl2tp_api_attribute_parse(Ipl2tp_attrobj *attr,
Ipl2tp_attr_info *info,
char **value);
/*
*===========================================================================
* ipl2tp_api_attribute_address_parse
*===========================================================================
* Description: Parse addresses. Both v4 and v6.
* Parameters: str - The address to parse.
* uaddr - Where to store the result.
* Returns: IP_TRUE if parsing was successful.
*
* \NOMANUAL
*
*/
IP_EXTERN Ip_bool ipl2tp_api_attribute_address_parse(char *str,
union Ip_sockaddr_union *uaddr);
/*
*===========================================================================
* ipl2tp_api_attribute_info
*===========================================================================
* Description: Map a tag to an info structure
* Parameters: tag - The tag.
* Returns: The attribute's information structure.
*
* \NOMANUAL
*
*/
IP_EXTERN Ipl2tp_attr_info *ipl2tp_api_attribute_info(int tag);
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
#endif