291 lines
8.6 KiB
C
291 lines
8.6 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipmn_api.h,v $ $Revision: 1.4 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmipmn/include/private/ipmipmn_api.h,v $
|
|
* $Author: jhorteli $ $Date: 2009-04-01 18:34:38 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIPMN_API_H
|
|
#define IPMIPMN_API_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipmipmn_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
#include <private/ipmip4_msgext.h>
|
|
#include <private/ipmip4_context.h>
|
|
|
|
#include <private/ipmipmn_api_pktbuf.h>
|
|
#include <private/ipmipmn_api_attr.h>
|
|
#include <private/ipmipmn_api_node.h>
|
|
#include <private/ipmipmn_api_reg.h>
|
|
#include <private/ipmipmn_api_icmp.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
/* Runmode */
|
|
#define IPMIPMN_API_RUNMODE_FA 1 /* MN uses the home address and lets the FA decapsulate packets */
|
|
#define IPMIPMN_API_RUNMODE_COLOCATED 2 /* MN got a new IP address and decapsulates tunneled packets */
|
|
|
|
#define IPMIPMN_API_DHAA_DISABLED 0
|
|
#define IPMIPMN_API_DHAA_ENABLED 1
|
|
#define IPMIPMN_API_DHAA_HOME 2
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
struct Ipmipmn_api_context;
|
|
struct Ipmipmn_api_node_conf;
|
|
|
|
typedef Ip_bool (*Ipmipmn_api_extension_pkt_rep_validate_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node,
|
|
struct Ipmipmn_api_pktbuf *pbuf
|
|
);
|
|
|
|
typedef void (*Ipmipmn_api_extension_pkt_rep_accepted_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node,
|
|
struct Ipmipmn_api_pktbuf *pbuf
|
|
);
|
|
|
|
typedef void (*Ipmipmn_api_extension_config_instance_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int action,
|
|
const char *pre,
|
|
const char *spec,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
struct Ipmip_cli_message *request
|
|
);
|
|
|
|
typedef int (*Ipmipmn_api_extension_provide_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int action,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node
|
|
);
|
|
|
|
typedef Ip_bool (*Ipmipmn_api_extension_setup_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
int action,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node,
|
|
struct Ipmip_cli_message *request
|
|
);
|
|
|
|
|
|
typedef void (*Ipmipmn_api_extension_pkt_req_mobile_home_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node,
|
|
Ip_bool deregister,
|
|
struct Ipmipmn_api_pktbuf *pbuf
|
|
);
|
|
|
|
typedef void (*Ipmipmn_api_extension_pkt_req_mobile_foreign_t)
|
|
(
|
|
struct Ipmipmn_api_context *ctx,
|
|
struct Ipmip_proc *proc,
|
|
struct Ipmipmn_api_node_conf *conf,
|
|
void *inst_config,
|
|
void *node_config,
|
|
struct Ipmipmn_api_node *node,
|
|
Ip_bool deregister,
|
|
struct Ipmipmn_api_pktbuf *pbuf
|
|
);
|
|
|
|
typedef struct Ipmipmn_api_extension
|
|
{
|
|
const char *name;
|
|
|
|
Ip_u32 node_data_size;
|
|
Ip_u32 instance_data_size;
|
|
|
|
/**/
|
|
Ipmip_pktbuf_payload_t pktaux;
|
|
|
|
/* Callbacks */
|
|
Ipmipmn_api_extension_config_instance_t config_instance;
|
|
|
|
Ipmipmn_api_extension_provide_t provide;
|
|
Ipmipmn_api_extension_setup_t setup;
|
|
|
|
Ipmipmn_api_extension_pkt_rep_validate_t pkt_rep_validate;
|
|
Ipmipmn_api_extension_pkt_rep_accepted_t pkt_rep_accepted;
|
|
|
|
Ipmipmn_api_extension_pkt_req_mobile_home_t pkt_req_mobile_home;
|
|
Ipmipmn_api_extension_pkt_req_mobile_foreign_t pkt_req_mobile_foreign;
|
|
|
|
/* Set by MN */
|
|
Ip_u32 type;
|
|
Ip_u32 func;
|
|
Ip_u32 unique;
|
|
} Ipmipmn_api_extension_t;
|
|
|
|
|
|
typedef struct Ipmipmn_api_function_context
|
|
{
|
|
Ipmipmn_api_extension_t *functions[32];
|
|
Ip_u32 num;
|
|
Ip_u32 node_data;
|
|
Ip_u32 mask;
|
|
Ip_u32 elem;
|
|
} Ipmipmn_api_function_context_t;
|
|
|
|
typedef struct Ipmipmn_api_context
|
|
{
|
|
Ipmip4_context_t ipmip4;
|
|
|
|
/* FD for communicating with the mobile node */
|
|
Ip_fd fd_ipd;
|
|
|
|
/* Function table */
|
|
Ipmipmn_api_node_functable_t *node_func;
|
|
Ipmipmn_api_node_state_functable_t *node_state_func;
|
|
|
|
Ipmipmn_api_function_context_t *functions;
|
|
}
|
|
Ipmipmn_api_context_t;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_api_init - ipmipmn_api_init
|
|
*
|
|
* Init the API section of a context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \i func
|
|
* Node function table
|
|
* \i state_func
|
|
* Node state function table
|
|
* \i reg_func
|
|
* Node registration function table
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_api_init
|
|
(
|
|
struct Ipmipmn_api_context *data,
|
|
struct Ipmip_proc *proc,
|
|
Ipmipmn_api_node_functable_t *func,
|
|
Ipmipmn_api_node_state_functable_t *state_func
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmipmn_api_done - ipmipmn_api_done
|
|
*
|
|
* Free any resource allocate by the API section of the context
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i data
|
|
* Context
|
|
* \i proc
|
|
* Process
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
* \NOMANUAL
|
|
*/
|
|
IP_GLOBAL void ipmipmn_api_done
|
|
(
|
|
struct Ipmipmn_api_context *data,
|
|
struct Ipmip_proc *proc
|
|
);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|