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

689 lines
17 KiB
C

/* ipmipmn_node.h - ipmipmn_node.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api_node.h,v $ $Revision: 1.13 $
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api_node.h,v $
* $Author: jhorteli $ $Date: 2010-10-15 11:28:40 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIPMN_NODE_GENERIC_H
#define IPMIPMN_NODE_GENERIC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
No description currently provided
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmipmn_api_coa.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIPMN_API_NODE_NAME(data, proc, node) \
((*(data)->node_func->node_name)(proc, node))
#define IPMIPMN_API_NODE_STATE_GET(data, proc, node, why) \
((*(data)->node_func->state_get)(data, proc, node, why))
#define IPMIPMN_API_NODE_DESTROY(data, proc, node) \
((*(data)->node_func->destroy_node)(data, proc, node))
#define IPMIPMN_API_NODE_STATE_CALL(data, proc, node, state_call) \
(data)->node_state_func->state_call? ((*(data)->node_state_func->state_call)(data, proc, node)) : 0
#define IPMIPMN_API_NODE_FINDBYKEY(data, proc, pbuf, timer, func, arg1) \
(*(data)->node_func->findbykey) (data, proc, pbuf, timer, func, arg1)
#define IPMIPMN_API_CONF_COMPARE_EQUAL 0
#define IPMIPMN_API_CONF_COMPARE_SECONDARY 1
#define IPMIPMN_API_CONF_COMPARE_PRIMARY 2
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmipmn_api_node;
struct Ipmipmn_api_context;
/* Node major functions */
typedef void (*Ipmipmn_api_node_func_set_coa_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node,
Ipmipmn_api_coa_t *coa
);
typedef int (*Ipmipmn_api_node_func_state_get_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node,
char **why
);
typedef const char *(*Ipmipmn_api_node_func_node_name_t)
(
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef const char *(*Ipmipmn_api_node_func_node_destroy_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef int (*Ipmipmn_api_node_func_node_ifindex_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef void (*Ipmipmn_api_node_findbykey_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_pktbuf *pbuf,
Ipmip_timer_t *timer,
Ipmip_timer_func_t func,
void *arg1
);
enum
{
IPMIPMN_NODE_ATTR_FUNC_STATUS,
IPMIPMN_NODE_ATTR_FUNC_CONF,
IPMIPMN_NODE_ATTR_FUNC_EXT,
IPMIPMN_NODE_ATTR_FUNC_COA,
};
typedef void (*Ipmipmn_node_status_attributes_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
int block,
struct Ipmip_buffer *reply,
struct Ipmipmn_api_node *node
);
typedef struct Ipmipmn_api_node_functable
{
Ipmipmn_api_node_func_set_coa_t set_coa;
Ipmipmn_api_node_func_state_get_t state_get;
Ipmip_timer_lock_event_func_t node_lock;
Ipmipmn_api_node_func_node_name_t node_name;
Ipmipmn_api_node_func_node_destroy_t destroy_node;
Ipmipmn_api_node_findbykey_t findbykey;
} Ipmipmn_api_node_functable_t;
/* Node state transitions */
typedef int (*Ipmipmn_api_node_state_func_t)
(
struct Ipmipmn_api_context *data,
Ipmip_proc_t *proc,
struct Ipmipmn_api_node *node
);
typedef struct Ipmipmn_api_node_state_functable
{
Ipmipmn_api_node_state_func_t booting_up_init;
Ipmipmn_api_node_state_func_t booting_up_exit;
Ipmipmn_api_node_state_func_t booting_down_init;
Ipmipmn_api_node_state_func_t booting_down_exit;
Ipmipmn_api_node_state_func_t isolated_up_init;
Ipmipmn_api_node_state_func_t isolated_up_exit;
Ipmipmn_api_node_state_func_t isolated_down_init;
Ipmipmn_api_node_state_func_t isolated_down_exit;
Ipmipmn_api_node_state_func_t pending_up_init;
Ipmipmn_api_node_state_func_t pending_up_exit;
Ipmipmn_api_node_state_func_t pending_down_init;
Ipmipmn_api_node_state_func_t pending_down_exit;
Ipmipmn_api_node_state_func_t registered_up_init;
Ipmipmn_api_node_state_func_t registered_down_exit;
} Ipmipmn_api_node_state_functable_t;
/*
*===========================================================================
* IPMIPMN data
*===========================================================================
*/
typedef struct Ipmipmn_api_node_conf_security
{
/* SPI lookup tables */
Ipmip4_auth_context_t *spi_ctx_fa;
Ipmip4_auth_context_t *spi_ctx_ha;
Ipmip4_auth_spi_table_t *spi_fa; /* FA SPI */
Ipmip4_auth_spi_table_t *spi_ha; /* MN SPI */
Ipmip4_auth_spi_t *aaa; /* AAA SPI */
} Ipmipmn_api_node_conf_security_t;
/* Changing the config data below requires a complete reboot */
typedef struct Ipmipmn_api_node_conf_primary
{
Ip_u32 home_agent; /* home agent address */
Ip_bool dhaa;
}
Ipmipmn_api_node_conf_primary_t;
/* Changing this config data allows current connections to survive */
typedef struct Ipmipmn_api_node_conf_secondary
{
Ip_u32 sol_address; /* router solicitation address */
Ip_bool receive_broadcasts;
Ip_bool reverse_tunneling;
Ip_u16 lifetime; /* registration lifetime in host endian */
Ip_s8 tunneltype;
}
Ipmipmn_api_node_conf_secondary_t;
typedef struct Ipmipmn_api_node_conf
{
Ipmipmn_api_node_conf_primary_t primary;
Ipmipmn_api_node_conf_secondary_t secondary;
Ipmipmn_api_node_conf_security_t security;
void *extdata[32];
}
Ipmipmn_api_node_conf_t;
typedef struct Ipmipmn_api_node_capture
{
Ipcom_list next;
/* Prefix to capture */
Ip_u32 prefix;
Ip_u32 prefix_length;
} Ipmipmn_api_node_capture_t;
typedef struct Ipmipmn_api_node_params
{
Ip_u32 assigned_home_address; /* home address */
Ip_u32 pending_home_address; /* pending home address */
Ip_u32 assigned_home_agent; /* assigned home agent */
Ip_u32 pending_home_agent; /* pending home agent */
Ip_u32 redirect_home_agent; /* redirect home agent */
Ip_u32 home_netmask; /* home network mask */
Ip_u32 home_gateway; /* home default gateway */
int dhaa;
int reverse_tunnel;
Ip_u16 resends;
Ip_time_t created;
Ip_time_t updated;
Ip_u32 tv_sec_offset;
Ip_u32 last_id1;
Ip_u32 last_tv;
/* Registration information */
int mnRegState;
Ip_u16 mnRegTimeGranted;
Ip_u8 mnRegTunnelFlags;
Ipmip_timer_t mnRegTimer; /* Registration timeout */
Ipmip_timer_t mnRegPendingTimer; /* Pending registration timeout */
Ipmip_timer_t mnRegReRegTimer; /* Pending registration timeout */
Ipmipmn_api_coa_t *mnRegCoA;
Ipmip4_msgext_uhdr_t *mnChallenge;
Ipmip4_msgext_uhdr_t *mnChallengeAdv;
Ip_u16 mnRequestedLifetime;
int mnReverseTunnel;
Ip_u8 mnChallengeRequire;
Ip_u8 mnRegTunnelType;
Ip_u8 mnRegLowLatency;
Ip_u8 mnRegNoResend;
Ip_u32 mnRegRevocationTimestamp;
struct Ipmipmn_api_pktbuf *mnRegReq;
struct Ipmip4_auth_spi *mnRegSPIMobileHome;
struct Ipmip4_auth_spi *mnRegSPIMobileForeign;
struct Ipmip4_if *pubIf;
/**/
#if 0
Ipmipmn_attr_node_stats_t stats;
#endif
Ipmip4_msgext_uhdr_t *nai_ha; /* Runtime value for nai_ha */
Ipmip4_msgext_uhdr_t *nai_aaah; /* Runtime value for nai_aaah */
Ipmip4_msgext_uhdr_t *nai_mn; /* Runtime value for nai_mn */
}
Ipmipmn_api_node_params_t;
typedef struct Ipmipmn_api_node
{
/* Configuration */
Ipmipmn_api_node_conf_t *conf;
/* Node lock */
Ipmip_timer_lock_t *lock;
Ipmip_timer_t service;
Ip_u32 supported;
Ip_u32 enabled;
void **extdata;
/* Home agent parameters */
Ipmipmn_api_node_params_t params;
} Ipmipmn_api_node_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmipmn_api_node_state_update - ipmipmn_api_node_state_update
*
* Update state.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* Node to change state for
* \i new_state
* The new state
* \i format
* Format string for the state change reason
* \i ...
* Format arguments
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_state_update
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
int new_state,
const char *format,
...
);
/*******************************************************************************
*
* ipmipmn_node_api_reregister - ipmipmn_node_api_reregister
*
* Do send a re-registration
*
* Parameters:
* \is
* \i event
* A timer event
* \i data
* Context
* \i proc
* Current process
* \i node
* Node to re-register
* \i extarg
* Extra opaque argument
* \ie
*
* RETURNS: One of the timer codes
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_reregister
(
int event,
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
void *extarg
);
/*******************************************************************************
*
* ipmipmn_api_node_registration_timeout - ipmipmn_api_node_registration_timeout
*
* Timeout a registration
*
* Parameters:
* \is
* \i event
* A timer event
* \i data
* Context
* \i proc
* Current process
* \i node
* Node to timeout
* \i extarg
* Extra opaque argument
* \ie
*
* RETURNS: One of the timer codes
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_registration_timeout
(
int event,
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node,
void *extarg
);
/*******************************************************************************
*
* ipmipmn_api_node_alloc - ipmipmn_api_node_alloc
*
* Create a node.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i sz
* Node size
* \ie
*
* RETURNS: The allocated node.
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL Ipmipmn_api_node_t * ipmipmn_api_node_alloc
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ip_size_t sz
);
/*******************************************************************************
*
* ipmipmn_api_node_destroy - ipmipmn_api_node_destroy
*
* Destroy a node.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_destroy
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_config_read - ipmipmn_api_node_config_read
*
* Read the current configuration
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i confp
* Configuration block to fill in.
* \i pre
* Pre sysvar header.
* \i spec
* Configuration specification.
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL Ip_bool ipmipmn_api_node_config_read
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_conf_t *confp,
const char *pre,
const char *spec
);
/*******************************************************************************
*
* ipmipmn_api_node_config_free - ipmipmn_api_node_config_free
*
* Destroy a config instance
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i confp
* The configuration instance
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_config_free
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_conf_t *confp
);
/*******************************************************************************
*
* ipmipmn_api_node_config_compare - ipmipmn_api_node_config_compare
*
* Destroy a config instance
*
* Parameters:
* \is
* \i conf1
* Configuration instance 1
* \i conf2
* Configuration instance 2
* \i reason
* If -1 or 1 was returned, the reason states why.
* \ie
*
* RETURNS: IPMIPMN_API_CONF_COMPARE_EQUAL, IPMIPMN_API_CONF_COMPARE_SECONDARY
* or IPMIPMN_API_CONF_COMPARE_PRIMARY
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL int ipmipmn_api_node_config_compare
(
Ipmipmn_api_node_conf_t *conf1,
Ipmipmn_api_node_conf_t *conf2,
const char **reason
);
/*******************************************************************************
*
* ipmipmn_api_node_reset_home_agent - ipmipmn_api_node_reset_home_agent
*
* Reset the home agent parameters to their default value based on
* current configuration
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_reset_home_agent
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_runtime_free - ipmipmn_api_node_runtime_free
*
* Free and reset allocated runtime parameters.
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_runtime_free
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
/*******************************************************************************
*
* ipmipmn_api_node_free_coa - ipmipmn_api_node_free_coa
*
* Free and reset parameters allocated for the current CoA
*
* Parameters:
* \is
* \i data
* Context
* \i proc
* Process
* \i node
* The Node
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* \NOMANUAL
*/
IP_GLOBAL void ipmipmn_api_node_free_coa
(
struct Ipmipmn_api_context *data,
struct Ipmip_proc *proc,
Ipmipmn_api_node_t *node
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/