994 lines
26 KiB
C
994 lines
26 KiB
C
/* ipmip6_pkt.h - ipmip6_pkt.h */
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_pkt.h,v $ $Revision: 1.14.10.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip6/include/private/ipmip6_pkt.h,v $
|
|
* $Author: jhorteli $ $Date: 2012-02-08 16:09:27 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP6_PKT_H
|
|
#define IPMIP6_PKT_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
/*
|
|
DESCRIPTION
|
|
|
|
Basic IPMIP6 packet handling. Allows for assigning interfaces, addresses,
|
|
ancillary packet options. It also defines the basic IPMIP6 packet loop.
|
|
|
|
EXAMPLE
|
|
|
|
These examples extends the example functions originally defined
|
|
ipmip6_context.h, and shows how should create and manage the packet
|
|
context.
|
|
|
|
.CS
|
|
|
|
IP_GLOBAL void
|
|
ipmip6_reg_recv(struct Ipmip6_my_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6_pktbuf_t *pbuf,
|
|
void *arg)
|
|
{
|
|
/@ Process the registration request @/
|
|
|
|
|
|
|
|
/@ Release the packet buffer @/
|
|
ipmip_pktbuf_release(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip);
|
|
}
|
|
|
|
IP_GLOBAL void
|
|
ipmip6_adv_recv(struct Ipmip6_my_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6_pktbuf_t *pbuf)
|
|
{
|
|
Ipcom_icmp_header *icmph = IPMIP_BUFFER_PTR(&pbuf->ipmip.packet);
|
|
|
|
/@ Process the ICMP packet @/
|
|
|
|
/@ Release the packet buffer @/
|
|
ipmip_pktbuf_release(&data->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
|
}
|
|
|
|
|
|
IP_GLOBAL Ip_bool
|
|
ipmip6_mh_dispatch(struct Ipmip6_my_context *ctx,
|
|
Ipmip_proc_t *proc,
|
|
Ipmip6_pktbuf_t *pbuf)
|
|
{
|
|
Ipmip6_mobility_header_t *hdr = IPMIP_BUFFER_PTR(&pbuf->ipmip.packet);
|
|
unsigned mlen = (unsigned) ((hdr->mh_len << 3) + 8);
|
|
|
|
/@ Process the MH message @/
|
|
|
|
ipmip_pktbuf_free(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
|
return IP_TRUE;
|
|
}
|
|
|
|
|
|
IP_GLOBAL Ip_bool
|
|
ipmip6_icmp_dispatch(struct Ipmip6_my_context *ctx,
|
|
Ipmip_proc_t *proc,
|
|
Ipmip6_pktbuf_t *pbuf)
|
|
{
|
|
Ipmip6_pkt_icmp6_t *icmp = IPMIP_BUFFER_PTR(&pbuf->ipmip6.ipmip.packet);
|
|
|
|
/@ Process the ICMP message @/
|
|
|
|
ipmip_pktbuf_free(&ctx->ipmip6.ipmip, proc, &pbuf->ipmip6.ipmip);
|
|
return IP_TRUE;
|
|
}
|
|
|
|
|
|
static Ipmip6_pkt_context_dispatch_t ipmip6_dispatch_table =
|
|
{
|
|
(Ipmip6_pkt_dispatch_t)ipmip6_mh_dispatch,
|
|
(Ipmip6_pkt_dispatch_t)ipmip6_icmp_dispatch
|
|
};
|
|
|
|
Ipmip6_if_event_table_t ipmip6_ifevent_table =
|
|
{
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL,
|
|
(Ipmip6_if_event_t)IP_NULL
|
|
};
|
|
|
|
IP_GLOBAL Ipmip_pktbuf_t *
|
|
ipmip6_my_pktbuf_alloc(struct Ipmip6_my_context *ctx,
|
|
Ipmip_proc_t *proc,
|
|
Ip_size_t extra)
|
|
{
|
|
Ipmip6_pktbuf_t *pbuf;
|
|
|
|
IPMIP_UNUSED_PARAMETER(ctx);
|
|
IPMIP_UNUSED_PARAMETER(proc);
|
|
|
|
pbuf = ipcom_calloc(1, sizeof(Ipmip6_pktbuf_t) + extra);
|
|
if (pbuf)
|
|
{
|
|
ipmip_buffer_init(&pbuf->mo_reply);
|
|
pbuf->ipmip.pktend = (void *) (pbuf + 1);
|
|
return &pbuf->ipmip;
|
|
}
|
|
|
|
return IP_NULL;
|
|
}
|
|
|
|
IP_GLOBAL void
|
|
ipmip6_my_pktbuf_free(struct Ipmip6_my_context *ctx,
|
|
Ipmip_proc_t *proc,
|
|
Ipmip6_pktbuf_t *pbuf)
|
|
{
|
|
ipcom_free(pbuf);
|
|
}
|
|
|
|
struct Ipmip6_my_context *my_init_func6(Ipmip_proc_t *proc)
|
|
{
|
|
/@ Allocate my context; indicate the size of my overloaded structure @/
|
|
struct Ipmip6_my_context *ctx = (struct Ipmip_my_context *)ipmip_context_alloc(proc, sizeof(*ctx), "mymip6", IPCOM_LOG_DEBUG2, 10);
|
|
|
|
/@ Initialize the MIP6 portion of the context @/
|
|
ipmip6_context_initialize(&ctx->ipmip6, proc, &ipmip6_ifevent_table);
|
|
|
|
/@ Create a packet context @/
|
|
ipmip6_pkt_context_create(&ctx->ipmip6,
|
|
proc,
|
|
&ipmip6_dispatch_table,
|
|
IPMIP6_DSMIP_UDP_PORT,
|
|
(Ipmip_pkt_buf_alloc_t)ipmip6_my_pktbuf_alloc,
|
|
(Ipmip_pkt_buf_free_t)ipmip6_my_pktbuf_free);
|
|
|
|
|
|
|
|
/@ Start the context @/
|
|
ipmip6_context_start(&ctx->ipmip6, proc);
|
|
}
|
|
|
|
.CE
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <private/ipmip_pktbuf.h>
|
|
|
|
#include <private/ipmip6_address.h>
|
|
#include <private/ipmip6_mh_pkt.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
#define IPMIP6_PKT_CLEN 128
|
|
#define IPMIP6_PKT_VLEN 512
|
|
|
|
#define IPMIP6_IPPROTO_MOBILE_HEADER 135
|
|
#define IPMIP6_IPPROTO_RTHEADER 43
|
|
#define IPMIP6_DSTOPT_HOME_ADDRESS 0xc9
|
|
|
|
|
|
/* Set address where the source and/or the destination might be on
|
|
a word boundary */
|
|
#define IPMIP6_IP6_SET_ADDR(dst, src) ipcom_memcpy(dst, src, sizeof(struct Ip_in6_addr))
|
|
|
|
#define IPMIP6_IP6_SCOPE_NODE_LOCAL 0x1 /* Node local scope */
|
|
#define IPMIP6_IP6_SCOPE_LINK_LOCAL 0x2 /* Link local scope */
|
|
#define IPMIP6_IP6_SCOPE_SITE_LOCAL 0x5 /* Site local scope */
|
|
#define IPMIP6_IP6_SCOPE_ORG_LOCAL 0x8 /* Orginazation local scope */
|
|
#define IPMIP6_IP6_SCOPE_GLOBAL 0xe /* Global scope */
|
|
|
|
#define IPMIP6_IP6_MC_SCOPE(mc_addr) (ip_ntohs((mc_addr)->in6.addr16[0]) & 0x000f)
|
|
|
|
/* Reserved address types */
|
|
#define IPMIP6_IP6_SET_SOLICITED_ADDR(dst, src) do { \
|
|
IP_SET_HTONL(&(dst)->in6.addr32[0], 0xff020000); \
|
|
IP_SET_HTONL(&(dst)->in6.addr32[1], 0x00000000); \
|
|
IP_SET_HTONL(&(dst)->in6.addr32[2], 0x00000001); \
|
|
(dst)->in6.addr8[12] = 0xff; \
|
|
(dst)->in6.addr8[13] = (src)->in6.addr8[13]; \
|
|
(dst)->in6.addr16[7] = (src)->in6.addr16[7]; \
|
|
} while(0)
|
|
|
|
#define IPMIP6_IP6_SET_ALL_NODES_ADDR(addr) do { \
|
|
IP_SET_HTONL(&(addr)->in6.addr32[0], 0xff020000); \
|
|
IP_SET_32ON16(&(addr)->in6.addr32[1], 0); \
|
|
IP_SET_32ON16(&(addr)->in6.addr32[2], 0); \
|
|
IP_SET_HTONL(&(addr)->in6.addr32[3], 0x00000001); \
|
|
} while(0)
|
|
|
|
#define IPMIP6_IP6_SET_ALL_ROUTERS_ADDR(addr) do { \
|
|
IP_SET_HTONL(&(addr)->in6.addr32[0], 0xff020000); \
|
|
IP_SET_32ON16(&(addr)->in6.addr32[1], 0); \
|
|
IP_SET_32ON16(&(addr)->in6.addr32[2], 0); \
|
|
IP_SET_HTONL(&(addr)->in6.addr32[3], 0x00000002); \
|
|
} while(0)
|
|
|
|
#define IPMIP6_IP6_IS_SCOPE_LINK_LOCAL(addr) \
|
|
(IP_IN6_IS_ADDR_LINK_LOCAL(addr) || \
|
|
(IP_IN6_IS_ADDR_MULTICAST(addr) && IPMIP6_IP6_MC_SCOPE(addr) == IPNET_IP6_SCOPE_LINK_LOCAL))
|
|
|
|
/* Unspecified address */
|
|
#define IPMIP6_IP6_IS_ADDR_UNSPECIFIED(addr) \
|
|
(IP_GET_32ON16(&(addr)->in6.addr32[3]) ==0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[2]) == 0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[1]) == 0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[0]) == 0x00000000)
|
|
|
|
|
|
/* Multicast address types */
|
|
#define IPMIP6_IP6_IS_ADDR_SOLICITED(addr) \
|
|
(IP_GET_32ON16(&(addr)->in6.addr32[0]) == ip_htonl(0xff020000) && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[1]) == 0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[2]) == ip_htonl(0x00000001) && \
|
|
(addr)->in6.addr8[12] == 0xff)
|
|
|
|
#define IPMIP6_IP6_IS_ADDR_ALL_NODES(addr) \
|
|
(IP_GET_32ON16(&(addr)->in6.addr32[3]) == ip_htonl(0x00000001) && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[2]) == 0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[1]) == 0x00000000 && \
|
|
IP_GET_32ON16(&(addr)->in6.addr32[0]) == ip_htonl(0xff020000))
|
|
|
|
|
|
/* Macro initializers for standard addresses */
|
|
#define IPMIP6_IN6ADDR_LINKLOCAL \
|
|
{{{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
|
#define IPMIP6_IN6ADDR_SITELOCAL \
|
|
{{{ 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
|
#define IPMIP6_IN6ADDR_ALLSET \
|
|
{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
|
|
|
|
|
|
|
|
#define IPMIP6_PKT_IN (1 << 0)
|
|
#define IPMIP6_PKT_OUT (1 << 0)
|
|
#define IPMIP6_PKT_ALL (IPMIP6_PKT_IN|IPMIP6_PKT_OUT)
|
|
|
|
/* Linklocal and sitelocal prefixes */
|
|
IP_EXTERN IP_CONST Ipmip6_address_t ipmip6_in6addr_linklocal;
|
|
IP_EXTERN IP_CONST Ipmip6_address_t ipmip6_in6addr_sitelocal;
|
|
IP_EXTERN IP_CONST Ipmip6_address_t ipmip6_in6addr_unspecified;
|
|
IP_EXTERN IP_CONST struct Ip_in6_addr ipmip6_in6addr_allmask;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* Forward declaration */
|
|
struct Ipmip6_pkt;
|
|
struct Ipmip6_if;
|
|
struct Ipmip6_if_router;
|
|
struct Ipmip6_context;
|
|
struct Ipmip_proc;
|
|
struct Ipmip6_pktbuf;
|
|
|
|
typedef Ip_bool (*Ipmip6_pkt_dispatch_t) (struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6_pktbuf *pbuf);
|
|
|
|
|
|
typedef struct Ipmip6_pkt_context_dispatch
|
|
{
|
|
Ipmip6_pkt_dispatch_t mh;
|
|
Ipmip6_pkt_dispatch_t icmp;
|
|
}
|
|
Ipmip6_pkt_context_dispatch_t;
|
|
|
|
typedef struct Ipmip6_pkt_context
|
|
{
|
|
/**/
|
|
Ip_fd fd_mh;
|
|
Ip_fd fd_icmp_in;
|
|
Ip_fd fd_icmp_out;
|
|
Ip_fd fd_udp_nat;
|
|
struct Ip_sockaddr_in6 s_udp_nat;
|
|
|
|
/* Wrappers for pktbuf */
|
|
Ipmip_pkt_buf_alloc_t bufalloc;
|
|
Ipmip_pkt_buf_free_t buffree;
|
|
|
|
Ipmip6_pkt_context_dispatch_t *dispatch;
|
|
|
|
struct Ipmip_proc *proc;
|
|
}
|
|
Ipmip6_pkt_context_t;
|
|
|
|
|
|
typedef struct Ipmip6_pktbuf_recvinfo
|
|
{
|
|
Ip_bool rthdr2;
|
|
Ip_u32 hoplimit;
|
|
struct Ip_in6_addr *home;
|
|
union Ip_sockaddr_union *encapsulation;
|
|
} Ipmip6_pktbuf_recvinfo_t;
|
|
|
|
typedef struct Ipmip6_pktbuf_sendinfo
|
|
{
|
|
struct Ip_in6_addr *rthdr2; /* Routing header type2 */
|
|
struct Ip_in6_addr *rthdr0; /* Routing header type0 */
|
|
Ip_u32 hoplimit; /* Hop limit */
|
|
Ip_u32 flags; /* Send flags */
|
|
struct Ip_in6_addr *nexthop; /* Nexthop */
|
|
struct Ip_in6_pktinfo *pktinfo; /* Addr or Index to be used */
|
|
} Ipmip6_pktbuf_sendinfo_t;
|
|
|
|
|
|
typedef void (*Ipmip6_pktbuf_finalize_t) (struct Ipmip6_context *ctx, struct Ipmip_proc *proc, struct Ipmip6_pktbuf *pbuf);
|
|
typedef struct Ipmip6_pktbuf
|
|
{
|
|
Ipmip_pktbuf_t ipmip;
|
|
Ipmip6_pktbuf_recvinfo_t recvinfo;
|
|
Ipmip6_pktbuf_sendinfo_t sendinfo;
|
|
|
|
Ipmip_buffer_t ancillary;
|
|
Ipmip_buffer_t dstopts;
|
|
Ipmip6_pktbuf_finalize_t finalize;
|
|
|
|
Ipmip6_mh_options_t mo;
|
|
}
|
|
Ipmip6_pktbuf_t;
|
|
|
|
/* Type/Length/Value configuration */
|
|
typedef struct Ipmip6_pkt_tlv_option
|
|
{
|
|
Ip_u8 type;
|
|
Ip_u8 alignment;
|
|
Ip_u8 constant;
|
|
}
|
|
Ipmip6_pkt_tlv_option_t;
|
|
|
|
|
|
#include <ipcom_align16.h>
|
|
|
|
typedef struct IP_PACKED1 Ipmip6_pkt_ext_hdr
|
|
{
|
|
/* Basic header option flags. */
|
|
Ip_u8 next_header;
|
|
Ip_u8 len;
|
|
} IP_PACKED2
|
|
Ipmip6_pkt_ext_hdr_t;
|
|
|
|
typedef struct IP_PACKED1 Ipmip6_pkt_dstopt_hdr
|
|
{
|
|
/* Basic Mobility option fields */
|
|
Ip_u8 option_type;
|
|
Ip_u8 option_length;
|
|
} IP_PACKED2
|
|
Ipmip6_pkt_dstopt_hdr_t;
|
|
|
|
typedef struct IP_PACKED1 Ipmip6_pkt_rthdr2_hdr
|
|
{
|
|
Ip_u8 rtype; /* Routing Type */
|
|
Ip_u8 segments; /* Segments left */
|
|
Ip_u32 reserved; /* Reserved */
|
|
} IP_PACKED2
|
|
Ipmip6_pkt_rthdr2_hdr_t;
|
|
|
|
typedef struct IP_PACKED1 Ipmip6_pkt_rthdr0_hdr
|
|
{
|
|
Ip_u8 rtype; /* Routing Type */
|
|
Ip_u8 segments; /* Segments left */
|
|
Ip_u32 reserved; /* Reserved */
|
|
} IP_PACKED2
|
|
Ipmip6_pkt_rthdr0_hdr_t;
|
|
|
|
typedef IP_PACKED1 struct Ipmip6_pkt_ip6_struct
|
|
{
|
|
Ip_u32 ver_class_flow; /* 4 bit version, 8 bit class, 20 bit flow. */
|
|
Ip_u16 plen; /* Payload length. */
|
|
Ip_u8 nxt; /* Next Header. */
|
|
Ip_u8 hlim; /* Hop limit. */
|
|
|
|
struct Ip_in6_addr src; /* IPv6 source address. */
|
|
struct Ip_in6_addr dst; /* IPv6 destination address. */
|
|
} IP_PACKED2
|
|
Imip6_pkt_ip6;
|
|
|
|
#include <ipcom_align16.h>
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_tlv_requirement - ipmip6_pkt_tlv_requirement
|
|
*
|
|
* Locate the correct TLV option requirement in the provided option list.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i options
|
|
* Option list
|
|
* \i type
|
|
* The type we are looking for
|
|
* \ie
|
|
*
|
|
* RETURNS: The TLV requirements if found.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ipmip6_pkt_tlv_option_t *ipmip6_pkt_tlv_requirement
|
|
(
|
|
Ipmip6_pkt_tlv_option_t *options,
|
|
Ip_u8 type
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_tlv_alignment - ipmip6_pkt_tlv_alignment
|
|
*
|
|
* Calculate alignment for a given option.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i size
|
|
* The size
|
|
* \i req
|
|
* The TLV requirements
|
|
* \ie
|
|
*
|
|
* RETURNS: The alignment.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_u8 ipmip6_pkt_tlv_alignment
|
|
(
|
|
Ip_u32 size,
|
|
Ipmip6_pkt_tlv_option_t *req
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_dstopt_opt_add - ipmip6_pkt_dstopt_opt_add
|
|
*
|
|
* Add a destination option to the dstopt ancillary option list.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i type
|
|
* The option type value
|
|
* \i len
|
|
* The option length
|
|
* \i data
|
|
* The option data
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip6_pkt_dstopt_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
Ip_u8 type,
|
|
Ip_u8 len,
|
|
void* data
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_nexthop_opt_add - ipmip6_pkt_nexthop_opt_add
|
|
*
|
|
* Add a nexthop ancillary data option
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i addr
|
|
* The nexthop
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_nexthop_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_rthdr0_opt_add - ipmip6_pkt_rthdr0_opt_add
|
|
*
|
|
* Add a routing header type 0 ancillary data option
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i addr
|
|
* The next hop
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_rthdr0_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_rthdr2_opt_add - ipmip6_pkt_rthdr2_opt_add
|
|
*
|
|
* Add a routing header type 2 ancillary data option
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i addr
|
|
* The next hop
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_rthdr2_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_pktinfo_src_opt_add - ipmip6_pkt_pktinfo_src_opt_add
|
|
*
|
|
* Specify what source address is to be used in this particular packet
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i addr
|
|
* The source address
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_pktinfo_src_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_pktinfo_if_opt_add - ipmip6_pkt_pktinfo_if_opt_add
|
|
*
|
|
* Specify what interface is to be used in this particular packet
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i ife
|
|
* The outgoing interface
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_pktinfo_if_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ipmip6_if *ife
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_pktinfo_opt_add - ipmip6_pkt_pktinfo_opt_add
|
|
*
|
|
* Specify what interface and source address is to be used in this particular packet
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i ifp
|
|
* The outgoing interface
|
|
* \i addr
|
|
* The source address
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_pktinfo_opt_add
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *src,
|
|
struct Ipmip6_if *ifp
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_route_via - ipmip6_pkt_route_via
|
|
*
|
|
* Force a packet to route via a specific router
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i nexthop
|
|
* The nexthop address
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_route_via
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *nexthop
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_set_hoplimit - ipmip6_pkt_set_hoplimit
|
|
*
|
|
* Set the hoplimit for this particular packet.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \i value
|
|
* The hoplimit
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_set_hoplimit
|
|
(
|
|
Ipmip6_pktbuf_t *pkt,
|
|
Ip_u32 value
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_set_noroute - ipmip6_pkt_set_noroute
|
|
*
|
|
* Indicate that the packet should be sent 'noroute'. That is,
|
|
* bypass the ordinary routing table.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i pkt
|
|
* The packet
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_set_noroute
|
|
(
|
|
Ipmip6_pktbuf_t *pkt
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_send - ipmip6_pkt_send
|
|
*
|
|
* Sends and frees the packet frame.
|
|
*
|
|
* 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 fd
|
|
* The socket to send on,
|
|
* \i pkt
|
|
* The packet
|
|
* \i addr
|
|
* The destination address.
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL int ipmip6_pkt_send
|
|
(
|
|
struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_fd fd,
|
|
Ipmip6_pktbuf_t *pkt,
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_pad - ipmip6_pkt_pad
|
|
*
|
|
* Pad a packet to achieve alignment.
|
|
*
|
|
* 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 pads
|
|
* The number of pads
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_u8 ipmip6_pkt_pad
|
|
(
|
|
Ipmip_buffer_t *buf,
|
|
Ip_u8 pads
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_pad8 - ipmip6_pkt_pad8
|
|
*
|
|
* Pad a packet to achieve 8 byte alignment.
|
|
*
|
|
* 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.
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_pad8
|
|
(
|
|
Ipmip_buffer_t *buf
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_context_create - ipmip6_pkt_context_create
|
|
*
|
|
* Create and initiate the packet context.
|
|
*
|
|
* 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 dispatch
|
|
* The dispatch callback table for received frames
|
|
* \i udp_port
|
|
* The UDP port to listen to.
|
|
* \i bufalloc
|
|
* The packet buffer allocation routine.
|
|
* \i buffree
|
|
* The packet buffer free routine.
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE on success.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip6_pkt_context_create
|
|
(
|
|
struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6_pkt_context_dispatch_t *dispatch,
|
|
Ip_u16 udp_port,
|
|
Ipmip_pkt_buf_alloc_t bufalloc,
|
|
Ipmip_pkt_buf_free_t buffree
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_context_destroy - ipmip6_pkt_context_destroy
|
|
*
|
|
* Destroy the packet context.
|
|
*
|
|
* 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().
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_context_destroy
|
|
(
|
|
struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_context_start - ipmip6_pkt_context_start
|
|
*
|
|
* Start the packet context.
|
|
*
|
|
* 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().
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip6_pkt_context_start
|
|
(
|
|
struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_pkt_context_stop - ipmip6_pkt_context_stop
|
|
*
|
|
* Stop the packet context.
|
|
*
|
|
* 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().
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_pkt_context_stop
|
|
(
|
|
struct Ipmip6_context *ctx,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|