266 lines
9.8 KiB
C
266 lines
9.8 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipl2tp_state.h,v $ $Revision: 1.2 $
|
|
* $Source: /home/interpeak/CVSRoot/ipl2tp/src/ipl2tp_state.h,v $
|
|
* $Author: joel $ $Date: 2006-01-30 10:47:46 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPL2TP_STATE_H
|
|
#define IPL2TP_STATE_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tunnel_find
|
|
*===========================================================================
|
|
* Description: Get a tunnel for incoming packet
|
|
* Parameters: tunnel - Return value.
|
|
* avp - AVP descriptor.
|
|
* addr - IP address of sender.
|
|
* ident - The identifier of the tunnel.
|
|
* transport - The transport
|
|
* Returns: IPL2TP_STATUS_OK if success.
|
|
* IPL2TP_STATUS_IGNORE if the message should be ignored.
|
|
* IPL2TP_STATUS_TEARDOWN if the tunnel must be destroyed.
|
|
*/
|
|
IP_GLOBAL Ipl2tp_status ipl2tp_state_tunnel_find(Ipl2tp_tunnel **tunnel,
|
|
Ipl2tp_avp *avp,
|
|
union Ip_sockaddr_union *addr,
|
|
Ipl2tp_ident ident,
|
|
int transport);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_session_find
|
|
*===========================================================================
|
|
* Description: Get a session for incoming packet
|
|
* Parameters: session - Return value.
|
|
* avp - AVP descriptor.
|
|
* tunnel - Tunnel descriptor.
|
|
* ident - The identifier of the session.
|
|
* Returns: IPL2TP_STATUS_OK if success.
|
|
* IPL2TP_STATUS_IGNORE if the message should be ignored.
|
|
* IPL2TP_STATUS_TEARDOWN if the session must be destroyed.
|
|
*/
|
|
IP_GLOBAL Ipl2tp_status ipl2tp_state_session_find(Ipl2tp_session **session,
|
|
Ipl2tp_avp *avp,
|
|
Ipl2tp_tunnel *tunnel,
|
|
Ipl2tp_ident ident);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_session_get
|
|
*===========================================================================
|
|
* Description: Get session descriptor.
|
|
* Parameters: key - Session identifier.
|
|
* cookie - Cookie identifier.
|
|
* Returns: Session descriptor, or IP_NULL if not found.
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipl2tp_session *ipl2tp_state_session_get(Ipl2tp_key *key,
|
|
void *cookie);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tunnel_get
|
|
*===========================================================================
|
|
* Description: Get tunnel descriptor.
|
|
* Parameters: key - Tunnel identifier.
|
|
* Returns: Tunnel descriptor, or IP_NULL if not found.
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipl2tp_tunnel *ipl2tp_state_tunnel_get(Ipl2tp_key *key);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tie_break_win
|
|
*===========================================================================
|
|
* Description: Handle the case when two peers try to establish a tunnel
|
|
* at the same time.
|
|
* Parameters: tunnel - The new tunnel.
|
|
* avp - The AVP
|
|
* Returns: 0 if the new tunnel should be destroyed.
|
|
* 1 if the new tunnel should be kept.
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipl2tp_state_tie_break_win(Ipl2tp_tunnel *tunnel,
|
|
Ipl2tp_avp *avp);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_maybe_zlb
|
|
*===========================================================================
|
|
* Description: Send ZLB if required.
|
|
* Parameters: tunnel - Tunnel descriptor.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipl2tp_state_maybe_zlb(Ipl2tp_tunnel *tunnel);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_establish_tunnel_timeout_init
|
|
*===========================================================================
|
|
* Description: Setup timeout for tunnel establishment.
|
|
* Parameters: tunnel - Tunnel descriptor.
|
|
* set - Clear timeout if 0, set otherwise.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipl2tp_state_establish_tunnel_timeout_init(Ipl2tp_tunnel *tunnel,
|
|
int set);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_establish_session_timeout_init
|
|
*===========================================================================
|
|
* Description: Setup timeout for session establishment.
|
|
* Parameters: session - Session descriptor.
|
|
* set - Clear timeout if 0, set otherwise.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipl2tp_state_establish_session_timeout_init(Ipl2tp_session *session,
|
|
int set);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tunnel_teardown
|
|
*===========================================================================
|
|
* Description: Teardown all sessions in a tunnel, and eventually the tunnel itself.
|
|
* Parameters: tunnel - Tunnel descriptor.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipl2tp_state_tunnel_teardown(Ipl2tp_tunnel *tunnel);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_session_teardown
|
|
*===========================================================================
|
|
* Description: Teardown a session, and also its tunnel if this is
|
|
* the last session in the tunnel.
|
|
* Parameters: session - Session descriptor.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipl2tp_state_session_teardown(Ipl2tp_session *session);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tunnel_flush
|
|
*===========================================================================
|
|
* Description: Delete all outgoing messages.
|
|
* Parameters: tunnel - Tunnel descriptor.
|
|
* Returns:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipl2tp_state_tunnel_flush(Ipl2tp_tunnel *tunnel);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_api_tunnel_find_by_addr
|
|
*===========================================================================
|
|
* Description: Find tunnel by means of IP address.
|
|
* Parameters: addr - IP address.
|
|
* version - Version
|
|
* Returns: Pointer to tunnel descriptor, or IP_NULL if none found.
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipl2tp_tunnel *ipl2tp_state_tunnel_find_by_addr(union Ip_sockaddr_union *addr,
|
|
Ipl2tp_version version);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_tstate_name
|
|
*===========================================================================
|
|
* Description: Get name of tunnel state.
|
|
* Parameters: state - Tunnel state.
|
|
* Returns: Human readable state name.
|
|
*
|
|
*/
|
|
IP_GLOBAL CONST char *ipl2tp_state_tstate_name(Ipl2tp_tunnel_state state);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipl2tp_state_sstate_name
|
|
*===========================================================================
|
|
* Description: Get name of session state.
|
|
* Parameters: state - Session state.
|
|
* Returns: Human readable state name.
|
|
*
|
|
*/
|
|
IP_GLOBAL CONST char *ipl2tp_state_sstate_name(Ipl2tp_session_state state);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|