413 lines
17 KiB
C
413 lines
17 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6pm_node.h,v $ $Revision: 1.21 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip6pm/src/ipmip6pm_node.h,v $
|
|
* $Author: jhorteli $ $Date: 2010-10-15 11:30:08 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP6PM_NODE_H
|
|
#define IPMIP6PM_NODE_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <private/ipmip6_nd_proxy.h>
|
|
#include <private/ipmip6_nd_nud.h>
|
|
#include <private/ipmip6_util.h>
|
|
#include <ipmip6pm_if.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPMIP6PM_NODE_FLAG_NAI (1 << 0)
|
|
#define IPMIP6PM_NODE_FLAG_TERMINATE (1 << 1)
|
|
#define IPMIP6PM_NODE_FLAG_BU (1 << 2)
|
|
#define IPMIP6PM_NODE_FLAG_DEREGISTER (1 << 3)
|
|
#define IPMIP6PM_NODE_FLAG_UDP_DISABLED (1 << 4)
|
|
#define IPMIP6PM_NODE_FLAG_INET6_PREFIX_0 (1 << 5)
|
|
#define IPMIP6PM_NODE_FLAG_INET_PREFIX_0 (1 << 6)
|
|
#define IPMIP6PM_NODE_FLAG_GRE_DOWNLINK (1 << 7)
|
|
#define IPMIP6PM_NODE_FLAG_GRE_UPLINK (1 << 8)
|
|
|
|
#define IPMIP6PM_NODE_FLAG_GRE_LINK (IPMIP6PM_NODE_FLAG_GRE_DOWNLINK|IPMIP6PM_NODE_FLAG_GRE_UPLINK)
|
|
|
|
|
|
#ifdef IPMIP_USE_INET
|
|
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) ((n)->homeagent_inet)
|
|
#else
|
|
#define IPMIP6PM_NODE_HOMEAGENT_INET(n) 0
|
|
#endif
|
|
|
|
#define IPMIP6PM_NODE_USE_GRE_KEYS(n) (IPMIP_TUNNELTYPE_IS_GRE((n)->transport_tunnel_type) && (((n)->flags & (IPMIP6PM_NODE_FLAG_GRE_LINK)) == IPMIP6PM_NODE_FLAG_GRE_LINK))
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
struct Ipmip6pm_context;
|
|
struct Ipmip_proc;
|
|
struct Ipmip6pm_if;
|
|
struct Ipmip6pm_pktbuf;
|
|
struct Ipmip6pm_lma;
|
|
struct Ipmip_attr_header;
|
|
struct Ipmip_attr;
|
|
struct Ipmip6pm_br;
|
|
|
|
typedef int (*Ipmip6pm_bri_done_t) (struct Ipmip6pm_context *ctx, struct Ipmip_proc *proc, struct Ipmip6pm_node *node, struct Ipmip6pm_br *bri, Ip_bool timeout, Ip_u8 status);
|
|
|
|
typedef struct Ipmip6pm_br
|
|
{
|
|
Ipcom_list next;
|
|
|
|
Ip_u32 sequence;
|
|
|
|
Ip_u8 xmits;
|
|
Ip_u8 reason;
|
|
Ip_u8 state;
|
|
Ip_u16 flags;
|
|
|
|
Ip_bool inet;
|
|
Ip_bool add_coa;
|
|
Ip_size_t match_len;
|
|
|
|
Ipmip_timer_t retransmit;
|
|
Ipmip_timer_func_t reply;
|
|
|
|
void *opaque;
|
|
Ipmip_timer_lock_t *lock;
|
|
struct Ipmip6pm_lma *lma;
|
|
Ipmip6pm_bri_done_t completion;
|
|
|
|
/**/
|
|
} Ipmip6pm_br_t;
|
|
|
|
typedef struct Ipmip6pm_node_service
|
|
{
|
|
struct Ipmip6pm_node_service *next;
|
|
char *value;
|
|
char *module;
|
|
} Ipmip6pm_node_service_t;
|
|
|
|
typedef struct Ipmip6pm_node
|
|
{
|
|
struct Ipmip6pm_node *prev;
|
|
struct Ipmip6pm_node *next;
|
|
|
|
/**/
|
|
Ipmip_timer_lock_t *lock;
|
|
Ipmip6_mh_mo_nai_t *mo_nai_mn;
|
|
Ipmip6_mh_mo_pmipv6_access_technology_type_t *mo_access_type;
|
|
Ipmip6_mh_mo_pmipv6_mn_link_layer_id_t *mo_link_layer_id;
|
|
Ipmip6_mh_mo_pmipv6_handoff_indicator_t *mo_handoff_indicator;
|
|
Ipmip6_mh_mo_pmipv6_home_prefix_t *mo_home_prefix;
|
|
Ip_u8 mo_home_prefix_size;
|
|
Ipmip6_mh_mo_pmipv6_timstamp_t mo_timestamp;
|
|
|
|
Ipmip_lladdr_t *lla;
|
|
|
|
struct Ipmip6pm_lma *lma;
|
|
|
|
Ipcom_list bri_list;
|
|
|
|
Ipmip6pm_if_priv_notify_t ifp_private;
|
|
struct Ipmip6pm_if *ifp_public;
|
|
Ipmip6_util_timediff_t time_diff;
|
|
|
|
struct Ip_in6_addr homeagent;
|
|
#ifdef IPMIP_USE_INET
|
|
Ip_u32 homeagent_inet;
|
|
Ip_u32 homeagent_nat;
|
|
Ipmip6_inet_t mo_dsmipv6_home_prefix;
|
|
#endif
|
|
|
|
/**/
|
|
Ipmip_timer_t expire;
|
|
Ipmip_timer_t revoke;
|
|
Ipmip_timer_t service;
|
|
Ipmip_timer_retransmit_t binding_update;
|
|
|
|
Ip_u32 remaining;
|
|
Ip_u8 termstate;
|
|
Ip_u8 revokestate;
|
|
Ip_u8 handoffstate;
|
|
Ip_u8 servicestate;
|
|
|
|
Ip_u32 enabled[IPMIP6PM_FUNCTION_MAX];
|
|
Ip_u32 supported[IPMIP6PM_FUNCTION_MAX];
|
|
|
|
Ip_time_t created;
|
|
Ip_u32 status;
|
|
|
|
Ip_u32 route_state;
|
|
|
|
Ip_u32 gre_key[2];
|
|
|
|
Ip_u32 identity;
|
|
Ip_u32 flags;
|
|
|
|
Ip_u16 sequence;
|
|
Ip_u8 bristate;
|
|
|
|
Ip_u8 transport_tunnel_type;
|
|
Ip_u8 supported_tunnel_types;
|
|
|
|
/* Statistics */
|
|
struct Ipmip6_mib_mip6MnBLTable mip6MnBLTable;
|
|
struct Ipmip6_mib_mip6MnRegnCounters mip6MnRegnCounters;
|
|
struct Ipmip6_mib_mip6NodeTrafficEntry mip6NodeTrafficEntry;
|
|
|
|
void **extdata[IPMIP6PM_FUNCTION_MAX];
|
|
} Ipmip6pm_node_t;
|
|
|
|
#define IPMIP6PM_NODE_LOOKUP_LLADDR (1 << 0)
|
|
#define IPMIP6PM_NODE_LOOKUP_ACCESS_TYPE (1 << 1)
|
|
#define IPMIP6PM_NODE_LOOKUP_SEQUENCE (1 << 2)
|
|
#define IPMIP6PM_NODE_LOOKUP_IFNAME (1 << 3)
|
|
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX (1 << 4)
|
|
#define IPMIP6PM_NODE_LOOKUP_TIMESTAMP (1 << 5)
|
|
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_MO (1 << 6)
|
|
#define IPMIP6PM_NODE_LOOKUP_HOME_PREFIX_INET_MO (1 << 7)
|
|
|
|
typedef struct Ipmip6pm_node_lookup
|
|
{
|
|
void *nai_mn;
|
|
Ip_size_t nai_mn_len;
|
|
|
|
/* Optional */
|
|
Ip_u32 search_params;
|
|
struct
|
|
{
|
|
/* Link Layer */
|
|
void *lladdr;
|
|
Ip_size_t lladdr_len;
|
|
|
|
/* Access Type */
|
|
Ip_u8 access_type;
|
|
|
|
/* Sequence Number */
|
|
Ip_u16 sequence;
|
|
|
|
/* Ifindex */
|
|
const char *ifname;
|
|
|
|
/**/
|
|
Ipmip6_address_t *home_prefix;
|
|
Ip_u8 home_prefix_size;
|
|
|
|
/**/
|
|
Ip_u64 *tstamp;
|
|
|
|
Ipmip6_mh_option_array_t *home_prefix_mo;
|
|
#ifdef IPMIP_USE_INET
|
|
Ipmip6_mh_option_array_t *home_prefix_inet_req_mo;
|
|
#endif
|
|
|
|
} args;
|
|
} Ipmip6pm_node_lookup_t;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
extern Ip_u32 ipmip6pm_node_transport_identity;
|
|
|
|
IP_GLOBAL void ipmip6pm_node_clear(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_context_init(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6pm_if *ifp);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_context_destroy(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6pm_if *ifp);
|
|
|
|
IP_GLOBAL int ipmip6pm_node_terminate(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
const char *reason);
|
|
IP_GLOBAL void ipmip6pm_node_silence(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
|
|
IP_GLOBAL int ipmip6pm_node_handoff(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *head,
|
|
Ip_u8 hi,
|
|
struct Ipmip_attr **idattr);
|
|
|
|
IP_GLOBAL int ipmip6pm_node_create(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *head,
|
|
Ip_u8 hi,
|
|
struct Ipmip_attr_header *hdr,
|
|
struct Ipmip_attr **idattr,
|
|
Ip_u32 *identity);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_lookup(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6pm_if *ifp,
|
|
Ipmip6_mh_mo_nai_t *nai,
|
|
Ipmip_timer_t *timer,
|
|
Ipmip_timer_func_t func,
|
|
void *arg);
|
|
IP_GLOBAL void ipmip6pm_node_lookup_handle(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ip_u32 handle,
|
|
Ipmip_timer_t *timer,
|
|
Ipmip_timer_func_t func,
|
|
void *arg);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_search(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6pm_if *ifp,
|
|
Ipmip6pm_node_lookup_t *nargs,
|
|
Ipmip_timer_t *timer,
|
|
Ipmip_timer_func_t func,
|
|
void *arg);
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_compare(Ipmip6pm_node_t *node,
|
|
Ipmip6pm_node_lookup_t *nargs);
|
|
|
|
IP_GLOBAL const char *ipmip6pm_node_describe(struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
IP_GLOBAL int ipmip6pm_node_timeout(int event,
|
|
struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
const char *reason);
|
|
IP_GLOBAL int ipmip6pm_node_registration_timeout(int event,
|
|
struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
const char *reason);
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_disable(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_enable(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_enable_function(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
int func,
|
|
Ip_u32 mask);
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_disable_function(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
int func,
|
|
Ip_u32 mask);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_disable_transport(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_validate(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
struct Ipmip6pm_pktbuf *pbuf);
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_service_reply_accept(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
struct Ipmip6pm_pktbuf *pbuf);
|
|
|
|
|
|
IP_GLOBAL void ipmip6pm_node_update_link(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
|
|
IP_GLOBAL void ipmip6pm_node_service_install(struct Ipmip6pm_context *ctx);
|
|
|
|
|
|
/**/
|
|
IP_GLOBAL int ipmip6pm_node_process_revoke(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmip6pm_node *node,
|
|
struct Ipmip6pm_pktbuf *pbuf);
|
|
|
|
|
|
IP_GLOBAL void ipmip6pm_node_bri_free(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
Ipmip6pm_br_t *bri);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_bri_cancel(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
Ipmip6pm_bri_done_t completion);
|
|
|
|
IP_GLOBAL void ipmip6pm_node_bri_cancel_lma(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
Ipmip6pm_bri_done_t completion,
|
|
struct Ipmip6pm_lma *lma);
|
|
|
|
|
|
IP_GLOBAL int ipmip6pm_node_bri_accept(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
Ipmip6pm_br_t *bri,
|
|
Ip_bool timeout,
|
|
Ip_u8 status);
|
|
|
|
IP_GLOBAL int ipmip6pm_node_revoke(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node,
|
|
Ip_bool inet,
|
|
Ip_u8 reason,
|
|
Ipmip6pm_bri_done_t completion);
|
|
|
|
|
|
IP_GLOBAL Ip_bool ipmip6pm_node_if_link_ready(struct Ipmip6pm_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
Ipmip6pm_node_t *node);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|