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

403 lines
13 KiB
C

/* ipmip6_nd_nud.h - ipmip6_nd_nud.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_nd_nud.h,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip6/include/private/ipmip6_nd_nud.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:19 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6_ND_NUD_H
#define IPMIP6_ND_NUD_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
This module defines the Neighbor Unreachability Detection feature. This is
used to verify connectivity to routers and neighbors.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6_ND_NUD_INCOMPLETE 0
#define IPMIP6_ND_NUD_PROBE 1
#define IPMIP6_ND_NUD_STALE 2
#define IPMIP6_ND_NUD_REACHABLE 3
#define IPMIP6_ND_NUD_REACHABLE_TIME (30 * 1000)
#define IPMIP6_ND_NUD_RETRANS_TIMER (1 * 1000)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ip_in6_addr;
struct Ipmip6_if;
struct Ipmip6_context;
struct Ipmip_proc;
struct Ipmip6_pktbuf;
struct Ipmip_lladdr;
typedef void (*Ipmip6_nd_nud_reachable_t) (struct Ipmip6_context *ctx, struct Ipmip_proc *proc, void *opaque, struct Ipmip_lladdr *lladdr);
typedef void (*Ipmip6_nd_nud_unreachable_t) (struct Ipmip6_context *ctx, struct Ipmip_proc *proc, void *opaque);
typedef void (*Ipmip6_nd_nud_unsolicited_t) (struct Ipmip6_context *ctx, struct Ipmip_proc *proc, void *opaque, struct Ipmip_lladdr *lladdr);
typedef Ip_u32 (*Ipmip6_nd_nud_keepalive_t) (struct Ipmip6_context *ctx, struct Ipmip_proc *proc, void *opaque);
typedef struct Ipmip6_nd_nud_cb
{
Ipmip6_nd_nud_reachable_t reachable; /* Invoked when we go reachable */
Ipmip6_nd_nud_unreachable_t unreachable; /* Invoked when we go unreachable */
Ipmip6_nd_nud_unsolicited_t unsolicited; /* Unsolicitad advertisement received */
Ipmip6_nd_nud_keepalive_t keepalive;
}
Ipmip6_nd_nud_cb_t;
/* NUD structure */
typedef struct Ipmip6_nd_nud
{
Ipcom_list next; /* NUD linkage */
struct Ip_in6_addr *addr; /* Address we're interested in */
struct Ipmip6_if *ifp; /* Interface to query on */
Ipmip_timer_t to_nud; /* Network Unreachability */
Ip_u32 retransmit; /* Retransmit */
Ip_u32 keepalive; /* Reachable */
Ip_u8 nud_count; /* Number of retransmits */
Ip_u8 nud_state; /* Current state */
Ip_bool is_router; /* Is this NUD a router? */
Ip_bool answered; /* Have we answered a query? */
/* Callbacks */
struct
{
void *opaque; /* Opaque pointer */
Ipmip6_nd_nud_cb_t *table; /* Callback table */
} cb;
}
Ipmip6_nd_nud_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip6_nd_nud_query_retransmit_iflocked - ipmip6_nd_nud_query_retransmit_iflocked
*
* Perform a NUD query with the usual 3 retransmits.
*
* THIS FUNCTION REQUIRES THAT THE INTERFACE LOCK IS HELD.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i ife
* The interface structure
* \i nud
* The NUD structure for this request.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_query_retransmit_iflocked
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_if *ife,
Ipmip6_nd_nud_t *nud
);
/*******************************************************************************
*
* ipmip6_nd_nud_query_single_iflocked - ipmip6_nd_nud_query_single_iflocked
*
* Perform a NUD query with a single retransmit.
*
* THIS FUNCTION REQUIRES THAT THE INTERFACE LOCK IS HELD.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i ife
* The interface structure
* \i nud
* The NUD structure for this request.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_query_single_iflocked
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_if *ife,
Ipmip6_nd_nud_t *nud
);
/*******************************************************************************
*
* ipmip6_nd_nud_cancel_iflocked - ipmip6_nd_nud_cancel_iflocked
*
* Cancel any outstanding NUD queries.
*
* THIS FUNCTION REQUIRES THAT THE INTERFACE LOCK IS HELD.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i nud
* The NUD structure for this request.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_cancel_iflocked
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipmip6_nd_nud_t *nud
);
/*******************************************************************************
*
* ipmip6_nd_nud_start_keepalive_iflocked - ipmip6_nd_nud_start_keepalive_iflocked
*
* Start a NUD keepalive procedure on a NEIGHBOR we need to discover fast
* if it goes away.
*
* THIS FUNCTION REQUIRES THAT THE INTERFACE LOCK IS HELD.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i ife
* The interface structure
* \i nud
* The NUD structure for this request.
* \i msec
* The keepalive time
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_start_keepalive_iflocked
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_if *ife,
Ipmip6_nd_nud_t *nud,
Ip_u32 msec
);
/*******************************************************************************
*
* ipmip6_nd_nud_stop_keepalive_iflocked - ipmip6_nd_nud_stop_keepalive_iflocked
*
* Stop a NUD keepalive procedure on a NEIGHBOR.
*
* THIS FUNCTION REQUIRES THAT THE INTERFACE LOCK IS HELD.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i nud
* The NUD structure for this request.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_stop_keepalive_iflocked
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
Ipmip6_nd_nud_t *nud
);
/*******************************************************************************
*
* ipmip6_nd_nud_init - ipmip6_nd_nud_init
*
* Initialize a NUD structure.
*
* Parameters:
* \is
* \i nud
* The NUD structure
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_init
(
Ipmip6_nd_nud_t *nud
);
/*******************************************************************************
*
* ipmip6_nd_nud_na_recv - ipmip6_nd_nud_na_recv
*
* Process a received NEIGHBOR request.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP6. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip6_context_create(). See ipmip6_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i pbuf
* The NUD request
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_nd_nud_na_recv
(
struct Ipmip6_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip6_pktbuf *pbuf
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/