351 lines
11 KiB
C
351 lines
11 KiB
C
/* ipmip4_netlink.h - ipmip4_netlink.h */
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_netlink.h,v $ $Revision: 1.5 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_netlink.h,v $
|
|
* $Author: jhorteli $ $Date: 2010-12-16 12:19:21 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP4_NETLINK_H
|
|
#define IPMIP4_NETLINK_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
|
|
MIP4 NETLINK functions for mobile IPv4. Deals with MIP4 netlink specific
|
|
commands and routes. The MIP4 methods mostly deals with registering
|
|
entities in the kernel for more advanced GRE and statistics management
|
|
than is usually provided by the base IPNET functionality.
|
|
|
|
EXAMPLE
|
|
|
|
This example illustrates how one can register a MIP handle in the kernel,
|
|
and retrieve statistics.
|
|
|
|
.CS
|
|
|
|
IP_GLOBAL void
|
|
my_handle_function(struct Ipmip4my_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip_my_entities *node)
|
|
{
|
|
Ipmip4_netlink_kern_statistics_t link_recv, link_send;
|
|
Ipmip_netlink_kern_handle_t handle;
|
|
|
|
/@ Register this nodes handle in the kernel @/
|
|
ipmip4_netlink_new_handle(&ctx->ipmip4, proc, IPCOM_IPD_ID_IPMYMIP, node->identity);
|
|
|
|
/@ Setup a userspace integrated handle @/
|
|
handle.mip_facility = IPCOM_IPD_ID_IPMIPMYMIP;
|
|
handle.mip_ident = node->identity;
|
|
|
|
/@ Retrieve current non-polled statistics from the kernel @/
|
|
if (ipmip4_netlink_get_handle_stat(&ctx->ipmip4, proc, &handle, &link_recv, &link_send))
|
|
{
|
|
/@ Store the retrieved statistics @/
|
|
}
|
|
|
|
/@ Register this nodes handle in the kernel @/
|
|
ipmip4_netlink_del_handle(&ctx->ipmip4, proc, IPCOM_IPD_ID_IPMYMIP, node->identity);
|
|
}
|
|
|
|
.CE
|
|
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_netlink.h>
|
|
|
|
#include <private/ipmip_netlink.h>
|
|
#include <private/ipmip4_netlink_kern.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
union Ipmip4_msgext_uhdr;
|
|
|
|
struct Ipmip4_context;
|
|
struct Ipmip_proc;
|
|
struct Ipmip_netlink_kern_handle;
|
|
struct Ipmip4_netlink_kern_statistics;
|
|
struct Ipmip_netlink_kern_compare;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_netlink_get_handle_stat - ipmip4_netlink_get_handle_stat
|
|
*
|
|
* Retrieve the statistics associated with a handle. The statistics retrieved
|
|
* is the currently non-polled statistics present in the kernel. This function
|
|
* will reset the kernel structures. That is, for each invocation of this
|
|
* method you will retrieve the statistics collected with start from the
|
|
* previous invocation.
|
|
*
|
|
* 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 handle
|
|
* The MIP handle
|
|
* \i link_recv
|
|
* Container to populate with RECEIVE statistics
|
|
* \i link_send
|
|
* Container to populate with SEND statistics
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip4_netlink_get_handle_stat
|
|
(
|
|
struct Ipmip4_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip_netlink_kern_handle *handle,
|
|
struct Ipmip4_netlink_kern_statistics *link_recv,
|
|
struct Ipmip4_netlink_kern_statistics *link_send
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_netlink_del_handle - ipmip4_netlink_del_handle
|
|
*
|
|
* Delete a MIP handle previously registered using ipmip4_netlink_new_handle.
|
|
*
|
|
* 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 facility
|
|
* The MIP facility. One of the IPCOM_IPD_ID_IPMIPXX product definitions.
|
|
* \i identity
|
|
* The unique identity parameter.
|
|
* \ie
|
|
*
|
|
* RETURNS: 0 on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip4_netlink_del_handle
|
|
(
|
|
struct Ipmip4_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u32 facility,
|
|
Ip_u32 identity
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_netlink_new_handle - ipmip4_netlink_new_handle
|
|
*
|
|
* Create a MIP handle.The facility/identity combination must be unique,
|
|
* or this method will fail with an EEXIST errno.
|
|
*
|
|
* 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 facility
|
|
* The MIP facility. One of the IPCOM_IPD_ID_IPMIPXX product definitions.
|
|
* \i identity
|
|
* The unique identity parameter.
|
|
* \ie
|
|
*
|
|
* RETURNS: 0 on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip4_netlink_new_handle
|
|
(
|
|
struct Ipmip4_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u32 facility,
|
|
Ip_u32 identity
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_netlink_address_do - ipmip4_netlink_address_do
|
|
*
|
|
* Perform MIP4 specific address management. For example MIP exclusions,
|
|
* home address activation/deactivation etc.
|
|
*
|
|
* 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 cmd
|
|
* The NETLINK command
|
|
* \i type
|
|
* The MIP sub command
|
|
* \i flags
|
|
* Command flags
|
|
* \i ifindex
|
|
* Interface index specifying the interface.
|
|
* \i family
|
|
* AF_INET or AF_INET6
|
|
* \i addr
|
|
* Address buffer
|
|
* \i reply
|
|
* Optional reply buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 0 on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip4_netlink_address_do
|
|
(
|
|
struct Ipmip4_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int cmd,
|
|
Ip_u16 type,
|
|
Ip_u8 flags,
|
|
Ip_u32 ifindex,
|
|
Ip_u8 family,
|
|
const void *addr,
|
|
Ipmip_buffer_t *reply
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip4_netlink_route_validate - ipmip4_netlink_route_validate
|
|
*
|
|
* Validate a particular route.
|
|
*
|
|
* 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 cmd
|
|
* \i ifindex
|
|
* Interface index specifying the interface.
|
|
* \i addr
|
|
* The address to verify routing for.
|
|
* \i reply
|
|
* Optional reply buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 0 on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip4_netlink_route_validate
|
|
(
|
|
struct Ipmip4_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u32 ifindex,
|
|
Ip_u32 addr,
|
|
Ipmip_buffer_t *reply
|
|
);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|