Files
m241Neelima/components/ip_net2-6.9/ipmip4/include/private/ipmip4_if.h
T
2026-07-30 11:19:44 +05:30

350 lines
9.7 KiB
C

/* ipmip4_if.h - ipmip4_if.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_if.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_if.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_IF_H
#define IPMIP4_IF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Basic interface management required for MIP4. Provides functions to
* instantiate interfaces information containers, resolve LLA identifiers
* and create and destroy tunnel interfaces
*/
/*
DESCRIPTION
Basic interface management required for MIP4. Provides functions to
instantiate interfaces information containers, resolve LLA identifiers
and create and destroy tunnel interfaces
EXAMPLE
Examples how to create MIP4 enabled interfaces.
.CS
typedef struct Ipmip4_if_mine
{
Ipmip4_if_t iff;
/@ Any data I need to store in this interface structure @/
ine my_private_data;
} Ipmip4_if_mine_t;
IP_STATIC void
ipmip4_my_if_delete(struct Ipmip4_my_context *ctx,
Ipmip_proc_t *proc,
Ipmip4_if_mine_t *myif)
{
/@ Free any data that I have allocated @/
}
Ipmip4_if_mine_t *my_if_alloc4(struct Ipmip4_my_context *ctx, Ipmip_proc_t *proc, const char *ifname)
{
Ipmip4_if_mine_t *myif;
Ip_u32 ifindex;
ifindex = ipcom_if_nametoindex(ifname);
/@ Does it exist? @/
if (ifindex == 0)
return IP_NULL;
myif = (Ipmip4_if_mine_t *)ipmip4_if_alloc(&ctx->ipmip4,
proc,
sizeof(*myif),
ifname,
ifindex,
IPMIP_IF_TYPE_GENERIC,
0,
(Ipmip_if_cleanup_t )ipmip4_my_if_delete);
return myif;
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_pktbuf.h>
#include <private/ipmip_if.h>
#include <private/ipmip4_lla.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip4_if;
typedef struct Ipmip4_if
{
Ipmip_if_t ipmip;
Ipcom_list pktbufs;
Ip_u32 ifaddr;
/* Cleanup function */
Ipmip_if_cleanup_t cleanup;
} Ipmip4_if_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_if_alloc - ipmip4_if_alloc
*
* Allocate and initialize the interface structure
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. 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 ipmip4_context_create(). See ipmip4_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 ifsize
* the size of the interface structure
* \i ifname
* The interface name
* \i ifindex
* The interface index.
* \i type
* Type of interface
* \i identity
* The interface identity.
* \i cleanup
* Function to be invoked prior to free.
* \ie
*
* RETURNS: The interface structure on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_alloc
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t ifsize,
const char *ifname,
Ip_u32 ifindex,
Ip_u8 type,
Ip_u8 identity,
Ipmip_if_cleanup_t cleanup
);
/*******************************************************************************
*
* ipmip4_if_alloc_tunnel - ipmip4_if_alloc_tunnel
*
* Create a specific tunnel for the provided interface
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. 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 ipmip4_context_create(). See ipmip4_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 ifsize
* Total size of the interface structure
* \i ifname
* Wanted ifname
* \i local
* The local endpoint
* \i local_port
* Base port for NAT_T setup
* \i remote
* Remote endpoint
* \i identity
* The identity of the tunnel
* \i tunnel_type
* Tunnel type
* \i reorder
* Enable reordering if supported by interface
* \i cleanup
* Function to be invoked prior to free.
* \ie
*
* RETURNS: The interface structure on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_alloc_tunnel
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t ifsize,
char *ifname,
Ip_u32 local,
Ip_u16 local_port,
Ip_u32 remote,
Ip_u8 identity,
Ip_u8 tunnel_type,
Ip_bool reorder,
Ipmip_if_cleanup_t cleanup
);
/*******************************************************************************
*
* ipmip4_if_get_primary_address - ipmip4_if_get_primary_address
*
* Get the current primary address of the interface.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. 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 ipmip4_context_create(). See ipmip4_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 iff
* The interface
* \ie
*
* RETURNS: address on success; IP_INADDR_NONE on failure.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u32 ipmip4_if_get_primary_address
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_if_t *iff
);
/*******************************************************************************
*
* ipmip4_if_findbyaddr - ipmip4_if_findbyaddr
*
* Locate an interface in our configuration based on address.
*
* Parameters:
* \is
* \i iflist
* The list of interfaces.
* \i addr
* The interface address
* \ie
*
* RETURNS: The interface pointer if it exists, IP_NULL otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_findbyaddr
(
Ipcom_list *iflist,
Ip_u32 addr
);
/*******************************************************************************
*
* ipmip4_if_findbypktinfo - ipmip4_if_findbypktinfo
*
* Locate an interface in our configuration based on address.
*
* Parameters:
* \is
* \i iflist
* The list of interfaces
* \i pktinfo
* The interface info
* \ie
*
* RETURNS: The interface pointer if it exists, IP_NULL otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_findbypktinfo
(
Ipcom_list *iflist,
Ipmip_pktbuf_pktinfo_t *pktinfo
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/