1323 lines
32 KiB
C
1323 lines
32 KiB
C
/* ipmip_netlink.h - ipmip_netlink.h */
|
|
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip_netlink.h,v $ $Revision: 1.18.10.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip/include/private/ipmip_netlink.h,v $
|
|
* $Author: svc-cmnet $ $Date: 2013-03-13 07:45:30 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP_NETLINK_H
|
|
#define IPMIP_NETLINK_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
|
|
This module provides NETLINK functions and routines. It defines the NETLINK
|
|
event processing interface, which listens to and reports NETLINK route,
|
|
address and interface events. It also provides netlink message parsing/setup
|
|
routines, as well as source filters for MIP routes.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_netlink.h>
|
|
|
|
#include <private/ipmip_buffer.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
#define IPMIP_NETLINK_BUFSIZ 16384
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
struct Ipmip_context;
|
|
struct Ipmip_proc;
|
|
struct Ipmip_netlink_kern_compare;
|
|
struct Ipmip_lladdr;
|
|
|
|
typedef void (*Ipmip_netlink_callback_t) (struct Ipmip_context *ctx, struct Ipmip_proc *proc, struct Ip_nlmsghdr *nlh);
|
|
|
|
typedef struct Ipmip_netlink_handle
|
|
{
|
|
Ip_fd nlsock;
|
|
struct Ip_sockaddr_nl local;
|
|
Ip_u32 sequence;
|
|
Ipcom_mutex nllock;
|
|
char nlbuf[IPMIP_NETLINK_BUFSIZ];
|
|
} Ipmip_netlink_handle_t;
|
|
|
|
|
|
typedef struct Ipmip_netlink_context
|
|
{
|
|
Ipmip_netlink_handle_t *handle;
|
|
Ipmip_netlink_callback_t callback;
|
|
struct Ipmip_context *context;
|
|
struct Ipmip_proc *proc;
|
|
} Ipmip_netlink_context_t;
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_create - ipmip_netlink_nlmsghdr_create
|
|
*
|
|
* Create a NLMSG header
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i pid
|
|
* The subsystem
|
|
* \i seq
|
|
* The sequence number
|
|
* \i type
|
|
* Type of message
|
|
* \i flags
|
|
* Flags
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to the header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_create
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
Ip_u32 pid,
|
|
Ip_u32 seq,
|
|
int type,
|
|
Ip_u32 flags
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_request - ipmip_netlink_nlmsghdr_request
|
|
*
|
|
* Create a NLMSG header
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i pid
|
|
* The subsystem
|
|
* \i seq
|
|
* The sequence number
|
|
* \i type
|
|
* Type of message
|
|
* \i nlm_f_flags
|
|
* Extra nlm flags for the request
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to the header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_request
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
Ip_u32 pid,
|
|
Ip_u32 seq,
|
|
int type,
|
|
int nlm_f_flags
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_put - ipmip_netlink_nlmsghdr_put
|
|
*
|
|
* Add data to a NLMSG
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i data
|
|
* Data pointer [May be NULL]
|
|
* \i sz
|
|
* Size of data
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to the start of the data block.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_put
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
void *data,
|
|
Ip_size_t sz
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_done - ipmip_netlink_nlmsghdr_done
|
|
*
|
|
* Complete a NLMSG
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i hdr_off
|
|
* Offset to the NLMSG to complete
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_nlmsghdr_done
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
Ip_size_t hdr_off
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put - ipmip_netlink_nlmsghdr_rta_put
|
|
*
|
|
* Put an attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i attrlen
|
|
* Attribute length
|
|
* \i data
|
|
* Attribute data
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to the attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
int attrlen,
|
|
IP_CONST void *data
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_u8 - ipmip_netlink_nlmsghdr_rta_put_u8
|
|
*
|
|
* Put an u8 attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i attrval
|
|
* Attribute value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_u8
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
Ip_u8 attrval
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_u32 - ipmip_netlink_nlmsghdr_rta_put_u32
|
|
*
|
|
* Put an u32 attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i attrval
|
|
* Attribute value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_u32
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
Ip_u32 attrval
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_u64 - ipmip_netlink_nlmsghdr_rta_put_u64
|
|
*
|
|
* Put an u64 attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i attrval
|
|
* Attribute value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_u64
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
Ip_u64 attrval
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_str - ipmip_netlink_nlmsghdr_rta_put_str
|
|
*
|
|
* Put an str attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i str
|
|
* Attribute value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_str
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
const char *str
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_begin - ipmip_netlink_nlmsghdr_rta_begin
|
|
*
|
|
* Begin an attribute
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to the attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_begin
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_end - ipmip_netlink_nlmsghdr_rta_end
|
|
*
|
|
* End an attribute
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i rta_off
|
|
* Attribute to end
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_nlmsghdr_rta_end
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
Ip_size_t rta_off
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_parse - ipmip_netlink_nlmsghdr_rta_parse
|
|
*
|
|
* Parse an attribute block
|
|
* 0 .. maxattr
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i maxattr
|
|
* Max attribute value
|
|
* \i attr
|
|
* Attributes data block
|
|
* \i attrlen
|
|
* Length of attributes data block
|
|
* \i rta
|
|
* Attribute array.
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_nlmsghdr_rta_parse
|
|
(
|
|
int maxattr,
|
|
struct Ip_rtattr *attr,
|
|
Ip_size_t attrlen,
|
|
struct Ip_rtattr **rta
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_find - ipmip_netlink_nlmsghdr_rta_find
|
|
*
|
|
* Parse an attribute block
|
|
* 0 .. maxattr
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i attr
|
|
* Attributes data block
|
|
* \i attrlen
|
|
* Length of attributes data block
|
|
* \i rta_value
|
|
* Attribute value
|
|
* \ie
|
|
*
|
|
* RETURNS: The RTA if found
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ip_rtattr *ipmip_netlink_nlmsghdr_rta_find
|
|
(
|
|
struct Ip_rtattr *attr,
|
|
Ip_size_t attrlen,
|
|
int rta_attr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_open - ipmip_netlink_open
|
|
*
|
|
* Internally used by the IPMIP context
|
|
* Open a netlink handle
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i proto
|
|
* Netlink protocol
|
|
* \i groups
|
|
* Groups to bind to
|
|
* \ie
|
|
*
|
|
* RETURNS: A pointer to the netlink handle
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipmip_netlink_handle_t *ipmip_netlink_open
|
|
(
|
|
int proto,
|
|
int groups
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_close - ipmip_netlink_close
|
|
*
|
|
* Internally used by the IPMIP context
|
|
* Close a netlink handle
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i nlhandle
|
|
* Netlink handle
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_close
|
|
(
|
|
Ipmip_netlink_handle_t *nlhandle
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_request - ipmip_netlink_request
|
|
*
|
|
* Issue a netlink request; and wait for the response.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 request
|
|
* Buffer containing the request
|
|
* \i reply
|
|
* Buffer for the reply
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip_netlink_request
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip_netlink_handle_t *nlhandle,
|
|
Ip_pid_t dst_pid,
|
|
Ip_u32 dst_groups,
|
|
struct Ip_nlmsghdr *request,
|
|
Ipmip_buffer_t *reply
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_inX - ipmip_netlink_nlmsghdr_rta_put_inX
|
|
*
|
|
* Put an ipvX address attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i family
|
|
* Address family
|
|
* \i addr
|
|
* Address value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_inX
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
Ip_u8 family,
|
|
const void *addr
|
|
);
|
|
|
|
|
|
#ifdef IPMIP_USE_INET6
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_nlmsghdr_rta_put_in6 - ipmip_netlink_nlmsghdr_rta_put_in6
|
|
*
|
|
* Put an ipv6 address attribute in the buffer
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i buf
|
|
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
|
|
* for more information regarding dynamic buffers and their capabilities.
|
|
* \i attrtype
|
|
* Attribute type
|
|
* \i addr
|
|
* Address value
|
|
* \ie
|
|
*
|
|
* RETURNS: The offset to attribute header
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_size_t ipmip_netlink_nlmsghdr_rta_put_in6
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
int attrtype,
|
|
const struct Ip_in6_addr *addr
|
|
);
|
|
#endif
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_inX_addr - ipmip_netlink_inX_addr
|
|
*
|
|
* Add a IPv6 address to the indicated interface
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 family
|
|
* The address family
|
|
* \i cmd
|
|
* The netlink command
|
|
* \i ifindex
|
|
* The interface index
|
|
* \i addr
|
|
* Address
|
|
* \i plen
|
|
* Prefix len
|
|
* \i flags
|
|
* Extra flags
|
|
* \i xflags
|
|
* Extra wr flags
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_inX_addr
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
int cmd,
|
|
Ip_u32 ifindex,
|
|
const void *addr,
|
|
Ip_u8 plen,
|
|
Ip_u8 flags,
|
|
Ip_u32 xflags
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_inX_addr_dump - ipmip_netlink_inX_addr_dump
|
|
*
|
|
* Dump addresses belonging to a family or all family if family is unspec
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 family
|
|
* The address family
|
|
* \i answer
|
|
* Reply buffer
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_inX_addr_dump
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
Ipmip_buffer_t *answer
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_link - ipmip_netlink_link
|
|
*
|
|
* Manipulate a link
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 ifindex
|
|
* The interface index
|
|
* \i flags_set
|
|
* Netif flags to set
|
|
* \i flags_change
|
|
* Netif flags to change
|
|
* \i lla
|
|
* If set, new link layer address
|
|
* \i lla_size
|
|
* Size of link layer address
|
|
* \i mtu
|
|
* MTU, 0 if to be ignored
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_link
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int cmd,
|
|
Ip_u32 ifindex,
|
|
int flags_set,
|
|
int flags_change,
|
|
const void *lla,
|
|
Ip_size_t lla_size,
|
|
Ip_u32 mtu
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_inX_route - ipmip_netlink_inX_route
|
|
*
|
|
* Add/Remove a IPvX route to the indicated interface
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 family
|
|
* The address family
|
|
* \i cmd
|
|
* The route command
|
|
* \i table
|
|
* The route table
|
|
* \i ifindex
|
|
* The interface index
|
|
* \i prefix
|
|
* Prefix
|
|
* \i plen
|
|
* Prefix len
|
|
* \i gw
|
|
* Gateway
|
|
* \i rt_type
|
|
* Type of route
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_inX_route
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
int cmd,
|
|
Ip_u32 table,
|
|
Ip_u32 ifindex,
|
|
const void *prefix,
|
|
Ip_u8 plen,
|
|
const void *gw,
|
|
Ip_u8 rt_type
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_inX_rule - ipmip_netlink_inX_rule
|
|
*
|
|
* Add/Remove a IPvX rule
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 family
|
|
* The address family
|
|
* \i cmd
|
|
* The route command
|
|
* \i table
|
|
* The route table
|
|
* \i ifindex
|
|
* The interface index
|
|
* \i saddr
|
|
* Source address
|
|
* \i saddr_len
|
|
* Source address prefix length
|
|
* \i daddr
|
|
* Dest address
|
|
* \i daddr_len
|
|
* Dest address prefix length
|
|
* \i scope
|
|
* Scope
|
|
* \i extact
|
|
* Extra actions
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_inX_rule
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
int cmd,
|
|
Ip_u32 table,
|
|
Ip_u32 prio,
|
|
Ip_u32 ifindex,
|
|
const void *saddr,
|
|
Ip_u8 saddr_len,
|
|
const void *daddr,
|
|
Ip_u8 daddr_len,
|
|
Ip_u32 scope,
|
|
Ip_u32 extact
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_inX_neigh - ipmip_netlink_inX_neigh
|
|
*
|
|
* Add/Remove neighbor entry
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 family
|
|
* The address family
|
|
* \i cmd
|
|
* The neigh command
|
|
* \i nlm_f_flags
|
|
* The NLM flags
|
|
* \i ifindex
|
|
* The interface index
|
|
* \i flags
|
|
* Neigh flags
|
|
* \i state
|
|
* Neigh state
|
|
* \i addr
|
|
* Dest address
|
|
* \i lla
|
|
* Optional LLA
|
|
* \ie
|
|
*
|
|
* RETURNS: The return code, < 0 on error.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip_netlink_inX_neigh
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u8 family,
|
|
int cmd,
|
|
int nlm_f_flags,
|
|
Ip_u32 ifindex,
|
|
Ip_u8 flags,
|
|
Ip_u16 state,
|
|
const void *addr,
|
|
struct Ipmip_lladdr *lla
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_context_create - ipmip_netlink_context_create
|
|
*
|
|
* Allocate an NETLINK context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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 callback
|
|
* Function callback to be invoked on messages
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip_netlink_context_create
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip_netlink_callback_t callback
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_context_destroy - ipmip_netlink_context_destroy
|
|
*
|
|
* Free an NETLINK context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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().
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_context_destroy
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_context_start - ipmip_netlink_context_start
|
|
*
|
|
* Start the NETLINK context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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().
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip_netlink_context_start
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_context_stop - ipmip_netlink_context_stop
|
|
*
|
|
* Stop the NETLINK context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i ctx
|
|
* The generic mobility singleton context for IPMIP. 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 ipmip_context_create(). See ipmip_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().
|
|
* \ie
|
|
*
|
|
* RETURNS: No return value
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip_netlink_context_stop
|
|
(
|
|
struct Ipmip_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_ingress_ifindex - ipmip_netlink_route_src_ingress_ifindex
|
|
*
|
|
* Setup a source compare object based on ingress IFINDEX
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i ifindex
|
|
* Ifindex
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_ingress_ifindex
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
Ip_u32 ifindex
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_egress_ifindex - ipmip_netlink_route_src_egress_ifindex
|
|
*
|
|
* Setup a source compare object based on egress IFINDEX
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i ifindex
|
|
* Ifindex
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_egress_ifindex
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
Ip_u32 ifindex
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_protocol - ipmip_netlink_route_src_protocol
|
|
*
|
|
* Setup a source compare object based on protocol
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i proto
|
|
* Protocol
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_protocol
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
Ip_u8 proto
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_add_protocol - ipmip_netlink_route_src_add_protocol
|
|
*
|
|
* Add a source compare object based on protocol
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i proto
|
|
* Protocol
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_add_protocol
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
Ip_u8 proto
|
|
);
|
|
|
|
#ifdef IPMIP_USE_INET6
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_tunnel_in6 - ipmip_netlink_route_src_tunnel_in6
|
|
*
|
|
* Setup a source compare object based on v6 tunnel header
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i in6
|
|
* tunnel v6 SRC address
|
|
* \i gre_key
|
|
* GRE key if applicable
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_tunnel_in6
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
struct Ip_in6_addr *in6,
|
|
Ip_u32 *gre_key
|
|
);
|
|
#endif
|
|
|
|
#ifdef IPMIP_USE_INET
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_tunnel_in - ipmip_netlink_route_src_tunnel_in
|
|
*
|
|
* Setup a source compare object based on v4 tunnel header
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i inaddr
|
|
* tunnel v4 SRC address
|
|
* \i gre_key
|
|
* GRE key if applicable
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_tunnel_in
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
Ip_u32 inaddr,
|
|
Ip_u32 *gre_key
|
|
);
|
|
#endif
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip_netlink_route_src_mac - ipmip_netlink_route_src_mac
|
|
*
|
|
* Setup a source compare object based on l2 mac address
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i scmp
|
|
* Source compare object
|
|
* \i mac
|
|
* L2 MAC
|
|
* \i mac_len
|
|
* Length of mac address
|
|
* \ie
|
|
*
|
|
* RETURNS: The compare structure
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL struct Ipmip_netlink_kern_compare *ipmip_netlink_route_src_mac
|
|
(
|
|
struct Ipmip_netlink_kern_compare *scmp,
|
|
void *mac,
|
|
Ip_u32 mac_len
|
|
);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|