original files of m241
This commit is contained in:
@@ -0,0 +1,753 @@
|
||||
/* ipl2tp.h - Layer 2 Tunneling Protocol. */
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Callback routines for IPL2TP.
|
||||
*/
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp.h,v $ $Revision: 1.11 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipl2tp/include/ipl2tp.h,v $
|
||||
* $Author: tneale $ $Date: 2010-04-27 19:25:25 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPL2TP_H
|
||||
#define IPL2TP_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipcom_type.h"
|
||||
#include "ipl2tp_config.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPL2TP_MAGIC 0x5AAA555A
|
||||
|
||||
#define IPL2TP_RELEASE 60800
|
||||
|
||||
/* Select synchronization */
|
||||
#ifdef IPL2TP_USE_MUTEX
|
||||
|
||||
#define IPL2TP_OCCUPIED(action) ipcom_mutex_lock(ipl2tp.mutex)
|
||||
#define IPL2TP_AVAILABLE() ipcom_mutex_unlock(ipl2tp.mutex)
|
||||
|
||||
#else
|
||||
|
||||
#define IPL2TP_OCCUPIED(action) \
|
||||
do \
|
||||
{ \
|
||||
if (ipl2tp_occupied++ != 0) \
|
||||
{ \
|
||||
IPCOM_LOG0(EMERG, "Concurrent calls to IPL2TP"); \
|
||||
ipl2tp_occupied--; \
|
||||
action; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define IPL2TP_AVAILABLE() \
|
||||
do \
|
||||
{ \
|
||||
ipl2tp_occupied--; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#error 0
|
||||
|
||||
#endif
|
||||
|
||||
#define IPL2TP_UNUSED(x) ((void) (x))
|
||||
|
||||
/* C stuff */
|
||||
#define CONST const
|
||||
|
||||
/* Callback codes */
|
||||
#define IPL2TP_OUTGOING_AUTHENTICATION 0
|
||||
#define IPL2TP_OUTGOING_REQUEST 1
|
||||
#define IPL2TP_OUTGOING_REPLY 2
|
||||
#define IPL2TP_OUTGOING_ESTABLISHED 3
|
||||
#define IPL2TP_INCOMING_REQUEST 4
|
||||
#define IPL2TP_INCOMING_ESTABLISHED 5
|
||||
|
||||
/* MIB values */
|
||||
#define IPL2TP_MIB_FRAMING_NONE 1
|
||||
#define IPL2TP_MIB_FRAMING_SYNC 2
|
||||
#define IPL2TP_MIB_FRAMING_ASYNC 3
|
||||
#define IPL2TP_MIB_FRAMING_SYNC_ASYNC 4
|
||||
|
||||
#define IPL2TP_MIB_BEARER_NONE 1
|
||||
#define IPL2TP_MIB_BEARER_DIGITAL 2
|
||||
#define IPL2TP_MIB_BEARER_ANALOG 3
|
||||
#define IPL2TP_MIB_BEARER_DIGITAL_ANALOG 4
|
||||
|
||||
#define IPL2TP_MIB_AUTH_NONE 1
|
||||
#define IPL2TP_MIB_AUTH_SIMPLE 2
|
||||
#define IPL2TP_MIB_AUTH_CHALLENGE 3
|
||||
#define IPL2TP_MIB_AUTH_DIGEST 4
|
||||
|
||||
#define IPL2TP_MIB_ENABLED 1
|
||||
#define IPL2TP_MIB_DISABLED 2
|
||||
|
||||
#define IPL2TP_MIB_YES 1
|
||||
#define IPL2TP_MIB_NO 2
|
||||
|
||||
#define IPL2TP_MIB_L2TP 5
|
||||
|
||||
#define IPL2TP_MIB_ONDEMAND 1
|
||||
#define IPL2TP_MIB_NEVER 2
|
||||
#define IPL2TP_MIB_ALWAYS 3
|
||||
|
||||
#define IPL2TP_MIB_IDLE 1
|
||||
#define IPL2TP_MIB_CONNECTING 2
|
||||
#define IPL2TP_MIB_ESTABLISHED 3
|
||||
#define IPL2TP_MIB_DISCONNECTING 4
|
||||
|
||||
#define IPL2TP_MIB_LOCALLY 1
|
||||
#define IPL2TP_MIB_REMOTELY 2
|
||||
|
||||
#define IPL2TP_MIB_LAC_INCOMING 1
|
||||
#define IPL2TP_MIB_LNS_INCOMING 2
|
||||
#define IPL2TP_MIB_LAC_OUTGOING 3
|
||||
#define IPL2TP_MIB_LNS_OUTGOING 4
|
||||
|
||||
#define IPL2TP_MIB_NONE 1
|
||||
#define IPL2TP_MIB_REMOTE 2
|
||||
#define IPL2TP_MIB_LOCAL 3
|
||||
#define IPL2TP_MIB_BOTH 4
|
||||
|
||||
#define IPL2TP_MIB_UP 1
|
||||
#define IPL2TP_MIB_DOWN 2
|
||||
#define IPL2TP_MIB_DORMANT 5
|
||||
|
||||
/* */
|
||||
#define IPL2TP_MIB_AUTH_MD5 0
|
||||
#define IPL2TP_MIB_AUTH_SHA 1
|
||||
|
||||
#define IPL2TP_VERSION_L2F 0x01
|
||||
#define IPL2TP_VERSION_L2TPV2 0x02
|
||||
#define IPL2TP_VERSION_L2TPV3 0x03
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef Ip_u32 Ipl2tp_ident;
|
||||
typedef Ip_u32 Ipl2tp_version;
|
||||
|
||||
/* Key to identify a session based on version & ident */
|
||||
typedef struct Ipl2tp_key
|
||||
{
|
||||
Ipl2tp_version version;
|
||||
Ipl2tp_ident ident;
|
||||
}
|
||||
Ipl2tp_key;
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipl2tp_status
|
||||
*===========================================================================
|
||||
*
|
||||
*/
|
||||
/*lint -e641*/
|
||||
typedef enum
|
||||
{
|
||||
IPL2TP_STATUS_OK, /* Success */
|
||||
IPL2TP_STATUS_ERROR, /* General error */
|
||||
IPL2TP_STATUS_IGNORE, /* Message or AVP ignored */
|
||||
IPL2TP_STATUS_TEARDOWN, /* Tunnel or session teardown */
|
||||
IPL2TP_STATUS_BADAUTH, /* Authentication failure */
|
||||
IPL2TP_STATUS_BADAVP, /* Invalid attribute */
|
||||
IPL2TP_STATUS_BADBEARER, /* Bearer type not in capabilities */
|
||||
IPL2TP_STATUS_BADFRAMING, /* Framing type not in capabilities */
|
||||
IPL2TP_STATUS_BADID, /* An invalid ID was specified */
|
||||
IPL2TP_STATUS_BADMTYPE, /* Invalid message type */
|
||||
IPL2TP_STATUS_BADPARAM, /* Bad parameter */
|
||||
IPL2TP_STATUS_BADRECWIN, /* Invalid receive window size */
|
||||
IPL2TP_STATUS_BUSY, /* Tunnel or session open */
|
||||
IPL2TP_STATUS_CLOSE, /* Tunnel or session closed */
|
||||
IPL2TP_STATUS_DRAIN, /* Tunnel or session creation disbled */
|
||||
IPL2TP_STATUS_EXISTS, /* Tunnel or session exists */
|
||||
IPL2TP_STATUS_FRAMINGCAPS, /* No common framing capabilities */
|
||||
IPL2TP_STATUS_GOTCDN, /* Received CDN */
|
||||
IPL2TP_STATUS_GOTSTOPCCN, /* Received StopCCN */
|
||||
IPL2TP_STATUS_IDZERO, /* A zero ID was specified */
|
||||
IPL2TP_STATUS_MALFORMED, /* Malformed message */
|
||||
IPL2TP_STATUS_NOLNS, /* LNS operation not supported */
|
||||
IPL2TP_STATUS_NOMEM, /* Out of memory */
|
||||
IPL2TP_STATUS_NORAND, /* No random vector received */
|
||||
IPL2TP_STATUS_NOSECRET, /* No shared secret configured */
|
||||
IPL2TP_STATUS_NOTINIT, /* Item not initialized */
|
||||
IPL2TP_STATUS_NOTL2TP, /* Non-L2TP message received */
|
||||
IPL2TP_STATUS_OCCUPIED, /* API already occupied */
|
||||
IPL2TP_STATUS_PROTVERSION, /* Protocol version mismatch */
|
||||
IPL2TP_STATUS_RESERVEDNZ, /* Reserved bits non-zero */
|
||||
IPL2TP_STATUS_STATE, /* State machine error */
|
||||
IPL2TP_STATUS_TIMEOUT, /* Control channel timeout */
|
||||
IPL2TP_STATUS_VENDOR, /* Unsupported vendor-specific AVP */
|
||||
IPL2TP_STATUS_BADPW, /* Pseudowire type not in capabilities */
|
||||
IPL2TP_STATUS_BADL2, /* Unknown L2 sublayer */
|
||||
IPL2TP_STATUS_BADSEQUENCING,/* Unknown data sequencing, or no L2 */
|
||||
IPL2TP_STATUS_BADVERSION, /* Bad version */
|
||||
IPL2TP_STATUS_CIRCUIT_DOWN, /* Circuit is down */
|
||||
IPL2TP_STATUS_NEGOTIATION /* Version negotiation */
|
||||
}
|
||||
Ipl2tp_status;
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipl2tp_result
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Ipl2tp_status status; /* Status of operation */
|
||||
Ip_u16 result_code; /* Result code as in RFC2661 */
|
||||
Ip_u16 error_code; /* Error code as in RFC2661 */
|
||||
char *error_message; /* Error message as in RFC2661 */
|
||||
}
|
||||
Ipl2tp_result;
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Ipl2tp_status_callback - Callback for tunnel and session status changes.
|
||||
*
|
||||
* Callback reporting a change in tunnel or session status.
|
||||
*
|
||||
* This is the prototype for the user-defined callback routine that is called when there
|
||||
* is a change in status on one of the tunnels or sessions. The status is found in the
|
||||
* result->status variable.
|
||||
*
|
||||
* A status value of IPL2TP_STATUS_OK indicates that a tunnel or session
|
||||
* establishment is in progress. The result->result_code value gives additional
|
||||
* information about the current state of the new tunnel/session.
|
||||
*
|
||||
* Note that the status argument points to a static location which
|
||||
* is valid only in the context of the callback. An application has
|
||||
* to move the contents of *status to a local variable in order to
|
||||
* use it after the callback has returned. The same thing applies
|
||||
* to error_message.
|
||||
*
|
||||
* TUNNEL RESULT CODES
|
||||
*
|
||||
* The following result codes are valid in the tunnel status callback:
|
||||
* \is
|
||||
* \i 'IPL2TP_OUTGOING_AUTHENTICATION'
|
||||
* A tunnel establishment is initiated by an LNS, and the LAC application is
|
||||
* prompted to enter authentication attributes for the new tunnel. Only the two
|
||||
* following attributes are valid:
|
||||
* \ts
|
||||
* 'IPL2TP_TATTR_GET_l2tpTunnelStatsRemoteHostName'
|
||||
* 'IPL2TP_TATTR_GET_tunnelRemoteAddress'
|
||||
* \te
|
||||
* Note that IPL2TP exits after this callback, and the LAC application is
|
||||
* responsible for resuming tunnel establishment by calling
|
||||
* ipl2tp_authentication_established().
|
||||
*
|
||||
* \i 'IPL2TP_OUTGOING_REQUEST'
|
||||
* A new tunnel is requested by an LNS, and the LAC application is given the
|
||||
* opportunity to modify tunnel attributes before replying to the LNS.
|
||||
*
|
||||
* \i 'IPL2TP_OUTGOING_ESTABLISHED'
|
||||
* A new tunnel is established by an LNS.
|
||||
*
|
||||
* \i 'IPL2TP_INCOMING_ESTABLISHED'
|
||||
* A new tunnel is established by the LAC.
|
||||
* \ie
|
||||
*
|
||||
* SESSION RESULT CODES
|
||||
*
|
||||
* The following result codes are valid in the session status callback:
|
||||
* \is
|
||||
* \i 'IPL2TP_OUTGOING_REQUEST'
|
||||
* A session establishment is initiated by an LNS, and the LAC
|
||||
* application is given the opportunity to enter the
|
||||
* 'IPL2TP_SATTR_SET_PHYS_CHAN_ID' attribute before
|
||||
* replying to the LNS.
|
||||
*
|
||||
* \i 'IPL2TP_OUTGOING_REPLY'
|
||||
* A new session is requested by an LNS, and the LAC application is
|
||||
* prompted to place a call according to the session attributes. Note
|
||||
* that IPL2TP exits after this callback, and the LAC application
|
||||
* is responsible for resuming session establishment by calling
|
||||
* ipl2tp_outgoing_session_established().
|
||||
*
|
||||
* \i 'IPL2TP_OUTGOING_ESTABLISHED'
|
||||
* A new outgoing session is established and ready to transfer data.
|
||||
*
|
||||
* \i 'IPL2TP_INCOMING_ESTABLISHED'
|
||||
* A new incoming session is established and ready to transfer data.
|
||||
*
|
||||
* \ie
|
||||
*
|
||||
* Note that the result argument points to a location that is valid only in the context
|
||||
* of the callback routine. An application has to move the data pointed to by result to
|
||||
* a static variable in order to use it after the callback has returned.
|
||||
*
|
||||
* The return value controls if the tunnel/session is established or not. A nonzero
|
||||
* return value tears down the tunnel/session whereas a zero value
|
||||
* continues the establishment process.
|
||||
*
|
||||
* This callback is unique to each tunnel or session. The tunnel callback may be
|
||||
* registered as an attribute in any of the ipl2tp_open(), ipl2tp_tunnel_open(),
|
||||
* ipl2tp_session_open() and ipl2tp_tunnel_control() calls. The session callback may
|
||||
* be entered as an attribute in any of the ipl2tp_open(), ipl2tp_session_open() and
|
||||
* ipl2tp_session_control() calls.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* \cs
|
||||
* typedef int (*Ipl2tp_status_callback)(void *user_data, Ipl2tp_key *key, Ipl2tp_result *result);
|
||||
* \ce
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i 'user_data' User data as specified in ipl2tp_xxx_open().
|
||||
* \i 'key' Tunnel or session ID.
|
||||
* \i 'result' A pointer to the status information.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS
|
||||
* \is
|
||||
* \i '0' if the new tunnel or session should continue the establishment process.
|
||||
* \i '1' if the new tunnel or session should be closed immediately.
|
||||
* \ie
|
||||
*
|
||||
*
|
||||
* EXAMPLE
|
||||
* \cs
|
||||
* static void tunnel_cb(void *user_data, Ipl2tp_key *key, Ipl2tp_result *result)
|
||||
* {
|
||||
* switch (result->status)
|
||||
* {
|
||||
* case IPL2TP_STATUS_OK:
|
||||
* switch (result->result_code)
|
||||
* {
|
||||
* case IPL2TP_OUTGOING_AUTHENTICATION:
|
||||
* {
|
||||
* Ipl2tp_attrobj attr = IP_NULL;
|
||||
* Ipl2tp_attrobj replies = IP_NULL;
|
||||
*
|
||||
* /@ Get remote host name @/
|
||||
* ipl2tp_attr_iappend(&attr, IPL2TP_TATTR_RO_l2tpTunnelStatsRemoteHostName, 0);
|
||||
* ipl2tp_api_tunnel_attribute_get(key, attr, &replies);
|
||||
* printf("Authentication request by LNS '%s'\n",
|
||||
* ipl2tp_attr_pdata(ipl2tp_attr_first(replies)));
|
||||
*
|
||||
* /@ Set authentication @/
|
||||
* ipl2tp_attr_delete(replies);
|
||||
* ipl2tp_attr_clear(attr);
|
||||
* ipl2tp_attr_iappend(&attr, IPL2TP_TATTR_RW_l2tpTunnelConfigAuthentication,
|
||||
* IPL2TP_MIB_AUTH_CHALLENGE);
|
||||
*
|
||||
* ipl2tp_attr_vappend(&attr,
|
||||
* IPL2TP_TATTR_RW_l2tpTunnelConfigSecret,
|
||||
* "our_secret", strlen("our_secret"));
|
||||
* ipl2tp_api_tunnel_attribute_set(key, attr);
|
||||
*
|
||||
* /@ Continue tunnel establishment @/
|
||||
* ipl2tp_authentication_established(key);
|
||||
* ipl2tp_attr_delete(attr);
|
||||
* break;
|
||||
* }
|
||||
*
|
||||
* case IPL2TP_OUTGOING_REQUEST:
|
||||
* {
|
||||
* Ipl2tp_attrobj attrobj = IP_NULL;
|
||||
* Ipl2tp_attrobj replies = IP_NULL;
|
||||
*
|
||||
* /@ Get remote host name @/
|
||||
* ipl2tp_attr_iappend(&attr, IPL2TP_TATTR_RO_l2tpTunnelStatsRemoteHostName, 0);
|
||||
* ipl2tp_api_tunnel_attribute_get(id, attr, &replies);
|
||||
* printf("Tunnel request by LNS '%s'\n", ipl2tp_attr_pdata(ipl2tp_attr_first(replies)));
|
||||
* ipl2tp_attr_delete(attr);
|
||||
* ipl2tp_attr_delete(replies);
|
||||
* break;
|
||||
* }
|
||||
*
|
||||
* case IPL2TP_OUTGOING_ESTABLISHED:
|
||||
* printf("Tunnel %d opened by LNS\n", key->ident);
|
||||
* break;
|
||||
*
|
||||
* case IPL2TP_INCOMING_ESTABLISHED:
|
||||
* printf("Tunnel %d opened by LAC\n", key->ident);
|
||||
* break;
|
||||
* }
|
||||
* break;
|
||||
*
|
||||
* default:
|
||||
* printf("Tunnel %d closed with status %d, %s",
|
||||
* key->ident, (int)result->status,
|
||||
* ipl2tp_api_errname(result->status));
|
||||
*
|
||||
* break;
|
||||
* }
|
||||
* return 0;
|
||||
* }
|
||||
* \ce
|
||||
*
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
* Ipl2tp_data_callback(), Ipl2tp_sli_callback(), Ipl2tp_write_callback()
|
||||
*
|
||||
* ERRNO
|
||||
* None
|
||||
*/
|
||||
typedef int (*Ipl2tp_status_callback)
|
||||
(
|
||||
void *user_data, /* User-supplied data */
|
||||
Ipl2tp_key *key, /* Tunnel or session ID */
|
||||
Ipl2tp_result *result /* Status of operation */
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Ipl2tp_data_callback - Callback for sending to remote device.
|
||||
*
|
||||
* Called when sending PPP data to the remote device.
|
||||
*
|
||||
* This is the prototype for the user-defined callback routine that is called when
|
||||
* sending PPP data to a remote device. It typically calls a PPP interface for raw
|
||||
* output of a message.
|
||||
*
|
||||
* The opaque parameter is the same as the argument to ipl2tp_l2tp_input(), and may
|
||||
* be used to optimize performance by eliminating a memory allocation and copy
|
||||
* operation.
|
||||
*
|
||||
* This callback is unique to each session, and is registered as an attribute in any of
|
||||
* the ipl2tp_open(), ipl2tp_session_open() and ipl2tp_session_control() calls.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* \cs
|
||||
* typedef void (*Ipl2tp_data_callback)(void *user_data, Ipl2t_key *key, void *payload, Ip_u16 length, void *opaque);
|
||||
* \ce
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i 'user_data' User data from IPL2TP_SATTR_SET_USER_DATA attribute.
|
||||
* \i 'key' Session ID.
|
||||
* \i 'payload' Pointer to the PPP payload.
|
||||
* \i 'length' Length of the PPP payload.
|
||||
* \i 'opaque' Opaque user data as specified in ipl2tp_l2tp_input().
|
||||
* \ie
|
||||
*
|
||||
* RETURNS
|
||||
* \is
|
||||
* \i None
|
||||
* \ie
|
||||
*
|
||||
* EXAMPLE
|
||||
* \cs
|
||||
* static void data_cb(void *user_data, Ipl2tp_key *key, void *payload, Ip_u16 length, void *opaque)
|
||||
* {
|
||||
* /@ Do the write @/
|
||||
* ppp_write(user_data, payload, length, opaque);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* void example(void)
|
||||
* {
|
||||
* Ipl2tp_attrobj attrobj = ipl2tp_attr_new();
|
||||
* Ipl2tp_key skey;
|
||||
*
|
||||
* /@ Set data callback attribute @/
|
||||
* ipl2tp_attr_pappend(&attrobj, IPL2TP_SATTR_RW_DATA_CALLBACK, data_cb);
|
||||
*
|
||||
* /@ Open session @/
|
||||
* skey.version = IPL2TP_VERSION_L2TPV2;
|
||||
* if (ipl2tp_session_open(&skey, tkey, IP_NULL, IP_NULL, attrobj) != IPL2TP_STATUS_OK)
|
||||
* {
|
||||
* printf("Failed at session_open()\n");
|
||||
* }
|
||||
*
|
||||
* ipl2tp_attr_delete(attrobj);
|
||||
* }
|
||||
* \ce
|
||||
*
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
* ipl2tp_api_ppp_input(), ipl2tp_api_l2tp_input(), Ipl2tp_status_callback(),
|
||||
* Ipl2tp_sli_callback(), Ipl2tp_write_callback()
|
||||
*
|
||||
* ERRNO
|
||||
* None
|
||||
*/
|
||||
typedef void (*Ipl2tp_data_callback)
|
||||
(
|
||||
void *user_data, /* User-supplied data */
|
||||
Ipl2tp_key *key, /* Session ID */
|
||||
void *buffer, /* Original buffer */
|
||||
void *payload, /* Payload location in buffer */
|
||||
Ip_u16 length /* Length of payload */
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Ipl2tp_sli_callback - Callback for received data.
|
||||
*
|
||||
* Called when receiving a SLI packet from the LNS.
|
||||
*
|
||||
* This is the prototype for the user-defined callback routine that is called when a SLI
|
||||
* message is received from the peer host. The SLI message contains ACCM values
|
||||
* for both directions of PPP communication.
|
||||
*
|
||||
* The send_accm value controls data sent from IPL2TP to the remote device, and
|
||||
* the receive_accm value controls data sent from the remote device to IPL2TP.
|
||||
*
|
||||
* This callback is unique to each session, and is registered as an attribute in any of
|
||||
* the ipl2tp_api_open(), ipl2tp_api_session_open() and ipl2tp_api_session_control()
|
||||
* calls.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* \cs
|
||||
* typedef void (*Ipl2tp_sli_callback)(void *user_data, Ipl2tp_key *key, Ip_u32 send_accm, Ip_u32 receive_accm);
|
||||
* \ce
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i 'user_data' User data as specified in ipl2tp_session_open().
|
||||
* \i 'key' Session ID.
|
||||
* \i 'send_accm' ACCM for sending data.
|
||||
* \i 'receive_accm' ACCM for receiving data.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS
|
||||
* \is
|
||||
* \i None
|
||||
* \ie
|
||||
*
|
||||
* EXAMPLE
|
||||
* \cs
|
||||
* static void sli_cb(void *user_data, Ipl2tp_key *key, Ip_u32 send_accm, Ip_u32 receive_accm)
|
||||
* {
|
||||
* /@ Update PPP async module @/
|
||||
* ppp_accm(user_data, send_accm, receive_accm);
|
||||
* }
|
||||
*
|
||||
*
|
||||
* void example(void)
|
||||
* {
|
||||
* Ipl2tp_attrobj attrobj = ipl2tp_attr_new();
|
||||
* Ipl2tp_key skey;
|
||||
*
|
||||
* /@ Set SLI attribute @/
|
||||
* ipl2tp_attr_pappend(&attrobj,
|
||||
* IPL2TP_SATTR_RW_SLI_CALLBACK, sli_cb);
|
||||
*
|
||||
* /@ Open session @/
|
||||
* skey.version = IPL2TP_VERSION_L2TPV2;
|
||||
* if (ipl2tp_session_open(&skey, tkey, IP_NULL, IP_NULL, attrobj) != IPL2TP_STATUS_OK)
|
||||
* {
|
||||
* printf("Failed at session_open()\n");
|
||||
* }
|
||||
*
|
||||
* ipl2tp_attr_delete(attrobj);
|
||||
* }
|
||||
* \ce
|
||||
*
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
* ipl2tp_api_ppp_input(), ipl2tp_api_l2tp_input(), Ipl2tp_status_callback(),
|
||||
* Ipl2tp_data_callback(), Ipl2tp_write_callback()
|
||||
*
|
||||
* ERRNO
|
||||
* None
|
||||
*/
|
||||
typedef void (*Ipl2tp_sli_callback)
|
||||
(
|
||||
void *user_data, /* User-supplied data */
|
||||
Ipl2tp_key *key, /* Session ID */
|
||||
Ip_u32 send_accm, /* Send ACCM */
|
||||
Ip_u32 receive_accm /* Receive ACCM */
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Ipl2tp_write_callback - Callback for sending messages to peer L2TP device.
|
||||
*
|
||||
* Called when sending L2TP data to the remote L2TP peer device. Returns
|
||||
* the number of sent bytes.
|
||||
*
|
||||
* This is the prototype for the user-defined callback routine that is called when
|
||||
* sending L2TP messages to the peer L2TP device. It typically sends messages to an
|
||||
* UDP socket.
|
||||
*
|
||||
* This callback is common to all tunnels and sessions, and is registered with the
|
||||
* IPL2TP_ATTR_SET_L2TP_WRITE_CALLBACK attribute in the ipl2tp_open()
|
||||
* call.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* \cs
|
||||
* typedef void (*Ipl2tp_write_callback)(void *user_data, Ipl2tp_key *key, void *message, int length, union Ip_sockaddr_union *addr, void *opaque);
|
||||
* \ce
|
||||
*
|
||||
* PARAMETERS
|
||||
* \is
|
||||
* \i 'user_data' User data as specified in ipl2tp_tunnel_open().
|
||||
* \i 'key' Tunnel ID.
|
||||
* \i 'message' Message pointer.
|
||||
* \i 'length' Length of message.
|
||||
* \i 'ipaddr' IP address to send the message to.
|
||||
* \i 'opaque' Opaque user data from the ipl2tp_ppp_input() routine, or IP_NULL for control messages.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS
|
||||
* \is
|
||||
* \i None
|
||||
* \ie
|
||||
*
|
||||
* EXAMPLE
|
||||
* \cs
|
||||
* static void l2tp_write(void *user_data, Ipl2tp_key *key, void *message, int length, union Ip_sockaddr_union *addr, void *opaque)
|
||||
* {
|
||||
* /@ Transmit the UDP packet @/
|
||||
* if (sendto(socketfd, (char *)message, length, 0, (struct sockaddr *)&addr->sa, sizeof(addr->sin)) < 0)
|
||||
* {
|
||||
* printf("Error writing UDP packet\n");
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* void example(void)
|
||||
* {
|
||||
* Ipl2tp_attrobj attrobj;
|
||||
*
|
||||
* /@ Initialize @/
|
||||
* ipl2tp_api_init();
|
||||
*
|
||||
* /@ Create attribute object @/
|
||||
* attrobj = ipl2tp_attr_new();
|
||||
* ipl2tp_attr_pappend(&attrobj, IPL2TP_ATTR_RW_L2TP_WRITE_CALLBACK, l2tp_write);
|
||||
*
|
||||
* /@ Open IPL2TP @/
|
||||
* ipl2tp_api_open(attrobj, IP_NULL, IP_NULL, IP_NULL, IP_NULL);
|
||||
* ipl2tp_attr_delete(attrobj);
|
||||
* }
|
||||
* \ce
|
||||
*
|
||||
* SEE ALSO
|
||||
*
|
||||
* ipl2tp_api_ppp_input(), ipl2tp_api_l2tp_input(), Ipl2tp_status_callback(),
|
||||
* Ipl2tp_data_callback(), Ipl2tp_sli_callback()
|
||||
*
|
||||
* ERRNO
|
||||
* None
|
||||
*/
|
||||
typedef int (*Ipl2tp_write_callback)
|
||||
(
|
||||
void *user_data, /* User-supplied data */
|
||||
Ipl2tp_key *key, /* Tunnel ID */
|
||||
struct Ip_iovec *iov, /* I/O vector */
|
||||
int iov_len, /* Length of I/O vector */
|
||||
union Ip_sockaddr_union *peer, /* IP address to send to */
|
||||
Ip_u8 transport /* Transport type */
|
||||
);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipl2tp_ppp_callback
|
||||
*===========================================================================
|
||||
*
|
||||
* Called when receiving a SLI packet from LNS.
|
||||
*/
|
||||
|
||||
typedef void (*Ipl2tp_ppp_callback)
|
||||
(
|
||||
void *user_data, /* User-supplied data */
|
||||
Ipl2tp_key *key, /* Session ID */
|
||||
void *buffer, /* Callback data */
|
||||
void *payload, /* Payload pointer */
|
||||
Ip_u16 length /* Length of payload */
|
||||
);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipl2tp_eth_callback
|
||||
*===========================================================================
|
||||
*
|
||||
* Called when receiving a SLI packet from LNS.
|
||||
*/
|
||||
|
||||
typedef void (*Ipl2tp_eth_callback)
|
||||
(
|
||||
void *user_data, /* User callback data */
|
||||
Ipl2tp_key *key, /* Session ID */
|
||||
void *buffer, /* Original data buffer */
|
||||
void *payload, /* Payload pointer */
|
||||
Ip_u16 length /* Length of payload */
|
||||
);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Ipl2tp_callback
|
||||
*===========================================================================
|
||||
*
|
||||
* Union for passing function pointers
|
||||
*/
|
||||
typedef union Ipl2tp_callback
|
||||
{
|
||||
Ipl2tp_status_callback status_callback;
|
||||
Ipl2tp_data_callback data_callback;
|
||||
Ipl2tp_sli_callback sli_callback;
|
||||
Ipl2tp_write_callback write_callback;
|
||||
Ipl2tp_ppp_callback ppp_callback;
|
||||
Ipl2tp_eth_callback eth_callback;
|
||||
void *voidptr;
|
||||
|
||||
} Ipl2tp_callback;
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,892 @@
|
||||
/* 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
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,283 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp_cmd.h,v $ $Revision: 1.9 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipl2tp/include/ipl2tp_cmd.h,v $
|
||||
* $Author: tneale $ $Date: 2010-06-04 18:01:11 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPL2TP_CMD_H
|
||||
#define IPL2TP_CMD_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
extern int ipl2tp_buffer_free;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_session_key
|
||||
*===========================================================================
|
||||
* Description: Find a session key based on ifindex
|
||||
* Parameters: ifindex - The interface index.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_EXTERN Ipl2tp_key *ipl2tp_cmd_session_key(Ip_u32 ifindex);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_session_hash_add
|
||||
*===========================================================================
|
||||
* Description: Add an interface index - session ID pair to the hash table.
|
||||
* Parameters: ifindex - The interface index.
|
||||
* skey - pointer to key having session ID.
|
||||
* Returns: None.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN Ip_err ipl2tp_cmd_session_hash_add(Ip_u32 ifindex, Ipl2tp_key *skey);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_session_hash_remove
|
||||
*===========================================================================
|
||||
* Description: Remove an interface index - session ID pair from the hash table.
|
||||
* Parameters: ifindex - The interface index.
|
||||
* skey - pointer to key having session ID.
|
||||
* Returns: None.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN Ip_err ipl2tp_cmd_session_hash_remove(Ip_u32 ifindex);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_topen
|
||||
*===========================================================================
|
||||
* Description: Tunnel open command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_topen(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_tclose
|
||||
*===========================================================================
|
||||
* Description: Tunnel close command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_tclose(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_sopen
|
||||
*===========================================================================
|
||||
* Description: Session open command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_sopen(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_sclose
|
||||
*===========================================================================
|
||||
* Description: Session close command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_sclose(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_attr
|
||||
*===========================================================================
|
||||
* Description: Attribute command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_attr(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_tattr
|
||||
*===========================================================================
|
||||
* Description: Tunnel attribute command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_tattr(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_sattr
|
||||
*===========================================================================
|
||||
* Description: Session attribute command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_sattr(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_stats
|
||||
*===========================================================================
|
||||
* Description: Statistics command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_stats(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_tstats
|
||||
*===========================================================================
|
||||
* Description: Tunnel statistics command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_tstats(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_sstats
|
||||
*===========================================================================
|
||||
* Description: Session statistics command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_sstats(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_poke
|
||||
*===========================================================================
|
||||
* Description: Setup poke information for incoming messages.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_poke(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmd_main
|
||||
*===========================================================================
|
||||
* Description: Main L2TP command.
|
||||
* Parameters: argc - No of arguments.
|
||||
* argv - Argument vector.
|
||||
* Returns: 0 if success.
|
||||
*
|
||||
*/
|
||||
IP_EXTERN int ipl2tp_cmd_main(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipl2tp_cmdd
|
||||
*===========================================================================
|
||||
* Description: Init & socket daemon.
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_EXTERN void ipl2tp_cmdd(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user