original files of m241
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm.c,v $ $Revision: 1.10 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Niklas Lundberg <n@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
*******************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include "ipmippm_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_drv_eth_filter.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_sysctl.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_netif.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_radius.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_h.h"
|
||||
#include "ipmippm_reg.h"
|
||||
#include "ipmippm_client.h"
|
||||
#include "ipmippm_attr_h.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Application datatypes
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmippm_configure(void);
|
||||
IP_PUBLIC Ip_err ipmippm_init(void);
|
||||
IP_PUBLIC Ip_err ipmippm_exit(void);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmippm_start(void);
|
||||
IP_PUBLIC const char *ipmippm_version(void);
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_PUBLIC IPCOM_PROCESS(ipmippm_proc);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippmd
|
||||
*===========================================================================
|
||||
* Description: The main process.
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC
|
||||
IPCOM_PROCESS(ipmippm_proc)
|
||||
{
|
||||
ipmippm_main();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_start
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC Ip_err
|
||||
ipmippm_start(void)
|
||||
{
|
||||
Ipcom_proc_attr attr;
|
||||
Ip_err ret;
|
||||
|
||||
ipcom_proc_attr_init(&attr);
|
||||
attr.stacksize = IPCOM_PROC_STACK_LARGE;
|
||||
|
||||
ret = ipcom_proc_acreate("ipmippmd", ipmippm_proc, &attr, IP_NULL);
|
||||
ip_assert(ret == IPCOM_SUCCESS);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_version
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC const char *
|
||||
ipmippm_version(void)
|
||||
{
|
||||
return "@(#) IPMIPPM $Name: VXWORKS_ITER40_2019102207 $ - INTERPEAK_COPYRIGHT_STRING";
|
||||
}
|
||||
|
||||
|
||||
#if defined (IP_PORT_LAS)
|
||||
|
||||
/* Prototypes */
|
||||
IP_PUBLIC Ip_err ipcom_daemon_configure(void);
|
||||
IP_PUBLIC Ip_err ipcom_daemon_create(void);
|
||||
|
||||
IP_PUBLIC Ip_err
|
||||
ipcom_daemon_configure(void)
|
||||
{
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_err
|
||||
ipcom_daemon_create(void)
|
||||
{
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,336 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_attr.c,v $ $Revision: 1.9 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_attr.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmippm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_attr.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_h.h"
|
||||
#include "ipmippm_attr_h.h"
|
||||
#include "ipmippm_client.h"
|
||||
#include "ipmippm_if.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmippm_attr_op
|
||||
{
|
||||
Ipmip_cli_message_t *request;
|
||||
Ip_u32 hoa;
|
||||
const char *nai;
|
||||
Ip_u32 nai_len;
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_attr_list_client
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_attr_list_client(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_client_t *node,
|
||||
struct Ipmippm_attr_op *aop,
|
||||
void *unused)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
|
||||
if (aop->hoa != 0 && node->api.params.assigned_home_address != aop->hoa)
|
||||
return;
|
||||
|
||||
if (aop->nai && (node->api.params.nai_mn == IP_NULL || !ipmip_util_strnncmp(aop->nai, aop->nai_len, (char *)IPMIP4_MSGEXT_SHDR_EXT_DATA(node->api.params.nai_mn), IPMIP4_MSGEXT_SHDR_EXT_SIZE(node->api.params.nai_mn))))
|
||||
return;
|
||||
|
||||
/**/
|
||||
ipmip_attr_put_u32(&aop->request->message, IPMIPPM_CLI_ATTR_NODE_HANDLE, node->pmClientIdentity);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC int
|
||||
ipmippm_attr_client_exec(int event,
|
||||
Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmip_cli_message_t *request,
|
||||
Ipmippm_client_t *node)
|
||||
{
|
||||
int ret = IPMIP_TIMER_RET_DONE;
|
||||
if (event == IPMIP_TIMER_EVENT_RUN)
|
||||
{
|
||||
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
|
||||
Ip_size_t rhdr = 0;
|
||||
Ip_size_t rta;
|
||||
|
||||
if (node == IP_NULL)
|
||||
rhdr = ipmip_attr_hdr_err(&request->message, hdr, IP_ERRNO_ENOENT, IP_NULL);
|
||||
else
|
||||
{
|
||||
switch (IPMIP_ATTR_HDR_TYPE(hdr))
|
||||
{
|
||||
case IPMIPPM_CLI_CLIENT_DELETE:
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
ret = ipmippm_client_terminate(data, proc, node);
|
||||
break;
|
||||
case IPMIPPM_CLI_CLIENT_GET:
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
rta = ipmip_attr_begin(&request->message, IPMIPMN_API_CLI_ATTR_NODE);
|
||||
ipmipmn_api_attr_node_dump(&data->api, proc, request, &node->api);
|
||||
ipmip_attr_put_u32(&request->message, IPMIPPM_CLI_ATTR_NODE_HANDLE, node->pmClientIdentity);
|
||||
ipmipmn_api_attr_node_coa_dump(&data->api, proc, request, &node->api);
|
||||
ipmip_attr_end(&request->message, rta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have a reply header; terminate it */
|
||||
ipmip_attr_hdr_finalize(&request->message, rhdr);
|
||||
|
||||
/* Commit the reply */
|
||||
ipmip_cli_message_commit(&data->api.ipmip4.ipmip, proc, request);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Free the request */
|
||||
ipmip_cli_message_free(&data->api.ipmip4.ipmip, proc, request);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_attr_command
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int
|
||||
ipmippm_attr_command(struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_cli_message *request)
|
||||
{
|
||||
struct Ipmip_attr_header *hdr = (struct Ipmip_attr_header *)IPMIP_BUFFER_DATA(&request->request);
|
||||
Ip_size_t rhdr = 0;
|
||||
|
||||
switch (IPMIP_ATTR_HDR_TYPE(hdr))
|
||||
{
|
||||
case IPMIPPM_CLI_CLIENT_LIST:
|
||||
{
|
||||
struct Ipmip_attr *idattr[IPMIPPM_CLI_ATTR_NODE_MAX + 1];
|
||||
struct Ipmippm_attr_op aop;
|
||||
|
||||
ipcom_memset(&aop, 0, sizeof(aop));
|
||||
|
||||
aop.request = request;
|
||||
|
||||
ipmip_attr_hdr_parse(IPMIPPM_CLI_ATTR_NODE_MAX, hdr, idattr);
|
||||
|
||||
aop.hoa = ipmip_attr_get_inet(idattr[IPMIPMN_CLI_API_ATTR_NODE_HOA]);
|
||||
|
||||
/* NAI */
|
||||
aop.nai = ipmip_attr_get_data(idattr[IPMIPMN_CLI_API_ATTR_NODE_NAI]);
|
||||
if (aop.nai)
|
||||
aop.nai_len = IPMIP_ATTR_PAYLOAD(idattr[IPMIPMN_CLI_API_ATTR_NODE_NAI]);
|
||||
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
|
||||
/* Add all nodes */
|
||||
ipmip_context_id_lock(data->idents);
|
||||
ipmip_context_id_foreach(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
data->idents,
|
||||
(Ipmip_util_hash_foreach_t)ipmippm_attr_list_client,
|
||||
&aop,
|
||||
IP_NULL);
|
||||
ipmip_context_id_unlock(data->idents);
|
||||
|
||||
}
|
||||
break;
|
||||
case IPMIPPM_CLI_CLIENT_GET:
|
||||
case IPMIPPM_CLI_CLIENT_DELETE:
|
||||
{
|
||||
Ip_u32 handle = ipmip_attr_hdr_find_u32(hdr, IPMIPPM_CLI_ATTR_NODE_HANDLE);
|
||||
|
||||
if (handle == 0)
|
||||
return -IP_ERRNO_EINVAL;
|
||||
|
||||
ipmippm_client_lookup_handle(data,
|
||||
proc,
|
||||
handle,
|
||||
&request->timer,
|
||||
(Ipmip_timer_func_t)ipmippm_attr_client_exec,
|
||||
request);
|
||||
return 0;
|
||||
}
|
||||
case IPMIPPM_CLI_CLIENT_TRIGGER:
|
||||
/* Locate NAI & AT and IFNAME */
|
||||
|
||||
|
||||
return 0;
|
||||
case IPMIP_CLI_NAME_LIST:
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
if (data->conf != IP_NULL)
|
||||
{
|
||||
/* Dump each configuration item we've currently got in human readable form */
|
||||
Ipmippm_if_t *ife;
|
||||
|
||||
/* Add interfaces */
|
||||
for (ife = IPCOM_LIST_FIRST(&data->conf->if_head); ife; ife = IPCOM_LIST_NEXT(&ife->iff.ipmip.next))
|
||||
ipmip_attr_put_str(&request->message,
|
||||
IPMIP_CLI_ITEM_NAME,
|
||||
ife->iff.ipmip.ifname);
|
||||
}
|
||||
break;
|
||||
case IPMIP_CLI_CONFIG_GET:
|
||||
if (data->conf == IP_NULL)
|
||||
return -IP_ERRNO_EPERM;
|
||||
|
||||
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
|
||||
{
|
||||
/* Dump each configuration item we've currently got in human readable form */
|
||||
Ipmippm_if_t *ife;
|
||||
const char *name = ipmip_attr_hdr_find_str(hdr, IPMIP_CLI_ITEM_NAME);
|
||||
|
||||
/* Clear any old interfaces */
|
||||
for (ife = IPCOM_LIST_FIRST(&data->conf->if_head); ife; ife = IPCOM_LIST_NEXT(&ife->iff.ipmip.next))
|
||||
{
|
||||
char spec[IP_IFNAMSIZ + 6];
|
||||
|
||||
if (name != IP_NULL && ipcom_strcasecmp(ife->iff.ipmip.ifname, name) != 0)
|
||||
continue;
|
||||
|
||||
ipcom_snprintf(spec, sizeof(spec), "if.%s.", ife->iff.ipmip.ifname);
|
||||
|
||||
ipmipmn_api_attr_config_dump(&data->api, proc, request, &ife->conf->api, "ipmippm", spec);
|
||||
/**/
|
||||
ipmip_cli_config_printf(&request->message,
|
||||
"ipmippm.if.%s.address=%s",
|
||||
ife->iff.ipmip.ifname, ife->iff.ipmip.ifname);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ipmip4_attr_command(&data->api.ipmip4, proc, request);
|
||||
}
|
||||
|
||||
/* If we have a reply header; terminate it */
|
||||
ipmip_attr_hdr_finalize(&request->message, rhdr);
|
||||
|
||||
/* Commit the reply */
|
||||
ipmip_cli_message_commit(&data->api.ipmip4.ipmip, proc, request);
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_attr_h.h,v $ $Revision: 1.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_attr_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2008-03-07 13:28:51 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPPM_ATTR_H_H
|
||||
#define IPMIPPM_ATTR_H_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <ipmippm_h.h>
|
||||
#include <ipmippm_attr.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_attr_command - ipmippm_attr_command
|
||||
*
|
||||
* Process a proxy mobile node attribute command
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i request
|
||||
* Issued command
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IPCOM_SUCCESS on successful parsing
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL int ipmippm_attr_command
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmip_cli_message *request
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,180 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_cli.c,v $ $Revision: 1.2 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_cli.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmippm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_sysctl.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_route.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_buffer.h>
|
||||
#include <private/ipmip_util.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_attr.h"
|
||||
#include "ipmippm_cli.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_bool
|
||||
ipmippm_cli_connect(Ipmip_cli_daemon_t *daemon_info)
|
||||
{
|
||||
ipmip_cli_daemon_init(daemon_info, "ipmippm", IPCOM_IPD_ID_IPMIPPM);
|
||||
return ipmip_cli_daemon_connect(daemon_info);
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmippm_cli_request_set_handle(Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
ipmip_attr_put_u32(&req->reqbuf, IPMIPPM_CLI_ATTR_NODE_HANDLE, handle);
|
||||
}
|
||||
|
||||
IP_PUBLIC struct Ipmip_attr *
|
||||
ipmippm_cli_node_get(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIPPM_CLI_CLIENT_GET);
|
||||
|
||||
ipmippm_cli_request_set_handle(req, handle);
|
||||
if (ipmip_cli_daemon_request(daemon, req) == IPCOM_SUCCESS)
|
||||
return ipmip_cli_daemon_find_request(req, IPMIPMN_API_CLI_ATTR_NODE);
|
||||
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
IP_PUBLIC void
|
||||
ipmippm_cli_node_delete(Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle)
|
||||
{
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
ipmip_cli_daemon_request_start(&req, IPMIPPM_CLI_CLIENT_DELETE);
|
||||
ipmippm_cli_request_set_handle(&req, handle);
|
||||
ipmip_cli_daemon_request(daemon, &req);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmippm_cli_node_get_handle(struct Ipmip_attr *node)
|
||||
{
|
||||
return ipmip_attr_payload_find_u32(node, IPMIPPM_CLI_ATTR_NODE_HANDLE);
|
||||
}
|
||||
|
||||
IP_PUBLIC Ip_u32
|
||||
ipmippm_cli_handle_next(Ipmip_attr_iter_t *iter)
|
||||
{
|
||||
/**/
|
||||
return ipmip_attr_get_u32(ipmip_attr_iter_next(iter, IPMIPPM_CLI_ATTR_NODE_HANDLE));
|
||||
}
|
||||
|
||||
IP_PUBLIC int
|
||||
ipmippm_cli_node_list(Ipmip_cli_daemon_t *daemon,
|
||||
Ipmip_cli_daemon_req_t *req,
|
||||
const char *nai,
|
||||
Ip_u32 hoa)
|
||||
{
|
||||
ipmip_cli_daemon_request_start(req, IPMIPPM_CLI_CLIENT_LIST);
|
||||
ipmipmn_api_cli_request_set_home_address(req,hoa);
|
||||
ipmipmn_api_cli_request_set_nai(req, nai);
|
||||
return ipmip_cli_daemon_request(daemon, req);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,381 @@
|
||||
/* ipmippm_client.h - ipmippm_client.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_client.h,v $ $Revision: 1.8 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_client.h,v $
|
||||
* $Author: ulf $ $Date: 2009-06-08 11:05:57 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPPM_CLIENT_H
|
||||
#define IPMIPPM_CLIENT_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPPM_CLIENT_REGISTERED (1 << 0)
|
||||
|
||||
enum
|
||||
{
|
||||
IPMIPPM_CLIENT_PROXY_MODE_STANDARD,
|
||||
IPMIPPM_CLIENT_PROXY_MODE_WIMAX,
|
||||
IPMIPPM_CLIENT_PROXY_MODE_MAX
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
struct Ipmipmn_api_iff;
|
||||
struct Ipmipmn_api_pktbuf;
|
||||
struct Ipmippm_pktbuf;
|
||||
union Ipmip4_msgext_uhdr;
|
||||
|
||||
typedef struct Ipmippm_client_conf
|
||||
{
|
||||
Ipmipmn_api_node_conf_t api;
|
||||
|
||||
struct Ipmipmn_api_iff *iff;
|
||||
int proxy_mode;
|
||||
} Ipmippm_client_conf_t;
|
||||
|
||||
typedef struct Ipmippm_client
|
||||
{
|
||||
/* Generic Node */
|
||||
Ipmipmn_api_node_t api;
|
||||
Ip_u32 flags;
|
||||
|
||||
Ip_u32 pmClientIdentity;
|
||||
|
||||
Ip_u8 access_type;
|
||||
|
||||
/* New/Next FA */
|
||||
Ipmipmn_api_coa_t *pmTriggerCOA;
|
||||
|
||||
struct Ipmipmn_api_iff *ifp;
|
||||
Ipmip_lladdr_t *lladdr;
|
||||
|
||||
Ipcom_list triggers;
|
||||
|
||||
union Ipmip4_msgext_uhdr *pmAccessType;
|
||||
union Ipmip4_msgext_uhdr *pmDeviceID;
|
||||
union Ipmip4_msgext_uhdr *pmInterfaceID;
|
||||
union Ipmip4_msgext_uhdr *pmSubscriberID;
|
||||
union Ipmip4_msgext_uhdr *pmPerNodeAuthMethod;
|
||||
|
||||
|
||||
/* State */
|
||||
int state;
|
||||
|
||||
/* Fixed Parameters */
|
||||
Ip_u8 pmTunnelType;
|
||||
Ip_u8 pmReverseTunnel;
|
||||
} Ipmippm_client_t;
|
||||
|
||||
|
||||
typedef struct Ipmippm_client_key
|
||||
{
|
||||
struct Ip_iovec nai;
|
||||
Ip_u8 access_type;
|
||||
} Ipmippm_client_key_t;
|
||||
|
||||
extern Ipmipmn_api_node_functable_t ipmippm_client_func;
|
||||
extern Ipmipmn_api_node_state_functable_t ipmippm_client_state_func;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_alloc - ipmippm_client_alloc
|
||||
*
|
||||
* Create a node.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i pbuf
|
||||
* Packet buffer containing the trigger
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: The allocated node.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ipmippm_client_t * ipmippm_client_alloc
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_context_init - ipmippm_client_context_init
|
||||
*
|
||||
* Initialize the client portion of the PM context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_client_context_init
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_context_destroy - ipmippm_client_context_destroy
|
||||
*
|
||||
* Destroy the client portion of the PM context
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_client_context_destroy
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_terminate - ipmippm_client_terminate
|
||||
*
|
||||
* Gracefully terminate the specified client
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i client
|
||||
* The client to terminate
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: A timer process value.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL int ipmippm_client_terminate
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_client *client
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_clear - ipmippm_client_clear
|
||||
*
|
||||
* Gracefully terminate all existing clients
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_client_clear
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_lookup_handle - ipmippm_client_lookup_handle
|
||||
*
|
||||
* Lookup a client based on the handle
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i handle
|
||||
* The handle
|
||||
* \i timer
|
||||
* Timer object
|
||||
* \i func
|
||||
* Function to call
|
||||
* \i arg1
|
||||
* Opaque argument
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_client_lookup_handle
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ip_u32 handle,
|
||||
Ipmip_timer_t *timer,
|
||||
Ipmip_timer_func_t func,
|
||||
void *arg1
|
||||
);
|
||||
|
||||
IP_GLOBAL void ipmippm_client_findbynai
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmipmn_api_iff *ifp,
|
||||
struct Ip_iovec *nai,
|
||||
Ip_u8 access_type,
|
||||
Ipmip_timer_t *timer,
|
||||
Ipmip_timer_func_t func,
|
||||
void *arg1
|
||||
);
|
||||
|
||||
IP_GLOBAL void ipmippm_client_trigger_handoff
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_pktbuf *pbuf
|
||||
);
|
||||
|
||||
IP_GLOBAL const char *ipmippm_client_describe
|
||||
(
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_client_t *client
|
||||
);
|
||||
|
||||
IP_GLOBAL Ipmipmn_api_coa_t *ipmippm_client_alloc_coa
|
||||
(
|
||||
Ip_u32 address,
|
||||
Ip_u16 lifetime,
|
||||
Ipmipmn_api_coa_output_t output,
|
||||
Ip_u32 extra
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_client_init_coa - ipmippm_client_init_coa
|
||||
*
|
||||
* Init parameters for a new CoA
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Process
|
||||
* \i node
|
||||
* The Node
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_client_init_coa
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmippm_client_t *client
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,504 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_cmd_pm.c,v $ $Revision: 1.9.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_cmd_pm.c,v $
|
||||
* $Author: jsheng $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Niklas Lundberg <n@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
*******************************************************************************
|
||||
*
|
||||
*/
|
||||
/*
|
||||
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_getopt.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_tmo2.h>
|
||||
#include <ipcom_cmd.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_cli.h>
|
||||
#include <private/ipmip_context.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_msgext.h>
|
||||
#include <private/ipmip4_netlink.h>
|
||||
#include <private/ipmip4_ntop.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_attr.h"
|
||||
#include "ipmippm_cli.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC int ipmippm_cmd_pm(int argc, char **argv);
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPPM_CMD_OP_LIST (1)
|
||||
#define IPMIPPM_CMD_OP_SHOW (2)
|
||||
#define IPMIPPM_CMD_OP_DELETE (3)
|
||||
|
||||
IP_STATIC Ipcom_cmd_int_str_map ipmippm_cmd_ops[] =
|
||||
{
|
||||
{ IPMIPPM_CMD_OP_LIST, "list" },
|
||||
{ IPMIPPM_CMD_OP_SHOW, "show" },
|
||||
{ IPMIPPM_CMD_OP_DELETE, "delete" },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipha_cmd_print_binding_fmt
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_cmd_print_binding_fmt(const char *hoa,
|
||||
const char *coa,
|
||||
const char *home_agent,
|
||||
const char *lifetime,
|
||||
const char *nai)
|
||||
{
|
||||
/* */
|
||||
ipcom_printf("%-20s %-20s %-16s %-15s %s"IP_LF,
|
||||
hoa, coa, home_agent, lifetime, nai);
|
||||
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmippm_cmd_print_node(Ipmip_proc_t *proc,
|
||||
struct Ipmip_attr *node,
|
||||
struct Ipmip_attr *coa,
|
||||
Ip_bool verbose)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(verbose);
|
||||
|
||||
ipcom_snprintf(proc->ntop.ntop_lla, sizeof(proc->ntop.ntop_lla),
|
||||
"%d/%d",
|
||||
ipmipmn_api_cli_node_get_time_remaining(node),
|
||||
ipmipmn_api_cli_node_get_time_requested(node));
|
||||
|
||||
ipmippm_cmd_print_binding_fmt(ipmip_ntop_inet(proc, ipmipmn_api_cli_node_get_home_address(node)),
|
||||
ipmip_ntop_inet(proc, ipmipmn_api_cli_node_coa_get_address(coa)),
|
||||
ipmip_ntop_inet(proc, ipmipmn_api_cli_node_get_home_agent(node)),
|
||||
proc->ntop.ntop_lla,
|
||||
ipmipmn_api_cli_node_get_nai(node));
|
||||
}
|
||||
|
||||
IP_STATIC void
|
||||
ipmippm_cmd_show_node(Ipmip_proc_t *proc,
|
||||
struct Ipmip_attr *node,
|
||||
struct Ipmip_attr *coa,
|
||||
Ip_bool verbose)
|
||||
{
|
||||
Ip_u32 tmp;
|
||||
Ip_u32 status;
|
||||
const char *str;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(verbose);
|
||||
|
||||
ipcom_printf("Proxy Mobile Node : %08x"IP_LF, ipmippm_cli_node_get_handle(node));
|
||||
|
||||
status = ipmipmn_api_cli_node_get_status(node);
|
||||
ipcom_printf(" Status : %s"IP_LF, ipmipmn_api_attr_statename[status]);
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_address(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Home Address : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
ipcom_printf(" Dynamic Home Address: %s"IP_LF, ipmipmn_api_cli_node_get_home_address_dynamic(node)? "yes" : "no");
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_agent(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Assigned Home Agent : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
|
||||
tmp = ipmipmn_api_cli_node_get_home_agent_pending(node);
|
||||
if (tmp != 0)
|
||||
ipcom_printf(" Pending Home Agent : %s"IP_LF, ipmip_ntop_inet(proc, tmp));
|
||||
|
||||
ipcom_printf(" Reverse Tunnel : %s"IP_LF, ipmipmn_api_cli_node_get_tunnel_reverse(node)? "yes" : "no");
|
||||
ipcom_printf(" Broadcast : %s"IP_LF, ipmipmn_api_cli_node_get_receive_broadcast(node)? "yes" : "no");
|
||||
ipcom_printf(" Home Agent Discovery: %s"IP_LF, ipmipmn_api_attr_dhaa[ipmipmn_api_cli_node_get_home_agent_dhaa(node)]);
|
||||
|
||||
|
||||
ipcom_printf(" Tunnel type : %s"IP_LF, ipmip_util_tunnel_to_desc(ipmipmn_api_cli_node_get_tunnel_type(node)));
|
||||
|
||||
str = ipmipmn_api_cli_node_get_nai(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Mobile Node NAI : %s"IP_LF, str);
|
||||
|
||||
if (status >= IPMIPMN_ATTR_STATE_REGISTERED)
|
||||
{
|
||||
ipcom_printf(" Established : %s"IP_LF, ipmip_ntop_tm(proc, ipmipmn_api_cli_node_get_created(node)));;
|
||||
ipcom_printf(" Updated : %s"IP_LF, ipmip_ntop_tm(proc, ipmipmn_api_cli_node_get_last_updated(node)));
|
||||
|
||||
ipcom_printf(" Lifetime : %u/%u"IP_LF, ipmipmn_api_cli_node_get_time_remaining(node), ipmipmn_api_cli_node_get_time_requested(node));
|
||||
|
||||
str = ipmipmn_api_cli_node_get_nai_ha(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" Home Agent NAI : %s"IP_LF, str);
|
||||
str = ipmipmn_api_cli_node_get_nai_aaah(node);
|
||||
if (str != IP_NULL)
|
||||
ipcom_printf(" AAAH Agent NAI : %s"IP_LF, str);
|
||||
}
|
||||
|
||||
/* Current care of? */
|
||||
if (coa != IP_NULL)
|
||||
{
|
||||
ipcom_printf(" Care Of Address :"IP_LF);
|
||||
ipcom_printf(" CoA Type : %s"IP_LF, ipmipmn_api_attr_coaname[ipmipmn_api_cli_node_coa_get_type(coa)]);
|
||||
ipcom_printf(" CoA Peer : %s"IP_LF, ipmipmn_api_attr_peername[ipmipmn_api_cli_node_coa_get_peer(coa)]);
|
||||
ipcom_printf(" CoA Address : %s"IP_LF, ipmip_ntop_inet(proc, ipmipmn_api_cli_node_coa_get_address(coa)));
|
||||
ipcom_printf(" Challenge : %s"IP_LF, ipmipmn_api_cli_node_coa_get_challenge(coa)? "yes" : "no");
|
||||
|
||||
tmp = ipmipmn_api_cli_node_coa_get_tunnel_flags(coa);
|
||||
ipcom_printf(" NAT Traversal : %s"IP_LF, IP_BIT_ARESET(tmp, IPMIP4_TUNNELMODE_NAT_T_CONFIRMED)? "yes" : "no");
|
||||
ipcom_printf(" Reg. Revocation : %s"IP_LF, IP_BIT_ARESET(tmp, IPMIP4_TUNNELMODE_REVOCATION_CONFIRMED)? "yes" : "no");
|
||||
ipcom_printf(" Retransmits : %u"IP_LF, ipmipmn_api_cli_node_coa_get_retransmits(coa));
|
||||
|
||||
tmp = ipmipmn_api_cli_node_coa_get_spi_mf(coa);
|
||||
if (tmp)
|
||||
ipcom_printf(" SPI MF : %u"IP_LF, tmp);
|
||||
tmp = ipmipmn_api_cli_node_coa_get_spi_mh(coa);
|
||||
if (tmp)
|
||||
ipcom_printf(" SPI MH : %u"IP_LF, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_cmd_print_event
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_cmd_handle_exec(Ipmip_proc_t *proc,
|
||||
Ipmip_cli_daemon_t *daemon,
|
||||
Ip_u32 handle,
|
||||
Ip_u32 cmd,
|
||||
Ip_bool verbose)
|
||||
{
|
||||
struct Ipmip_attr *node;
|
||||
Ipmip_cli_daemon_req_t nreq;
|
||||
|
||||
ipmip_cli_daemon_request_init(&nreq);
|
||||
|
||||
if (cmd == IPMIPPM_CMD_OP_DELETE)
|
||||
ipmippm_cli_node_delete(daemon, handle);
|
||||
else if ((node = ipmippm_cli_node_get(daemon, &nreq, handle)) != IP_NULL)
|
||||
{
|
||||
struct Ipmip_attr *coa = ipmipmn_api_cli_node_coa_get(node);
|
||||
if(IP_NULL == coa)
|
||||
return;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case IPMIPPM_CMD_OP_LIST:
|
||||
ipmippm_cmd_print_node(proc, node, coa, verbose);
|
||||
break;
|
||||
case IPMIPPM_CMD_OP_SHOW:
|
||||
ipmippm_cmd_show_node(proc, node, coa, verbose);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ipmip_cli_daemon_request_release(&nreq);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_cmd_mn
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters: .
|
||||
* Returns: .
|
||||
*
|
||||
*/
|
||||
IP_PUBLIC int
|
||||
ipmippm_cmd_pm(int argc, char **argv)
|
||||
{
|
||||
Ipcom_getopt opt;
|
||||
int op_val;
|
||||
char *op;
|
||||
Ipmip_cli_daemon_t daemon;
|
||||
Ipmip_cli_daemon_req_t req;
|
||||
Ipmip_proc_t *proc = IP_NULL;
|
||||
int i;
|
||||
|
||||
daemon.fd = IP_INVALID_SOCKET;
|
||||
|
||||
ipmip_cli_daemon_request_init(&req);
|
||||
|
||||
proc = ipmip_proc_alloc();
|
||||
if (proc == IP_NULL)
|
||||
{
|
||||
ipcom_printf("mn: failed to create process context"IP_LF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc < 2)
|
||||
goto usage;
|
||||
|
||||
|
||||
/* Get a connection to the home agent. */
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (ipmippm_cli_connect(&daemon))
|
||||
break;
|
||||
ipcom_sleep(1);
|
||||
}
|
||||
|
||||
if (daemon.fd == IP_INVALID_SOCKET)
|
||||
{
|
||||
ipcom_printf("pm: failed to connect to proxy client"IP_LF);
|
||||
ipmip_proc_destroy(proc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ipcom_getopt_clear_r(&opt);
|
||||
|
||||
op = argv[1];
|
||||
op_val = ipcom_cmd_str_to_key(ipmippm_cmd_ops, op);
|
||||
|
||||
if (op_val == -1)
|
||||
{
|
||||
if (ipmip4_cli_shell_cmd(argc, argv, proc, &daemon) == -1)
|
||||
{
|
||||
ipcom_printf("'%s' is an invalid operation"IP_LF, op);
|
||||
goto usage;
|
||||
}
|
||||
goto exit_out;
|
||||
}
|
||||
|
||||
|
||||
if (op_val == IPMIPPM_CMD_OP_LIST ||
|
||||
op_val == IPMIPPM_CMD_OP_SHOW ||
|
||||
op_val == IPMIPPM_CMD_OP_DELETE)
|
||||
{
|
||||
/* Show node information */
|
||||
Ip_bool all = IP_FALSE;
|
||||
Ip_bool verbose = IP_FALSE;
|
||||
const char *nai = IP_NULL;
|
||||
Ip_u32 hoa = 0;
|
||||
int args = 0;
|
||||
int ret = IPCOM_SUCCESS;
|
||||
static struct Ip_option long_options[] =
|
||||
{
|
||||
{"hoa", 1, 0, 0},
|
||||
{"nai", 1, 0, 0},
|
||||
{"all", 0, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
opt.long_only = 1;
|
||||
opt.long_options = long_options;
|
||||
|
||||
while ((i = ipcom_getopt_r(argc - 1, argv + 1, "av", &opt)) != -1)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
switch(opt.long_index)
|
||||
{
|
||||
case 0:
|
||||
/* hoa -- Home Address */
|
||||
args++;
|
||||
if (ipcom_inet_pton(IP_AF_INET, opt.optarg, &hoa) != 1)
|
||||
{
|
||||
ipcom_printf("bad '--hoa' IPv4 address."IP_LF);
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* nai */
|
||||
args++;
|
||||
nai = opt.optarg;
|
||||
break;
|
||||
case 2:
|
||||
args++;
|
||||
all = IP_TRUE;
|
||||
break;
|
||||
case 3:
|
||||
verbose = IP_TRUE;
|
||||
break;
|
||||
default:
|
||||
ipcom_printf("unknown option %s", long_options[opt.long_index].name);
|
||||
if (opt.optarg)
|
||||
ipcom_printf(" with arg %s", opt.optarg);
|
||||
ipcom_printf(IP_LF);
|
||||
goto usage;
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
args++;
|
||||
all = IP_TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
verbose = IP_TRUE;
|
||||
break;
|
||||
default:
|
||||
ipcom_printf("fa: invalid option '%c'"IP_LF, i);
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
|
||||
if (op_val == IPMIPPM_CMD_OP_LIST)
|
||||
ipmippm_cmd_print_binding_fmt("Home Address",
|
||||
"Care of Address",
|
||||
"Home Agent",
|
||||
"Lifetime",
|
||||
"NAI");
|
||||
|
||||
if (args > 0)
|
||||
{
|
||||
if (all)
|
||||
ret = ipmippm_cli_node_list(&daemon, &req, IP_NULL, 0);
|
||||
else if (args)
|
||||
ret = ipmippm_cli_node_list(&daemon, &req, nai, hoa);
|
||||
|
||||
if (ret == IPCOM_SUCCESS)
|
||||
{
|
||||
Ipmip_attr_iter_t riter;
|
||||
Ip_u32 handle;
|
||||
|
||||
/**/
|
||||
ipmip_cli_daemon_iter_request_init(&req, &riter);
|
||||
while ((handle = ipmippm_cli_handle_next(&riter)) != 0)
|
||||
ipmippm_cmd_handle_exec(proc, &daemon, handle, op_val, verbose);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = opt.optind + 1; i < argc; i++)
|
||||
ipmippm_cmd_handle_exec(proc, &daemon, ipcom_strtoul(argv[i], IP_NULL, 0), op_val, verbose);
|
||||
}
|
||||
}
|
||||
|
||||
exit_out:
|
||||
ipmip_cli_daemon_disconnect(&daemon);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
ipmip_proc_destroy(proc);
|
||||
return 0;
|
||||
|
||||
/****** Usage ******/
|
||||
usage:
|
||||
ipmip_util_identprintf(proc, 0, "NAME"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1, "pm - Displays Proxy Mobile Node bindings, statistics and status" IP_LF);
|
||||
ipmip_util_identprintf(proc, 0, "SYNOPSIS"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1, "pm <command> [arguments]"IP_LF);
|
||||
ipmip_util_identprintf(proc, 0, "DESCRIPTION"IP_LF);
|
||||
ipmip_util_identprintf(proc, 1,
|
||||
"The pm command version %u.%u.%u is used to display current Proxy Mobile Node MIPv4"IP_LF
|
||||
"bindings, statistics and status."IP_LF,
|
||||
(IPMIPPM_RELEASE / 10000) % 100, (IPMIPPM_RELEASE / 100) % 100, IPMIPPM_RELEASE % 100);
|
||||
ipmip_util_identprintf(proc, 0, "COMMANDS"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "show [--all] [--verbose] [--hoa=<hoa>] [--nai=<nai>] [<handle>]", "Show the proxy mobile node status");
|
||||
ipmip_util_identprintf(proc, 2, "--verbose Verbose mode"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--all Affect all nodes"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--hoa=<hoa> Specify the hoa we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--nai=<nai> Specify the nai we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "<handle> The unique handle for the proxy mobile node"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "delete [--all] [--hoa=<hoa>] [--nai=<nai>] [<handle>]", "Delete the proxy mobile node status");
|
||||
ipmip_util_identprintf(proc, 2, "--all Affect all nodes"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--hoa=<hoa> Specify the hoa we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--nai=<nai> Specify the nai we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "<handle> The unique handle for the proxy mobile node"IP_LF);
|
||||
ipmip_util_cmdprintf(proc, 1, "list [--all] [--hoa=<hoa>] [--nai=<nai>] [<handle>]", "List the proxy mobile nodes");
|
||||
ipmip_util_identprintf(proc, 2, "--all Affect all nodes"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--hoa=<hoa> Specify the hoa we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "--nai=<nai> Specify the nai we're looking for"IP_LF);
|
||||
ipmip_util_identprintf(proc, 2, "<handle> The unique handle for the proxy mobile node"IP_LF);
|
||||
ipmip4_cli_shell_usage(proc);
|
||||
|
||||
ipmip_cli_daemon_disconnect(&daemon);
|
||||
ipmip_cli_daemon_request_release(&req);
|
||||
ipmip_proc_destroy(proc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_h.h,v $ $Revision: 1.5 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_h.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-23 15:19:27 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPPM_H_H
|
||||
#define IPMIPPM_H_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPMIPPM_SHUTDOWN_REG (1 << 0)
|
||||
|
||||
#define IPMIPPM_SHUTDOWN_ALL (IPMIPPM_SHUTDOWN_REG)
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_client_conf;
|
||||
|
||||
/* All configuration collected */
|
||||
typedef struct Ipmippm_conf
|
||||
{
|
||||
Ipcom_list if_head;
|
||||
}
|
||||
Ipmippm_conf_t;
|
||||
|
||||
|
||||
typedef struct Ipmippm_context
|
||||
{
|
||||
Ipmipmn_api_context_t api;
|
||||
|
||||
/* Configuration */
|
||||
struct Ipmippm_conf *conf;
|
||||
struct Ipmip_context_id *idents;
|
||||
|
||||
/* */
|
||||
Ip_u32 clients;
|
||||
|
||||
Ip_u32 shutdown;
|
||||
|
||||
/* Lock to protect nodes */
|
||||
Ipcom_mutex attr_lock;
|
||||
}
|
||||
Ipmippm_context_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmipmn_api_extension;
|
||||
|
||||
IP_GLOBAL void ipmippm_main(void);
|
||||
IP_GLOBAL Ip_u32 ipmippm_context_register_function(struct Ipmipmn_api_extension *srv);
|
||||
IP_GLOBAL void ipmippm_msgext_vendor_parse_ext_register(struct Ipmip4_msgext_vendor_parse_ext *pext);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,398 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_if.c,v $ $Revision: 1.2.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_if.c,v $
|
||||
* $Author: jsheng $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmippm_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_syslog.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_auth.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_h.h"
|
||||
#include "ipmippm_attr_h.h"
|
||||
#include "ipmippm_client.h"
|
||||
#include "ipmippm_if.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_client_key_hash_nai
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC unsigned
|
||||
ipmippm_if_client_key_hash_nai(Ipmippm_client_key_t *key)
|
||||
{
|
||||
/* Do the hash from the subtype and forward */
|
||||
return ipcom_hash_update(key->nai.iov_base, key->nai.iov_len, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_client_obj_hash_nai
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC unsigned
|
||||
ipmippm_if_client_obj_hash_nai(Ipmippm_client_t *client)
|
||||
{
|
||||
return ipcom_hash_update(IPMIP4_MSGEXT_SHDR_EXT_DATA(client->api.params.nai_mn), IPMIP4_MSGEXT_SHDR_EXT_SIZE(client->api.params.nai_mn), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_client_cmp_nai
|
||||
*===========================================================================
|
||||
* Description:
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmippm_if_client_cmp_nai(Ipmippm_client_t *client, Ipmippm_client_key_t *key)
|
||||
{
|
||||
if (key->nai.iov_len == IPMIP4_MSGEXT_SHDR_EXT_SIZE(client->api.params.nai_mn))
|
||||
{
|
||||
if (ipcom_memcmp(key->nai.iov_base, IPMIP4_MSGEXT_SHDR_EXT_DATA(client->api.params.nai_mn), key->nai.iov_len) == 0)
|
||||
{
|
||||
/* */
|
||||
if (client->access_type == 0 || key->access_type == 0 || client->access_type == key->access_type)
|
||||
return IP_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_if_delete
|
||||
*===========================================================================
|
||||
* Description: Delete an interface
|
||||
* Parameters: iff - The interface to delete.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_if_delete(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_if_t *iff)
|
||||
{
|
||||
/* Destroy the lock */
|
||||
/* Allocate the hash tables */
|
||||
ipcom_hash_delete(iff->hash_nai);
|
||||
|
||||
/* Create the locks & blocks */
|
||||
ipcom_mutex_delete(&iff->client_lock);
|
||||
|
||||
if (iff->if_lock)
|
||||
ipmip_timer_lock_destroy(&data->api.ipmip4.ipmip, proc, iff->if_lock);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_if_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate a specified interface, and verify arch specific
|
||||
* data.
|
||||
* Parameters: data - The FA data structure.
|
||||
* ifname - The interface name.
|
||||
* Returns: The interface structure if successfull; IP_NULL otherwise.
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmippm_if_t *
|
||||
ipmippm_if_alloc(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
const char *ifname)
|
||||
{
|
||||
/* Allocate an interface structure */
|
||||
Ipmippm_if_t *iff = IP_NULL;
|
||||
Ip_u32 ifindex;
|
||||
|
||||
ifindex = ipcom_if_nametoindex(ifname);
|
||||
if (ifindex == 0)
|
||||
{
|
||||
IPMIP4_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"Configuration failed, due to unknown interface '%s'",
|
||||
ifname));
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
/* Allocate the structure */
|
||||
iff = (Ipmippm_if_t*)ipmip4_if_alloc(&data->api.ipmip4,
|
||||
proc,
|
||||
sizeof(*iff),
|
||||
ifname,
|
||||
ifindex,
|
||||
IPMIP_IF_TYPE_GENERIC,
|
||||
0,
|
||||
(Ipmip_if_cleanup_t )ipmippm_if_delete);
|
||||
|
||||
/* Sanity */
|
||||
if (iff == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/* Allocate the hash tables */
|
||||
iff->hash_nai = ipcom_hash_new((Ipcom_hash_obj_func) ipmippm_if_client_obj_hash_nai,
|
||||
(Ipcom_hash_key_func) ipmippm_if_client_key_hash_nai,
|
||||
(Ipcom_hash_cmp_func) ipmippm_if_client_cmp_nai);
|
||||
|
||||
/* Create the locks & blocks */
|
||||
(void)ipcom_mutex_create(&iff->client_lock);
|
||||
|
||||
/* Return the interface structure */
|
||||
return iff;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_if_configure
|
||||
*===========================================================================
|
||||
* Description: Post creation configuration
|
||||
* Parameters: data - The data
|
||||
* proc - Current process
|
||||
* iff - The interface we're configuring.
|
||||
* conf - The configuration context.
|
||||
* Returns: IP_TRUE if successful
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmippm_if_configure(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_if_t *iff)
|
||||
{
|
||||
/* If we don't have the FA address, try resolve it */
|
||||
if (iff->iff.ifaddr == 0)
|
||||
{
|
||||
/* Store extracted address */
|
||||
iff->iff.ifaddr = ipmip4_if_get_primary_address(&data->api.ipmip4, proc, &iff->iff);
|
||||
|
||||
/* Sanity */
|
||||
if (iff->iff.ifaddr == IP_INADDR_NONE ||
|
||||
iff->iff.ifaddr == IP_INADDR_ANY)
|
||||
{
|
||||
IPMIP4_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"auto-configuring: FAIL, %s returned for interface '%s'",
|
||||
ipmip_ntop_inet(proc, iff->iff.ifaddr),
|
||||
iff->iff.ipmip.ifname));
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
/**/
|
||||
IPMIP4_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"auto-configuring: interface '%s' configured to use %s",
|
||||
iff->iff.ipmip.ifname,
|
||||
ipmip_ntop_inet(proc, iff->iff.ifaddr)));
|
||||
}
|
||||
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_if_create
|
||||
*===========================================================================
|
||||
* Description: Create an interface for a specified configuration.
|
||||
* Parameters: data - The FA entity.
|
||||
* proc - Current process.
|
||||
* conf - The current configuration.
|
||||
* ifname - The name of the interface.
|
||||
* Returns: IP_TRUE if successful.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool
|
||||
ipmippm_if_create(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_conf_t *conf,
|
||||
const char *ifname)
|
||||
{
|
||||
Ipmippm_if_t *iff;
|
||||
char spec[IP_IFNAMSIZ + 6];
|
||||
|
||||
|
||||
/* Try create the interface in question */
|
||||
if ((iff = ipmippm_if_alloc(data,proc,ifname)) == IP_NULL)
|
||||
return IP_FALSE;
|
||||
|
||||
/* Store it */
|
||||
ipcom_list_insert_first(&conf->if_head, &iff->iff.ipmip.next);
|
||||
|
||||
/* Initialize the lock */
|
||||
iff->if_lock = ipmip_timer_lock_alloc(&data->api.ipmip4.ipmip, proc, IP_NULL, IP_NULL);
|
||||
|
||||
iff->conf = ipcom_calloc(1, sizeof(*iff->conf));
|
||||
if(IP_NULL == iff->conf)
|
||||
return IP_FALSE;
|
||||
|
||||
iff->conf->iff = iff;
|
||||
|
||||
ipmip_sysvar_inet(0, &iff->iff.ifaddr, IP_NULL, "ipmippm.if.%s.address", iff->iff.ipmip.ifname);
|
||||
|
||||
if (!ipmippm_if_configure(data, proc, iff))
|
||||
goto fail;
|
||||
|
||||
ipcom_snprintf(spec, sizeof(spec), "if.%s.", ifname);
|
||||
|
||||
if (!ipmipmn_api_node_config_read(&data->api, proc, &iff->conf->api, "ipmippm", spec))
|
||||
{
|
||||
IPMIP4_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"unable to read configuration for %s",
|
||||
ifname));
|
||||
goto fail;
|
||||
|
||||
}
|
||||
|
||||
return IP_TRUE;
|
||||
fail:
|
||||
ipmip_if_free(&data->api.ipmip4.ipmip, proc, &iff->iff.ipmip);
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmipfa_if_start
|
||||
*===========================================================================
|
||||
* Description: Start an interface for a specified configuration.
|
||||
* Parameters: data - The FA entity.
|
||||
* proc - Current process.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmippm_if_stop(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_conf_t *conf)
|
||||
{
|
||||
Ipmippm_if_t *iff;
|
||||
|
||||
/* Send instant RtAdv on all active interfaces */
|
||||
while (IP_NULL != (iff = IPCOM_LIST_FIRST(&conf->if_head)))
|
||||
{
|
||||
ipmipmn_api_node_config_free(&data->api, proc, &iff->conf->api);
|
||||
ipmip_if_free(&data->api.ipmip4.ipmip, proc, &iff->iff.ipmip);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,154 @@
|
||||
/* ipmippm_if.h - ipmippm_if.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_if.h,v $ $Revision: 1.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_if.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-23 15:19:27 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPPM_IFF_H
|
||||
#define IPMIPPM_IFF_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmip4_if.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmippm_context;
|
||||
struct Ipmippm_client_conf;
|
||||
struct Ipmip_proc;
|
||||
|
||||
/* one per interface */
|
||||
typedef struct Ipmipmn_api_iff
|
||||
{
|
||||
Ipmip4_if_t iff;
|
||||
|
||||
Ipmip_timer_lock_t *if_lock;
|
||||
|
||||
/* Client lookup structures */
|
||||
Ipcom_mutex client_lock;
|
||||
Ipcom_hash *hash_nai; /* All known MN using NAI address as key */
|
||||
|
||||
/**/
|
||||
struct Ipmippm_client_conf *conf;
|
||||
}
|
||||
Ipmippm_if_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_if_create - ipmippm_if_create
|
||||
*
|
||||
* Create an interface for a specified configuration.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The FA entity.
|
||||
* \i proc
|
||||
* Current process.
|
||||
* \i conf
|
||||
* The current configuration.
|
||||
* \i ifname
|
||||
* The name of the interface.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: IP_TRUE if successful.
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipmippm_if_create
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_conf *conf,
|
||||
const char *ifname
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_if_stop - ipmippm_if_stop
|
||||
*
|
||||
* Stop the interfaces belonging to a particular configuration
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* The FA entity.
|
||||
* \i proc
|
||||
* Current process
|
||||
* \i conf
|
||||
* The current configuration.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_if_stop
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_conf *conf
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,571 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_main.c,v $ $Revision: 1.8.16.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_main.c,v $
|
||||
* $Author: jsheng $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Niklas Lundberg <n@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
*******************************************************************************
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include "ipmippm_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_drv_eth_filter.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_hash.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_sysctl.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_netif.h>
|
||||
#include <ipcom_sysvar.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_radius.h>
|
||||
|
||||
#include <private/ipmipmn_api.h>
|
||||
|
||||
#include "ipmippm.h"
|
||||
#include "ipmippm_h.h"
|
||||
#include "ipmippm_reg.h"
|
||||
#include "ipmippm_client.h"
|
||||
#include "ipmippm_attr_h.h"
|
||||
#include "ipmippm_if.h"
|
||||
#include "ipmippm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* Application datatypes
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_PUBLIC Ip_err ipmippm_configure(void);
|
||||
IP_PUBLIC Ip_err ipmippm_init(void);
|
||||
IP_PUBLIC Ip_err ipmippm_exit(void);
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
static int ipmippm_instances = 0;
|
||||
static Ipcom_once_t ipmippm_extensions_once = IPCOM_ONCE_INIT;
|
||||
static Ipmipmn_api_function_context_t ipmippm_extensions;
|
||||
static Ipcom_list ipmippm_msgext_vendor_extensions;
|
||||
static Ipmip_pktbuf_pktaux_t ipmippm_pktaux;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
IP_STATIC Ip_err
|
||||
ipmippm_main_once_init(void *unused)
|
||||
{
|
||||
int f;
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(unused);
|
||||
|
||||
/* Clear */
|
||||
ipcom_memset(&ipmippm_extensions, 0, sizeof(ipmippm_extensions));
|
||||
ipcom_memset(&ipmippm_pktaux, 0, sizeof(ipmippm_pktaux));
|
||||
ipcom_list_init(&ipmippm_msgext_vendor_extensions);
|
||||
|
||||
/* Must be first */
|
||||
ipmippm_reg_register_service();
|
||||
|
||||
/* Indicate the elements */
|
||||
/* Do service init */
|
||||
for (f = 0; ipmippm_function_registrations[f] != IP_NULL; f++)
|
||||
(*ipmippm_function_registrations[f]) ();
|
||||
|
||||
return IPCOM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmippm_config_free(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc,
|
||||
Ipmippm_conf_t *conf)
|
||||
{
|
||||
ipmippm_if_stop(data, proc, conf);
|
||||
|
||||
/**/
|
||||
ipcom_free(conf);
|
||||
}
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_exit_agent
|
||||
*===========================================================================
|
||||
* Description: Cleanup the resources allocated by this FA entity.
|
||||
* Parameters: data - The FA entity structure.
|
||||
* proc - Current process
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_exit_agent(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
/* Sanity */
|
||||
if (data == IP_NULL)
|
||||
return;
|
||||
|
||||
/* Stop the context */
|
||||
ipmip4_context_stop(&data->api.ipmip4, proc);
|
||||
|
||||
/* Destroy any node context */
|
||||
ipmippm_client_context_destroy(data, proc);
|
||||
|
||||
/* Exit the IPD */
|
||||
if (data->api.fd_ipd == IP_INVALID_SOCKET)
|
||||
(void)ipcom_ipd_init("ipmippm", IPCOM_ERR_FAILED, &data->api.fd_ipd);
|
||||
|
||||
(void)ipcom_ipd_exit("ipmippm", data->api.fd_ipd);
|
||||
|
||||
/**/
|
||||
ipcom_mutex_delete(&data->attr_lock);
|
||||
|
||||
ipmip_context_id_destroy(data->idents);
|
||||
|
||||
/* Free the context */
|
||||
ipmip4_context_destroy(&data->api.ipmip4, proc);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_init_agent
|
||||
*===========================================================================
|
||||
* Description: Allocate and initialize a FA entity structure.
|
||||
* Parameters: proc - Current process
|
||||
* Returns: The new FA entity structure if successful.
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ipmippm_context_t *
|
||||
ipmippm_init_agent(Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmippm_context_t *data;
|
||||
|
||||
(void)IPMIP_ONCE(&ipmippm_extensions_once, ipmippm_main_once_init, IP_NULL);
|
||||
|
||||
data = (Ipmippm_context_t *) ipmip_context_alloc(proc, sizeof(*data), "ipmippm", IPMIP4_SYSTEM_PRIORITY, IPMIPPM_EVENT_BACKLOG);
|
||||
if (data == IP_NULL)
|
||||
return IP_NULL;
|
||||
|
||||
/* Add */
|
||||
data->api.functions = &ipmippm_extensions;
|
||||
data->api.ipmip4.vendor_extensions = &ipmippm_msgext_vendor_extensions;
|
||||
data->api.ipmip4.ipmip.pktaux = &ipmippm_pktaux;
|
||||
|
||||
ipmip4_context_init(&data->api.ipmip4, proc);
|
||||
|
||||
/* Initialize file descriptors */
|
||||
data->api.fd_ipd = IP_INVALID_SOCKET;
|
||||
|
||||
IPCOM_LOG1(INFO, "IPMIPPM starting [VR %d]", data->api.ipmip4.ipmip.vr);
|
||||
|
||||
(void)ipcom_mutex_create(&data->attr_lock);
|
||||
|
||||
data->idents = ipmip_context_id_create(ip_offsetof(Ipmippm_client_t, pmClientIdentity), 0xFFFFFFFF);
|
||||
|
||||
/* IPD init. */
|
||||
if (ipcom_ipd_init("ipmippm", IPCOM_SUCCESS, &data->api.fd_ipd) != IPCOM_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
ipmipmn_api_init(&data->api,
|
||||
proc,
|
||||
&ipmippm_client_func,
|
||||
&ipmippm_client_state_func);
|
||||
|
||||
/* Init data */
|
||||
ipmippm_client_context_init(data, proc);
|
||||
|
||||
ipmip_cli_context_create(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"ipmippm",
|
||||
IPCOM_IPD_ID_IPMIPPM,
|
||||
(Ipmip_cli_callback_t)ipmippm_attr_command);
|
||||
|
||||
/* Create the packet buffer context */
|
||||
ipmip_pktbuf_context_create(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
(Ipmip_pkt_buf_alloc_t)ipmippm_pktbuf_alloc,
|
||||
(Ipmip_pkt_buf_free_t)ipmippm_pktbuf_free);
|
||||
|
||||
/**/
|
||||
ipmip4_pkt_context_create(&data->api.ipmip4,
|
||||
proc,
|
||||
0,
|
||||
IP_NULL,
|
||||
IP_NULL,
|
||||
IP_NULL);
|
||||
|
||||
return data;
|
||||
|
||||
fail:
|
||||
ipmippm_exit_agent(data, proc);
|
||||
return IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_config_exit
|
||||
*===========================================================================
|
||||
* Description: Clear out a configuration structure, free any resources
|
||||
* associated with it.
|
||||
* Parameters: data - The FA entity it belongs to
|
||||
* proc - The process
|
||||
* conf - The configuration structure.
|
||||
* Returns:
|
||||
*/
|
||||
IP_STATIC void
|
||||
ipmippm_config_exit(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
if (data->conf == IP_NULL)
|
||||
return;
|
||||
|
||||
/* Free all mobile nodes */
|
||||
ipmippm_client_clear(data, proc);
|
||||
|
||||
/**/
|
||||
ipmip4_context_stop(&data->api.ipmip4, proc);
|
||||
|
||||
/* Free the configuration */
|
||||
ipmippm_config_free(data, proc, data->conf);
|
||||
|
||||
data->conf = IP_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_config_init
|
||||
*===========================================================================
|
||||
* Description: Setup MIP ha after config has been read.
|
||||
* Parameters: data - The FA data entity.
|
||||
* proc - The process
|
||||
* Returns: -1 on error; 0 otherwise.
|
||||
*
|
||||
*/
|
||||
IP_STATIC int
|
||||
ipmippm_config_init(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
Ipmippm_conf_t *conf = ipcom_calloc(1, sizeof(*conf));
|
||||
char **arr = IP_NULL;
|
||||
|
||||
if (conf == IP_NULL)
|
||||
return -IP_ERRNO_ENOMEM;
|
||||
|
||||
ipcom_list_init(&conf->if_head);
|
||||
|
||||
ipmippm_config_exit(data, proc);
|
||||
|
||||
arr = ipmip_sysvar_strarr("ipmippm.interfaces");
|
||||
if (arr == IP_NULL)
|
||||
{
|
||||
IPMIP4_EVENT_IF(ERR, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"Bad configuration. Invalid/missing \"ipmippm.interfaces\""));
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; arr[i] != IP_NULL; i++)
|
||||
{
|
||||
/* If I can't create the interface, exit */
|
||||
if (ipmippm_if_create(data, proc, conf, arr[i]) == IP_FALSE)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reconfigure (existing config was in place) */
|
||||
data->conf = conf;
|
||||
|
||||
ipmip4_context_start(&data->api.ipmip4, proc);
|
||||
ipcom_free(arr);
|
||||
return 0;
|
||||
fail:
|
||||
if (arr)
|
||||
ipcom_free(arr);
|
||||
ipmippm_config_free(data, proc, conf);
|
||||
ipmip_context_start(&data->api.ipmip4.ipmip, proc);
|
||||
return -IP_ERRNO_EINVAL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_data_process
|
||||
*===========================================================================
|
||||
* Description: Process any file descriptors set by the platform.
|
||||
* Parameters: data - The data structure
|
||||
* rset - The read set.
|
||||
* Returns: IP_FALSE if we should exit the process.
|
||||
*
|
||||
*/
|
||||
IP_STATIC Ip_bool
|
||||
ipmippm_ipd_process(Ipmippm_context_t *data,
|
||||
Ipmip_proc_t *proc)
|
||||
{
|
||||
/* IPD input. */
|
||||
int event;
|
||||
Ip_ssize_t len;
|
||||
Ipmippm_pktbuf_t *pbuf = (Ipmippm_pktbuf_t *)ipmip_pktbuf_alloc(&data->api.ipmip4.ipmip, proc, 512);
|
||||
|
||||
if (pbuf == IP_NULL)
|
||||
return IP_TRUE;
|
||||
|
||||
len = ipcom_ipd_read(data->api.fd_ipd, IPMIP_BUFFER_PTR(&pbuf->api.ipmip4.ipmip.packet), 512, &event);
|
||||
if (len < 0)
|
||||
{
|
||||
IPCOM_LOG2(ERR, "ipcom_socketread(IPD) failed : %s [%d]",
|
||||
ipcom_strerror(ipcom_errno), ipcom_errno);
|
||||
ipmip_util_sock_clear(data->api.fd_ipd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Advance past */
|
||||
ipmip_buffer_append(&pbuf->api.ipmip4.ipmip.packet, IP_NULL, len);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case IPCOM_IPD_EVENT_RECONFIGURE:
|
||||
IPCOM_LOG0(INFO, "Received IPD reconfigure message");
|
||||
if (ipmippm_config_init(data, proc) != 0)
|
||||
IPCOM_LOG0(ERR, "invalid new configuration - reconfigure failed");
|
||||
break;
|
||||
|
||||
case IPCOM_IPD_EVENT_KILL:
|
||||
IPCOM_LOG0(INFO, "Received IPD kill message");
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
return IP_FALSE;
|
||||
default:
|
||||
/* Ignore all other IPD messages */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ipmip_pktbuf_release(&data->api.ipmip4.ipmip, proc, &pbuf->api.ipmip4.ipmip);
|
||||
return IP_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippmd
|
||||
*===========================================================================
|
||||
* Description: The main process.
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmippm_main(void)
|
||||
{
|
||||
Ipmippm_context_t *data = IP_NULL;
|
||||
Ipmip_proc_t *proc;
|
||||
|
||||
ipcom_proc_init();
|
||||
|
||||
/* Get me a process context for this thread */
|
||||
proc = ipmip_proc_alloc();
|
||||
if(IP_NULL == proc)
|
||||
{
|
||||
ipcom_proc_exit();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Init IPMIPFA */
|
||||
if (ipmippm_instances++ == 0)
|
||||
(void)ipmippm_init();
|
||||
|
||||
/* Configure IPMIPFA. */
|
||||
if (ipmippm_configure() != IPCOM_SUCCESS)
|
||||
goto end;
|
||||
|
||||
/* Init IPMIPFA data. */
|
||||
if ((data = ipmippm_init_agent(proc)) == IP_NULL)
|
||||
goto end;
|
||||
|
||||
/* Init FA from configuration. */
|
||||
if (ipmippm_config_init(data, proc) != 0)
|
||||
{
|
||||
IPCOM_LOG0(WARNING,
|
||||
"PM not properly configured -- update the required sysvars and reconfigure");
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int num;
|
||||
int max_fd;
|
||||
Ip_fd_set read_set;
|
||||
|
||||
IP_FD_ZERO(&read_set);
|
||||
|
||||
/* Set the IPD */
|
||||
max_fd = data->api.fd_ipd;
|
||||
IP_FD_SET(data->api.fd_ipd, &read_set);
|
||||
|
||||
/* Select */
|
||||
num = ipcom_socketselect(max_fd + 1, &read_set, IP_NULL, IP_NULL, IP_NULL);
|
||||
|
||||
switch(num)
|
||||
{
|
||||
case -1: /* socket error. */
|
||||
IPCOM_LOG2(WARNING, "ipcom_socketselect() failed : %s [%d]", ipcom_strerror(ipcom_errno), ipcom_errno);
|
||||
(void)ipcom_sleep(1);
|
||||
break;
|
||||
|
||||
case 0: /* timeout, not used. triggered by bug in linux glibc if compiled with nptl */
|
||||
(void)ipcom_millisleep(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Process IPD */
|
||||
if (IP_FD_ISSET(data->api.fd_ipd, &read_set))
|
||||
{
|
||||
if (ipmippm_ipd_process(data, proc) == IP_FALSE)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
/* If we've gotten the data, clear it */
|
||||
if (data != IP_NULL)
|
||||
{
|
||||
ipmippm_config_exit(data, proc);
|
||||
ipmippm_exit_agent(data, proc);
|
||||
}
|
||||
|
||||
/* Exit IPMIPFA */
|
||||
if (--ipmippm_instances == 0)
|
||||
(void)ipmippm_exit();
|
||||
|
||||
/* Free the context process */
|
||||
ipmip_proc_destroy(proc);
|
||||
|
||||
IPCOM_LOG0(INFO, "IPMIPPM ending");
|
||||
ipcom_proc_exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/* INIT FUNCTIONS */
|
||||
IP_GLOBAL Ip_u32
|
||||
ipmippm_context_register_function(Ipmipmn_api_extension_t *srv)
|
||||
{
|
||||
Ip_u32 type = ipmippm_extensions.num++;
|
||||
|
||||
/* Store values */
|
||||
srv->type = type;
|
||||
|
||||
ipmippm_extensions.mask |= (1 << type);
|
||||
|
||||
ipmippm_extensions.functions[type] = srv;
|
||||
ipmippm_extensions.node_data += srv->node_data_size;
|
||||
|
||||
/* Register payload, if requested */
|
||||
if (srv->pktaux.pktbuf_data_size != 0)
|
||||
ipmip_pktbuf_pktaux_add(&ipmippm_pktaux, &srv->pktaux);
|
||||
|
||||
/* Return the type */
|
||||
return type;
|
||||
}
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmippm_msgext_vendor_parse_ext_register(struct Ipmip4_msgext_vendor_parse_ext *pext)
|
||||
{
|
||||
/**/
|
||||
ipmip4_msgext_vendor_parse_ext_register(&ipmippm_msgext_vendor_extensions, &ipmippm_pktaux, pext);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,245 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK SOURCE FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_reg.c,v $ $Revision: 1.8 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_reg.c,v $
|
||||
* $Author: jhorteli $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipmipmn_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPCOM_USE_CLIB_PROTO
|
||||
#include <ipcom_clib.h>
|
||||
#include <ipcom_err.h>
|
||||
#include <ipcom_os.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_inet.h>
|
||||
#include <ipcom_syslog.h>
|
||||
#include <ipcom_ipd.h>
|
||||
#include <ipcom_sock.h>
|
||||
#include <ipcom_sock2.h>
|
||||
#include <ipcom_list.h>
|
||||
#include <ipcom_hash.h>
|
||||
|
||||
#include <ipmip.h>
|
||||
#include <private/ipmip_sysvar.h>
|
||||
#include <private/ipmip_timer.h>
|
||||
|
||||
#include <ipmip4.h>
|
||||
#include <private/ipmip4_lla.h>
|
||||
#include <private/ipmip4_util.h>
|
||||
#include <private/ipmip4_sysext.h>
|
||||
#include <private/ipmip4_context.h>
|
||||
#include <private/ipmip4_pkt.h>
|
||||
|
||||
#include "ipmippm_h.h"
|
||||
#include "ipmippm_client.h"
|
||||
#include "ipmippm_reg.h"
|
||||
#include "ipmippm_pktbuf.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 EXTERN PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 7 LOCAL PROTOTYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 8 DATA
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 9 STATIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_STATIC void
|
||||
ipmippm_reg_output_mobile_home(struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_client_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmippm_client *node,
|
||||
Ip_bool deregister,
|
||||
struct Ipmippm_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(conf);
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
IPMIP_UNUSED_PARAMETER(deregister);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(pbuf);
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC Ip_bool
|
||||
ipmippm_reg_input_verify(struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_client_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmippm_client *node,
|
||||
struct Ipmippm_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
IPMIP_UNUSED_PARAMETER(proc);
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(conf);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
IPMIP_UNUSED_PARAMETER(node);
|
||||
IPMIP_UNUSED_PARAMETER(pbuf);
|
||||
|
||||
return IP_FALSE;
|
||||
}
|
||||
|
||||
|
||||
IP_STATIC void
|
||||
ipmippm_reg_input_success(struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_client_conf *conf,
|
||||
void *inst_config,
|
||||
void *node_config,
|
||||
struct Ipmippm_client *node,
|
||||
struct Ipmippm_pktbuf *pbuf)
|
||||
{
|
||||
IPMIP_UNUSED_PARAMETER(inst_config);
|
||||
IPMIP_UNUSED_PARAMETER(conf);
|
||||
IPMIP_UNUSED_PARAMETER(node_config);
|
||||
|
||||
IPMIP_UNUSED_PARAMETER(data);
|
||||
|
||||
node->api.params.mnRegTunnelType = pbuf->api.reginfo.mnRegTunnelType;
|
||||
|
||||
/* Assign our home agent */
|
||||
if (node->api.params.assigned_home_agent == 0)
|
||||
{
|
||||
/**/
|
||||
node->api.params.pending_home_agent = pbuf->api.pktinfo.mnRegHomeAgentAddress;
|
||||
node->api.params.assigned_home_agent = node->api.params.pending_home_agent;
|
||||
|
||||
IPMIP4_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"%s home agent '%s' assigned",
|
||||
ipmippm_client_describe(proc, node),
|
||||
ipmip_ntop_inet(proc, node->api.params.assigned_home_agent)));
|
||||
}
|
||||
|
||||
/* Accepted */
|
||||
if (node->api.params.assigned_home_address == 0)
|
||||
{
|
||||
/* OK; ADDRESS located, store it and configure our interface */
|
||||
node->api.params.assigned_home_address = pbuf->api.pktinfo.mnRegHomeAddress;
|
||||
node->api.params.pending_home_address = pbuf->api.pktinfo.mnRegHomeAddress;
|
||||
IPMIP4_EVENT_IF(INFO, proc,
|
||||
ipmip_log_event_add(&data->api.ipmip4.ipmip,
|
||||
proc,
|
||||
"%s home address '%s' assigned",
|
||||
ipmippm_client_describe(proc, node),
|
||||
ipmip_ntop_inet(proc, pbuf->api.pktinfo.mnRegHomeAddress)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 10 GLOBAL FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
IP_GLOBAL void
|
||||
ipmippm_reg_register_service(void)
|
||||
{
|
||||
static Ipmipmn_api_extension_t ipmippm_node_ext;
|
||||
|
||||
ipcom_memset(&ipmippm_node_ext, 0, sizeof(ipmippm_node_ext));
|
||||
|
||||
ipmippm_node_ext.name = "REGISTER";
|
||||
ipmippm_node_ext.pkt_req_mobile_home = (Ipmipmn_api_extension_pkt_req_mobile_home_t)ipmippm_reg_output_mobile_home;
|
||||
ipmippm_node_ext.pkt_rep_validate = (Ipmipmn_api_extension_pkt_rep_validate_t)ipmippm_reg_input_verify;
|
||||
ipmippm_node_ext.pkt_rep_accepted = (Ipmipmn_api_extension_pkt_rep_accepted_t)ipmippm_reg_input_success;
|
||||
ipmippm_context_register_function(&ipmippm_node_ext);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipmippm_reg_recv
|
||||
*===========================================================================
|
||||
* Description: Handles registration request and reply packages.
|
||||
* Parameters: data - Context
|
||||
* proc - Current process.
|
||||
* pbuf - Packet buffer
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipmippm_reg_recv(struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
Ipmippm_pktbuf_t *pbuf)
|
||||
{
|
||||
/* Send immediately to the API input */
|
||||
ipmipmn_api_reg_recv(&data->api, proc, &pbuf->api);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 11 PUBLIC FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,109 @@
|
||||
/* ipmippm_reg.h - ipmippm_reg.h */
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmippm_reg.h,v $ $Revision: 1.4 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipmippm/src/ipmippm_reg.h,v $
|
||||
* $Author: jhorteli $ $Date: 2009-04-23 15:19:27 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPMIPPM_REG_H
|
||||
#define IPMIPPM_REG_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
|
||||
No description currently provided
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
#include <private/ipmipmn_api_reg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
struct Ipmippm_pktbuf;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipmippm_reg_recv - ipmippm_reg_recv
|
||||
*
|
||||
* Handles registration request and reply packages.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i data
|
||||
* Context
|
||||
* \i proc
|
||||
* Current process.
|
||||
* \i pbuf
|
||||
* Packet buffer
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: No return value
|
||||
*
|
||||
* ERRNO:
|
||||
*
|
||||
* \NOMANUAL
|
||||
*/
|
||||
IP_GLOBAL void ipmippm_reg_recv
|
||||
(
|
||||
struct Ipmippm_context *data,
|
||||
struct Ipmip_proc *proc,
|
||||
struct Ipmippm_pktbuf *pbuf
|
||||
);
|
||||
|
||||
|
||||
IP_GLOBAL void ipmippm_reg_register_service
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user