685 lines
13 KiB
C
685 lines
13 KiB
C
/* ipmipmn_if.h - ipmipmn_if.h */
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_if.h,v $ $Revision: 1.12 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmipmn/src/ipmipmn_if.h,v $
|
|
* $Author: jhorteli $ $Date: 2009-04-01 18:34:39 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIPMN_IF_H
|
|
#define IPMIPMN_IF_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
/*
|
|
DESCRIPTION
|
|
|
|
No description currently provided
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <private/ipmip4_if.h>
|
|
|
|
#include <private/ipmipmn_api_coa.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
enum
|
|
{
|
|
IPMIPMN_IFF_IDENTITY_MIP,
|
|
IPMIPMN_IFF_IDENTITY_IFF
|
|
};
|
|
|
|
|
|
enum
|
|
{
|
|
IPMIPMN_IFF_COA_HA_VERIFY_NONE,
|
|
IPMIPMN_IFF_COA_HA_VERIFY_REQUEST,
|
|
IPMIPMN_IFF_COA_HA_VERIFY_PENDING
|
|
};
|
|
|
|
|
|
#define ipmipmn_if_coa_valid(x) ((x)->next.head != IP_NULL)
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
struct Ipmipmn_context;
|
|
struct Ipmipmn_pktbuf;
|
|
struct Ipmip_proc;
|
|
|
|
typedef struct Ipmipmn_iff_notify
|
|
{
|
|
Ipcom_list if_next; /* Next notifier */
|
|
|
|
/* Info */
|
|
Ipmip_timer_t timer;
|
|
Ipmip_timer_func_t func;
|
|
Ipmip_timer_lock_t *lock;
|
|
void *obj;
|
|
}
|
|
Ipmipmn_iff_notify_t;
|
|
|
|
typedef struct Ipmipmn_api_iff
|
|
{
|
|
Ipmip4_if_t iff;
|
|
|
|
/**/
|
|
Ip_bool down;
|
|
Ip_bool admin_down;
|
|
Ip_bool link_down;
|
|
|
|
/* CoA's currently available on this interface */
|
|
Ipcom_list coa;
|
|
int allocated;
|
|
|
|
/* Base for this interface */
|
|
int sync_count;
|
|
Ip_u32 references;
|
|
Ipcom_list notifiers;
|
|
|
|
Ip_u32 timestamp;
|
|
} Ipmipmn_iff_t;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_acquire - ipmipmn_if_acquire
|
|
*
|
|
* Acquire an instantiation of a interface
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Node context
|
|
* \i proc
|
|
* Current process
|
|
* \i name
|
|
* The name of the interface
|
|
* \i notifier
|
|
* Notifier callback structure.
|
|
* \ie
|
|
*
|
|
* RETURNS: The pointer to the interface structure on success.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_acquire
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
const char *name,
|
|
Ipmipmn_iff_notify_t *notifier
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_reference - ipmipmn_if_reference
|
|
*
|
|
* Reference an interface pointer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Node context
|
|
* \i proc
|
|
* Current process
|
|
* \i ifp
|
|
* The interface
|
|
* \ie
|
|
*
|
|
* RETURNS: The pointer to the interface structure on success.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_reference
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_release - ipmipmn_if_release
|
|
*
|
|
* Release a previously acquired interface reference.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* The process
|
|
* \i iff
|
|
* Interface pointer.
|
|
* \i notifier
|
|
* Notifier callback structure
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if the interface was destroyed; IP_FALSE otherwise.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmipmn_if_release
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *iff,
|
|
Ipmipmn_iff_notify_t *notifier
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_update_coa - ipmipmn_if_update_coa
|
|
*
|
|
* Retrieve a secure address
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Mobile node data
|
|
* \i proc
|
|
* Process
|
|
* \ie
|
|
*
|
|
* RETURNS: 0
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL int ipmipmn_if_update_coa
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_get - ipmipmn_if_coa_get
|
|
*
|
|
* Retrieve a CoA of a specific type.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* Interface
|
|
* \i addr
|
|
* Address (may be 0)
|
|
* \i type
|
|
* Type of CoA
|
|
* \i reason
|
|
* Why are we looking for this CoA
|
|
* \ie
|
|
*
|
|
* RETURNS: The coa, it it exists.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_get
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ip_u32 addr,
|
|
Ip_u32 type,
|
|
const char *reason
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_reference - ipmipmn_if_coa_reference
|
|
*
|
|
* Reference the CoA
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i coa
|
|
* CoA
|
|
* \i reason
|
|
* Why do we reference this CoA
|
|
* \ie
|
|
*
|
|
* RETURNS: The CoA
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_reference
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_api_coa_t *coa,
|
|
const char *reason
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_put - ipmipmn_if_coa_put
|
|
*
|
|
* Return a previously retrieved CoA
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* Interface
|
|
* \i coa
|
|
* CoA
|
|
* \i reason
|
|
* Reason
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if the CoA was deleted.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmipmn_if_coa_put
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ipmipmn_api_coa_t *coa,
|
|
const char *reason
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_findbyindex - ipmipmn_if_findbyindex
|
|
*
|
|
* Find an existing interface by locating its index.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifindex
|
|
* Interface index.
|
|
* \ie
|
|
*
|
|
* RETURNS: A referenced handle to the interface. Must be returned by
|
|
* release.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_iff_t * ipmipmn_if_findbyindex
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
int ifindex
|
|
);
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_fa_adv - ipmipmn_if_fa_adv
|
|
*
|
|
* Process a foreign agent advertisement and update any
|
|
* foreign agent values.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i pbuf
|
|
* Packet buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_if_fa_adv
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_pktbuf *pbuf
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_ha_adv_verify - ipmipmn_if_ha_adv_verify
|
|
*
|
|
* Do home agent verification; if there's been a 'silent' roam
|
|
* we need to discover it.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* The interface
|
|
* \i ha
|
|
* The home agent.
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if it should be verified
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmipmn_if_ha_adv_verify
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ipmipmn_api_coa_t *ha
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_ha_adv - ipmipmn_if_ha_adv
|
|
*
|
|
* Process a home agent advertisement and update any
|
|
* home agent values.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i pbuf
|
|
* Packet buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_if_ha_adv
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_pktbuf *pbuf
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_fa_arp - ipmipmn_if_fa_arp
|
|
*
|
|
* Process an ARP reply and update any
|
|
* foreign agent values.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i pbuf
|
|
* Packet buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_if_fa_arp
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_pktbuf *pbuf
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_fa_llh - ipmipmn_if_coa_fa_llh
|
|
*
|
|
* Turn a LLH coa into a usable directly connected one.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* The interface
|
|
* \i llh_coa
|
|
* LLH CoA
|
|
* \ie
|
|
*
|
|
* RETURNS: A new freshly allocated direct CoA
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ipmipmn_api_coa_t * ipmipmn_if_coa_fa_llh
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ipmipmn_api_coa_t *llh_coa
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_ike_reconfigure - ipmipmn_if_coa_ike_reconfigure
|
|
*
|
|
* Request a re-configuration of IKE if required.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* The context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* Interface
|
|
* \i coa
|
|
* Care of Address.
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if we've send a reconfig signal
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmipmn_if_coa_ike_reconfigure
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ipmipmn_api_coa_t *coa
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_coa_ike_mobility - ipmipmn_if_coa_ike_mobility
|
|
*
|
|
* Request an IKE mobility movement
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* The context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* Interface
|
|
* \i coa
|
|
* Care of Address.
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if we found something to move.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmipmn_if_coa_ike_mobility
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp,
|
|
Ipmipmn_api_coa_t *coa
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_admin_down - ipmipmn_if_admin_down
|
|
*
|
|
* Bring an interface administratively down.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* The interface
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_if_admin_down
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_if_admin_up - ipmipmn_if_admin_up
|
|
*
|
|
* Bring an interface administratively up
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i ifp
|
|
* The interface
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_if_admin_up
|
|
(
|
|
struct Ipmipmn_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_iff_t *ifp
|
|
);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|