original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,170 @@
/* ipmip4_attr.h - ipmip4_attr.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_attr.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_attr.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_ATTR_H
#define IPMIP4_ATTR_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
MIP4 attribute functions required for mobile IPv4. Deals with retrieval
and assignment of MIPv4 specific attributes.
EXAMPLE
A basic example of how the IPMIP4 attribute function can be used. See
my_init_func in ipmip_cli.h for an example as to how to properly register
ipmip4myattr_attr_command.
.CS
/@ Define some attributes that the node have @/
enum
{
IPMIP4MYATTR_CLI_LIST = IPMIP4_CLI_BASE,
IPMIP4MYATTR_CLI_MAX
};
IP_GLOBAL int
ipmip4myattr_attr_command(struct Ipmip4my_context *ctx,
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;
unsigned int si, f;
switch (IPMIP_ATTR_HDR_TYPE(hdr))
{
case IPMIP4MYATTR_CLI_LIST:
/@ LIST ALL NODES @/
rhdr = ipmip_attr_hdr_ack(&request->message, hdr);
break;
default:
/@ We did not define this command, see if its a generic MIP4 command @/
return ipmip4_attr_command(&data->ipmip4, proc, request);
}
/@ Terminate the reply header @/
ipmip_attr_hdr_finalize(&request->message, rhdr);
/@ Terminate the reply header @/
ipmip_cli_message_commit(&data->ipmip4.ipmip, proc, request);
return 0;
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_attr.h>
#include <private/ipmip4_cli.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip_cli_message;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_attr_command - ipmip4_attr_command
*
* Internal function to MIP4 entities
* Process MIP4 specific attributes
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i request
* Request header
* \i request
* Request header
* \ie
*
* RETURNS: Return value
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_attr_command
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_cli_message *request
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,285 @@
/* ipmip4_cli.h - ipmip4_cli.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_cli.h,v $ $Revision: 1.10 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_cli.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_CLI_H
#define IPMIP4_CLI_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
MIP4 CLI functions required for mobile IPv4. Deals with Command Line Interface
communication with MIPv4. Also implements inter-MIP4 communcation commands
for Proxy Mobility. The Proxy Mobility entiteis (PMIPv4 and FAv4) bounces
registration messages and information between each other.
The PMIP functions are considered INTERNAL for this release. Until the
IPMIPFA and IPMIPPM modules receives more extensive communcation.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_cli.h>
#include <private/ipmip4_attr.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
enum
{
IPMIP4_CLI_START = 2048,
/* Proxy Registration Request Transport Message */
IPMIP4_CLI_PMIPV4_PRRQ,
/* Proxy Mobile Client Trigger Registration Request Message */
IPMIP4_CLI_PMIPV4_PTRQ,
/* Proxy Local Trigger Message */
IPMIP4_CLI_PMIPV4_PLT,
/* Registration revocation message */
IPMIP4_CLI_PMIPV4_PREVRQ,
IPMIP4_CLI_BASE = 4096
};
enum
{
IPMIP4_CLI_PMIPV4_ATTR_NONE = 0,
IPMIP4_CLI_PMIPV4_ATTR_MESSAGE,
IPMIP4_CLI_PMIPV4_ATTR_HANDLER,
IPMIP4_CLI_PMIPV4_ATTR_IFNAME,
IPMIP4_CLI_PMIPV4_ATTR_IFADDR,
IPMIP4_CLI_PMIPV4_ATTR_NFA_COA,
IPMIP4_CLI_PMIPV4_ATTR_OFA_COA,
IPMIP4_CLI_PMIPV4_ATTR_MN_NAI,
IPMIP4_CLI_PMIPV4_ATTR_LIFETIME,
IPMIP4_CLI_PMIPV4_ATTR_ACCESS_TYPE,
IPMIP4_CLI_PMIPV4_ATTR_PER_NODE_AUTH_METHOD,
IPMIP4_CLI_PMIPV4_ATTR_INTERFACE_ID,
IPMIP4_CLI_PMIPV4_ATTR_DEVICE_ID,
IPMIP4_CLI_PMIPV4_ATTR_DEVICE_ID_TYPE,
IPMIP4_CLI_PMIPV4_ATTR_SUBSCRIBER_ID,
IPMIP4_CLI_PMIPV4_ATTR_SUBSCRIBER_ID_TYPE,
IPMIP4_CLI_PMIPV4_ATTR_HOA,
IPMIP4_CLI_PMIPV4_ATTR_HA,
IPMIP4_CLI_PMIPV4_ATTR_MN_HA_SPI,
IPMIP4_CLI_PMIPV4_ATTR_MN_HA_SPI_SECRET,
IPMIP4_CLI_PMIPV4_ATTR_DHCP_RELAY_SERVER,
IPMIP4_CLI_PMIPV4_ATTR_TUNNEL_TYPE,
IPMIP4_CLI_PMIPV4_ATTR_TUNNEL_REVERSE,
IPMIP4_CLI_PMIPV4_ATTR_MAX
};
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip_proc;
struct Ipmip_cli_daemon;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_cli_shell_cmd - ipmip4_cli_shell_cmd
*
* Process global CLI commands
*
* Parameters:
* \is
* \i argc
* Number of arguments
* \i argv
* Arguments
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i daemon
* Daemon connection
* \ie
*
* RETURNS: > 0 syntax error, 0 = success
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_cli_shell_cmd
(
int argc,
char **argv,
struct Ipmip_proc *proc,
struct Ipmip_cli_daemon *daemon
);
/*******************************************************************************
*
* ipmip4_cli_shell_usage - ipmip4_cli_shell_usage
*
* Print usage informatin for MIP4 related commands
*
* Parameters:
* \is
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_cli_shell_usage
(
struct Ipmip_proc *proc
);
/*** PMIP functions ***/
IP_GLOBAL int ipmip4_cli_shell_pmipv4_cmd
(
int argc,
char **argv,
struct Ipmip_proc *proc,
struct Ipmip_cli_daemon *daemon
);
IP_GLOBAL void ipmip4_cli_shell_pmipv4_usage
(
struct Ipmip_proc *proc
);
IP_PUBLIC void ipmip4_cli_pmipv4_local_trigger_request_init
(
Ipmip_cli_daemon_req_t *req,
const char *nai
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_nai
(
Ipmip_cli_daemon_req_t *req,
const char *nai
);
IP_PUBLIC void ipmip4_cli_request_set_ifname
(
Ipmip_cli_daemon_req_t *req,
const char *ifname
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_home_address
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 hoa
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_home_agent
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 ha
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_ofa
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 fa
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_nfa
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 fa
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_mn_ha_spi
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 spi
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_mn_ha_spi_secret
(
Ipmip_cli_daemon_req_t *req,
const char *secret
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_dhcp_relay_server
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 srv
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_tunnel_type
(
Ipmip_cli_daemon_req_t *req,
Ip_u32 tunnel_type
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_handler
(
Ipmip_cli_daemon_req_t *req,
const char *handler
);
IP_PUBLIC void ipmip4_cli_pmipv4_request_set_ifaddr
(
Ipmip_cli_daemon_req_t *req,
const char *ifaddr
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,299 @@
/* ipmip4_context.h - ipmip4_context.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_context.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_context.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_CONTEXT_H
#define IPMIP4_CONTEXT_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* MIP4 context definitions. Deals with process creation, and context
* instantiations.
*/
/*
DESCRIPTION
MIP4 context definitions. Deals with process creation, and context
instantiations. This module provides a superset to the MIP context
definitions.Functions defined here will usually in turn invoke their
IPMIP counterpart.
EXAMPLE
To create, initialize, start stop and destroy a context in MIP4.
.CS
/@ Just some sort of entity that one could have in a mobility systemm which
requires a unique identifier @/
struct Ipmip4_my_entities
{
struct Ipmip_my_entities ipmip;
int my_personal_data;
};
struct Ipmip4_my_context
{
Ipmip4_context_t ipmip; /@ Basic IPMIP context @/
int my_personal_data;
Ipmip4_pkt_udp_register_t udpr;
};
struct Ipmip4_my_context *my_init_func4(Ipmip_proc_t *proc)
{
/@ Allocate my context; indicate the size of my overloaded structure @/
struct Ipmip4_my_context *ctx = (struct Ipmip4_my_context *)ipmip_context_alloc(proc, sizeof(*ctx), "mymip4", IPCOM_LOG_DEBUG2, 10);
/@ Initialize the MIP4 portion of the context @/
ipmip4_context_init(&ctx->ipmip4, proc);
/@ YOU NEED TO ADD MIP SPECIFC INITIALIZATION CODE HERE AS WELL
AS DEFINED IN ipmip_context.h/ipmip_cli.h/ipmip_pktbuf.h @/
/@ Start the context @/
ipmip4_context_start(&ctx->ipmip4, proc);
}
void my_stop_func4(Ipmip_proc_t *proc, struct Ipmip4_my_context *ctx)
{
/@ Stop the context @/
ipmip4_context_stop(&ctx->ipmip4, proc);
/@ Destroy the context @/
ipmip4_context_destroy(&ctx->ipmip4, proc);
}
void main(int argc, char *argv[])
{
/@ For threads started with ipmip_proc_start, the proc structure is allocated
automatically, for other types of threads such as main, we need to
allocate it manually @/
Ipmip_proc_t *proc = ipmip_proc_alloc();
struct Ipmip4_my_context *ctx = my_init_func4(proc);
/@ Stop the context @/
my_stop_func4(proc, ctx);
/@ Destroy the process context - If ipmip_proc_stop is used, @/
ipmip_proc_destroy(proc);
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_context.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_pktbuf_context;
typedef struct Ipmip4_context
{
Ipmip_context_t ipmip;
Ipcom_list *vendor_extensions;
struct Ipmip4_pkt_context *pkt;
} Ipmip4_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_context_destroy - ipmip4_context_destroy
*
* Destroy the IPMIP4 context. Will destroy all resources associated with the
* MIP4 entity, and also invoke the IPMIP ipmip_context_destroy routine
* to destroy resources allocated by the base IPMIP system.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_context_destroy
(
Ipmip4_context_t *ctx,
Ipmip_proc_t *proc
);
/*******************************************************************************
*
* ipmip4_context_stop - ipmip4_context_stop
*
* Stop the MIP4 context. Will also invoke ipmip_context_stop in order to
* stop all functions and resources currently active in the base IPMIP system.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_context_stop
(
Ipmip4_context_t *ctx,
Ipmip_proc_t *proc
);
/*******************************************************************************
*
* ipmip4_context_start - ipmip4_context_start
*
* Start the MIP4 context. Will also invoke ipmip_context_start in order to
* activate the functionalities in the base IPMIP system.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_context_start
(
Ipmip4_context_t *ctx,
Ipmip_proc_t *proc
);
/*******************************************************************************
*
* ipmip4_context_init - ipmip4_context_init
*
* One time initialization functions that will initialize the IPMIP4 portion
* of the context.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_context_init
(
Ipmip4_context_t *ctx,
Ipmip_proc_t *proc
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,442 @@
/* ipmip4_diameter.h - ipmip4_diameter.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_diameter.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_diameter.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_DIAMETER_H
#define IPMIP4_DIAMETER_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Implements the MIP4 wrapper for RFC4004 and IPDIAMETER
*/
/*
DESCRIPTION
Implements the MIP4 wrapper for RFC4004 and IPDIAMETER. This file
is used internally by the foreign agent and home agent.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_DIAMETER_FEATURE_MN_HOA_REQ (1 << 0)
#define IPMIP4_DIAMETER_FEATURE_HOA_IN_HOME_REALM (1 << 1)
#define IPMIP4_DIAMETER_FEATURE_HA_REQ (1 << 2)
#define IPMIP4_DIAMETER_FEATURE_FOREIGN_HA_AVAIL (1 << 3)
#define IPMIP4_DIAMETER_FEATURE_MN_HA_KEYREQ (1 << 4)
#define IPMIP4_DIAMETER_FEATURE_MN_FA_KEYREQ (1 << 5)
#define IPMIP4_DIAMETER_FEATURE_FA_HA_KEYREQ (1 << 6)
#define IPMIP4_DIAMETER_FEATURE_HA_IN_FOREIGN_NET (1 << 7)
#define IPMIP4_DIAMETER_FEATURE_CO_LOCATED_MN (1 << 8)
#define IPMIP4_DIAMETER_ACCESS_REQUEST_SUCCESS (0)
#define IPMIP4_DIAMETER_ACCESS_REQUEST_FAILURE (1)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip4_diameter_context;
struct Ipdiameter_header_struct;
struct Ipdiameter_request_struct;
struct Ipmip_cli_message;
typedef void (*Ipmip4_diameter_func_t) (int result,
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter,
struct Ipmip4_pktbuf *pbuf,
void *arg,
struct Ipdiameter_request_struct *req,
struct Ipdiameter_header_struct *request,
struct Ipdiameter_header_struct *reply);
/* Callback function for a received HAR request */
typedef void (*Ipmip4_diameter_HAR_recv_t) (struct Ipmip4_context *ctx,
void *req,
void *peer);
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_diameter_context_create - ipmip4_diameter_context_create
*
* Create a diameter context if so specified by the configuration
* parameters
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i defbase
* Default value sysvar path
* \i format
* Base configuration path
* \i ...
* Additional format variables
* \ie
*
* RETURNS: A radius context if properly configured and enabled
*
* ERRNO:
*
*/
IP_GLOBAL struct Ipmip4_diameter_context * ipmip4_diameter_context_create
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
const char *defbase,
const char *format,
...
);
/*******************************************************************************
*
* ipmip4_diameter_context_dump - ipmip4_diameter_context_dump
*
* Dump the configuration parameters of the context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i diameter
* Diameter context
* \i request
* CLI request to dump information to.
* \i format
* Base configuration path
* \i ...
* Additional format variables
* \ie
*
* RETURNS: A radius context if properly configured and enabled
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_diameter_context_dump
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter,
struct Ipmip_cli_message *request,
const char *format,
...
);
/*******************************************************************************
*
* ipmip4_diameter_context_destroy - ipmip4_diameter_context_destroy
*
* Stop and destroy a radius context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i diameter
* Diameter context.
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_diameter_context_destroy
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter
);
/*******************************************************************************
*
* ipmip4_diameter_access_request - ipmip4_diameter_access_request
*
* Do an ordinary access request; no challenge provided
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i diameter
* Radius context
* \i func
* Diameter callback function
* \i pbuf
* Current transaction
* \i arg
* Opaque argument
* \i request
* Diameter request structure
* \i packet
* Diameter packet header
* \i auth_type
* Type of authentication
* \ie
*
* RETURNS: IP_TRUE on successful request transmission.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_diameter_access_request
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter,
Ipmip4_diameter_func_t func,
Ipmip4_pktbuf_t *pbuf,
void *arg,
struct Ipdiameter_request_struct *request,
struct Ipdiameter_header_struct *packet,
int auth_type
);
/*******************************************************************************
*
* ipmip4_diameter_request_alloc - ipmip4_diameter_request_alloc
*
* Initialize and allocate data required for an access request.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i diameter
* Diameter context
* \i request
* Diameter request
* \i packet
* [OUT] Allocated Diameter packet header.
* \ie
*
* RETURNS: IP_TRUE on successful init.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_diameter_request_alloc
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter,
struct Ipdiameter_request_struct *request,
struct Ipdiameter_header_struct **packet
);
/*******************************************************************************
*
* ipmip4_diameter_answer_alloc - ipmip4_diameter_answer_alloc
*
* Initialize and allocate data required for an access answer
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i diameter
* Diameter context
* \i sid
* Session ID
* \i sid_size
* Size of session ID.
* \i hbh
* HBH
* \i e2e
* E2E
* \i packet
* [OUT] Allocated Diameter packet header.
* \ie
*
* RETURNS: IP_TRUE on successful init.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_diameter_answer_alloc
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_diameter_context *diameter,
void *sid,
Ip_size_t sid_size,
Ip_u32 hbh,
Ip_u32 e2e,
struct Ipdiameter_header_struct **packet
);
/*******************************************************************************
*
* ipmip4_diameter_HAR_callback - ipmip4_diameter_HAR_callback
*
* Register the HAR callback function.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i func
* The HAR callback function that will be invoked when
*
* a HAR is received by IPDIAMETER.
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_diameter_HAR_callback
(
void *ctx,
Ipmip4_diameter_HAR_recv_t func
);
/*******************************************************************************
*
* ipmip4_diameter_proc - ipmip4_diameter_proc
*
* Retrieve the DIAMETER process block
*
* Parameters:
* \is
* \i diameter
* context
* \ie
*
* RETURNS: The process block
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_proc_t * ipmip4_diameter_proc
(
struct Ipmip4_diameter_context *diameter
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,349 @@
/* ipmip4_if.h - ipmip4_if.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_if.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_if.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_IF_H
#define IPMIP4_IF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Basic interface management required for MIP4. Provides functions to
* instantiate interfaces information containers, resolve LLA identifiers
* and create and destroy tunnel interfaces
*/
/*
DESCRIPTION
Basic interface management required for MIP4. Provides functions to
instantiate interfaces information containers, resolve LLA identifiers
and create and destroy tunnel interfaces
EXAMPLE
Examples how to create MIP4 enabled interfaces.
.CS
typedef struct Ipmip4_if_mine
{
Ipmip4_if_t iff;
/@ Any data I need to store in this interface structure @/
ine my_private_data;
} Ipmip4_if_mine_t;
IP_STATIC void
ipmip4_my_if_delete(struct Ipmip4_my_context *ctx,
Ipmip_proc_t *proc,
Ipmip4_if_mine_t *myif)
{
/@ Free any data that I have allocated @/
}
Ipmip4_if_mine_t *my_if_alloc4(struct Ipmip4_my_context *ctx, Ipmip_proc_t *proc, const char *ifname)
{
Ipmip4_if_mine_t *myif;
Ip_u32 ifindex;
ifindex = ipcom_if_nametoindex(ifname);
/@ Does it exist? @/
if (ifindex == 0)
return IP_NULL;
myif = (Ipmip4_if_mine_t *)ipmip4_if_alloc(&ctx->ipmip4,
proc,
sizeof(*myif),
ifname,
ifindex,
IPMIP_IF_TYPE_GENERIC,
0,
(Ipmip_if_cleanup_t )ipmip4_my_if_delete);
return myif;
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_pktbuf.h>
#include <private/ipmip_if.h>
#include <private/ipmip4_lla.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip4_if;
typedef struct Ipmip4_if
{
Ipmip_if_t ipmip;
Ipcom_list pktbufs;
Ip_u32 ifaddr;
/* Cleanup function */
Ipmip_if_cleanup_t cleanup;
} Ipmip4_if_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_if_alloc - ipmip4_if_alloc
*
* Allocate and initialize the interface structure
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i ifsize
* the size of the interface structure
* \i ifname
* The interface name
* \i ifindex
* The interface index.
* \i type
* Type of interface
* \i identity
* The interface identity.
* \i cleanup
* Function to be invoked prior to free.
* \ie
*
* RETURNS: The interface structure on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_alloc
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t ifsize,
const char *ifname,
Ip_u32 ifindex,
Ip_u8 type,
Ip_u8 identity,
Ipmip_if_cleanup_t cleanup
);
/*******************************************************************************
*
* ipmip4_if_alloc_tunnel - ipmip4_if_alloc_tunnel
*
* Create a specific tunnel for the provided interface
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i ifsize
* Total size of the interface structure
* \i ifname
* Wanted ifname
* \i local
* The local endpoint
* \i local_port
* Base port for NAT_T setup
* \i remote
* Remote endpoint
* \i identity
* The identity of the tunnel
* \i tunnel_type
* Tunnel type
* \i reorder
* Enable reordering if supported by interface
* \i cleanup
* Function to be invoked prior to free.
* \ie
*
* RETURNS: The interface structure on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_alloc_tunnel
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_size_t ifsize,
char *ifname,
Ip_u32 local,
Ip_u16 local_port,
Ip_u32 remote,
Ip_u8 identity,
Ip_u8 tunnel_type,
Ip_bool reorder,
Ipmip_if_cleanup_t cleanup
);
/*******************************************************************************
*
* ipmip4_if_get_primary_address - ipmip4_if_get_primary_address
*
* Get the current primary address of the interface.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i iff
* The interface
* \ie
*
* RETURNS: address on success; IP_INADDR_NONE on failure.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u32 ipmip4_if_get_primary_address
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_if_t *iff
);
/*******************************************************************************
*
* ipmip4_if_findbyaddr - ipmip4_if_findbyaddr
*
* Locate an interface in our configuration based on address.
*
* Parameters:
* \is
* \i iflist
* The list of interfaces.
* \i addr
* The interface address
* \ie
*
* RETURNS: The interface pointer if it exists, IP_NULL otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_findbyaddr
(
Ipcom_list *iflist,
Ip_u32 addr
);
/*******************************************************************************
*
* ipmip4_if_findbypktinfo - ipmip4_if_findbypktinfo
*
* Locate an interface in our configuration based on address.
*
* Parameters:
* \is
* \i iflist
* The list of interfaces
* \i pktinfo
* The interface info
* \ie
*
* RETURNS: The interface pointer if it exists, IP_NULL otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_if_t * ipmip4_if_findbypktinfo
(
Ipcom_list *iflist,
Ipmip_pktbuf_pktinfo_t *pktinfo
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,80 @@
/* ipmip4_ipnet.h - ipmip4_ipnet.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_ipnet.h,v $ $Revision: 1.3 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_ipnet.h,v $
* $Author: jhorteli $ $Date: 2010-10-21 12:21:20 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_IPNET_H
#define IPMIP4_IPNET_H
#if defined(IPNET)
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* IPNET ioctl wrapper
*/
/*
DESCRIPTION
IPNET ioctl wrapper. NO LONGER USED.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_sock.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,441 @@
/* ipmip4_lla.h - ipmip4_lla.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_lla.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_lla.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_LLA_H
#define IPMIP4_LLA_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Utility class that provides functions to create, interpret and modify
* LLA identifiers.
*/
/*
DESCRIPTION
Utility class that provides functions to create, interpret and modify
LLA identifiers. LLA identifiers are a MIP4 specific hardware definition
used by low-latency handovers. They are not commonly used by the MIP4
entities, unless they are to be added or parsed from a MIP4 registration
request/reply. In all internal state and processing the LLADDR definitions
provided by ipmip_lladdr.h are used, which are a superset of the LLA. That is,
a LLA can be converted to a LLADDR without loss of information, but the
reverse is not necessarily true.
These functions are mostly internal and used for specific events defined
by low latency handoffs and proxy mobility registrations.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_lladdr.h>
#include <private/ipmip4_msgext.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_3GPP2_MOBILE_STATION 1 /* 3GPP2 Mobile Station ID: n byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_3GPP_MOBILE_SUBSCRIBER 2 /* 3GPP Mobile Subscriber Id: n byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_MAC 3 /* Ethernet 48 bit MAC address: 6 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_EUID64 4 /* EUID64 address: 8 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_SOLICITED_ADDRESS 5 /* Solicited IPv4 Address: 4 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_ACCESS_POINT 6 /* Access Point Identifier: 4 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_FA_ADDRESS 7 /* FA IPv4 Address: 4 byte identifier */
/* Calculate the required memory allocation depending
* on the size of the link layer address/identifier */
#define IPMIP4_ICMP_LLA_EXT_SIZE(llsize) ((sizeof(Ipmip4_icmp_lla_ext_t) + (llsize) - 1))
/* The value of the 'length' field */
#define IPMIP4_ICMP_LLA_EXT_LENGTH(llsize) ((llsize) + 1)
/* The total size required to make a copy of an LLA */
#define IPMIP4_ICMP_LLA_EXT_TOTAL_SIZE(lla) ((lla)->length + 2)
/* The LLA size of an LLA */
#define IPMIP4_ICMP_LLA_EXT_LLA_SIZE(lla) ((lla)->length - 1)
/* PMIPv4 definition and types */
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_3 1
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_11ABG 2
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_16E 3
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_16M 4
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP_EUTRAN_LTE 5
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP_UTRAN_GERAN 6
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP2_1XRTT_HRPD 7
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP2_UMB 8
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_msgext_array;
union Ipmip4_msgext_uhdr;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_lla_llh_find_array_subtype - ipmip4_lla_llh_find_array_subtype
*
* Return a usable source LLA address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i subtype
* The specific subtype
* \i ext
* The found LLA extensions.
* \ie
*
* RETURNS: The LLA address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_icmp_lla_ext_t * ipmip4_lla_llh_find_array_subtype
(
Ip_u8 subtype,
struct Ipmip4_msgext_array *ext
);
/*******************************************************************************
*
* ipmip4_lla_llh_convert_array_to_lladdr - ipmip4_lla_llh_convert_array_to_lladdr
*
* Return a dynamically allocated source LLADDR address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i lladdr
* The LLADDR of the receiving interface
* \i ext
* The found LLA extensions.
* \ie
*
* RETURNS: The LLADDR address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t * ipmip4_lla_llh_convert_array_to_lladdr
(
Ipmip_lladdr_t *lladdr,
struct Ipmip4_msgext_array *ext
);
/*******************************************************************************
*
* ipmip4_lla_llh_convert_lla_to_lladdr - ipmip4_lla_llh_convert_lla_to_lladdr
*
* Return a dynamically allocated source LLADDR address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i lladdr
* The LLADDR of the receiving interface
* \i lla
* The found LLA extension
* \ie
*
* RETURNS: The LLADDR address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_llh_convert_lla_to_lladdr
(
Ipmip_lladdr_t *lladdr,
Ipmip4_icmp_lla_ext_t *lla
);
/*******************************************************************************
*
* ipmip4_lla_llh_lladdr_buffer_icmp_append - ipmip4_lla_llh_lladdr_buffer_icmp_append
*
* Append an LLA to a buffer in ICMP mode
*
* Parameters:
* \is
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities.
* \i lla
* The LLA
* \ie
*
* RETURNS: The offset
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_lla_llh_lladdr_buffer_icmp_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_llh_lladdr_buffer_udp_append - ipmip4_lla_llh_lladdr_buffer_udp_append
*
* Append an LLA to a buffer in UDP mode
*
* Parameters:
* \is
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities.
* \i lla
* The LLA
* \ie
*
* RETURNS: The offset
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_lla_llh_lladdr_buffer_udp_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_access_type_append - ipmip4_lla_pmipv4_lladdr_buffer_access_type_append
*
* Append an PMIPv4 Access Type option to a buffer based on the LLADDR
*
* Parameters:
* \is
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities.
* \i lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_access_type_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append - ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append
*
* Append an PMIPv4 Interface ID option to a buffer based on the LLADDR
*
* Parameters:
* \is
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities.
* \i lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_device_id_append - ipmip4_lla_pmipv4_lladdr_buffer_device_id_append
*
* Append an PMIPv4 Device ID option to a buffer based on the LLADDR
*
* Parameters:
* \is
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities.
* \i lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_device_id_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_interface_id_convert_to_lladdr - ipmip4_lla_pmipv4_interface_id_convert_to_lladdr
*
* Convert a PMIPv4 interface identifier to a LLADDR type. The lladdr provided to
* the function MUST be the corresponding interface's own LLADDR, which will be used
* as hint when converting. The interface id does not contain any information regarding
* interface type, since it is implicitly known by the MIP agent due to its knowledge
* regarding serving interface.
*
* Parameters:
* \is
* \i lladdr
* The serving interface's link local address
* \i ifid
* The interface identifier
* \ie
*
* RETURNS: A newly allocated LLADDR containing the appropriate values.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_pmipv4_interface_id_convert_to_lladdr
(
Ipmip_lladdr_t *lladdr,
union Ipmip4_msgext_uhdr *ifid
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_device_id_convert_to_lladdr - ipmip4_lla_pmipv4_device_id_convert_to_lladdr
*
* Convert a PMIPv4 device identifier to a LLADDR type. The lladdr provided to
* the function MUST be the corresponding interface's own LLADDR, which will be used
* as hint when converting. The device id does not contain any information regarding
* interface type, since it is implicitly known by the MIP agent due to its knowledge
* regarding serving interface.
*
* Parameters:
* \is
* \i lladdr
* The serving interface's link local address
* \i ifid
* The interface identifier
* \ie
*
* RETURNS: A newly allocated LLADDR containing the appropriate values.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_pmipv4_device_id_convert_to_lladdr
(
Ipmip_lladdr_t *lladdr,
union Ipmip4_msgext_uhdr *ifid
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_access_type_from_lladdr_types - ipmip4_lla_pmipv4_access_type_from_lladdr_types
*
* Convert a LLADDR type and subtype to the corresponding access type
*
* Parameters:
* \is
* \i type
* The interface major type
* \i subtype
* The interface minor type
* \ie
*
* RETURNS: The access type corresponding to the interface values.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 ipmip4_lla_pmipv4_access_type_from_lladdr_types
(
Ip_u8 type,
Ip_u8 subtype
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_device_id_type_from_lladdr_types - ipmip4_lla_pmipv4_device_id_type_from_lladdr_types
*
* Convert a LLADDR type and subtype to the corresponding device id type
*
* Parameters:
* \is
* \i type
* The interface major type
* \i subtype
* The interface minor type
* \ie
*
* RETURNS: The device id type corresponding to the interface values.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 ipmip4_lla_pmipv4_device_id_type_from_lladdr_types
(
Ip_u8 type,
Ip_u8 subtype
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,350 @@
/* ipmip4_netlink.h - ipmip4_netlink.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_netlink.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_netlink.h,v $
* $Author: jhorteli $ $Date: 2010-12-16 12:19:21 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_NETLINK_H
#define IPMIP4_NETLINK_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
MIP4 NETLINK functions for mobile IPv4. Deals with MIP4 netlink specific
commands and routes. The MIP4 methods mostly deals with registering
entities in the kernel for more advanced GRE and statistics management
than is usually provided by the base IPNET functionality.
EXAMPLE
This example illustrates how one can register a MIP handle in the kernel,
and retrieve statistics.
.CS
IP_GLOBAL void
my_handle_function(struct Ipmip4my_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_my_entities *node)
{
Ipmip4_netlink_kern_statistics_t link_recv, link_send;
Ipmip_netlink_kern_handle_t handle;
/@ Register this nodes handle in the kernel @/
ipmip4_netlink_new_handle(&ctx->ipmip4, proc, IPCOM_IPD_ID_IPMYMIP, node->identity);
/@ Setup a userspace integrated handle @/
handle.mip_facility = IPCOM_IPD_ID_IPMIPMYMIP;
handle.mip_ident = node->identity;
/@ Retrieve current non-polled statistics from the kernel @/
if (ipmip4_netlink_get_handle_stat(&ctx->ipmip4, proc, &handle, &link_recv, &link_send))
{
/@ Store the retrieved statistics @/
}
/@ Register this nodes handle in the kernel @/
ipmip4_netlink_del_handle(&ctx->ipmip4, proc, IPCOM_IPD_ID_IPMYMIP, node->identity);
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_sock.h>
#include <ipcom_netlink.h>
#include <private/ipmip_netlink.h>
#include <private/ipmip4_netlink_kern.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
union Ipmip4_msgext_uhdr;
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip_netlink_kern_handle;
struct Ipmip4_netlink_kern_statistics;
struct Ipmip_netlink_kern_compare;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_netlink_get_handle_stat - ipmip4_netlink_get_handle_stat
*
* Retrieve the statistics associated with a handle. The statistics retrieved
* is the currently non-polled statistics present in the kernel. This function
* will reset the kernel structures. That is, for each invocation of this
* method you will retrieve the statistics collected with start from the
* previous invocation.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i handle
* The MIP handle
* \i link_recv
* Container to populate with RECEIVE statistics
* \i link_send
* Container to populate with SEND statistics
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_netlink_get_handle_stat
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip_netlink_kern_handle *handle,
struct Ipmip4_netlink_kern_statistics *link_recv,
struct Ipmip4_netlink_kern_statistics *link_send
);
/*******************************************************************************
*
* ipmip4_netlink_del_handle - ipmip4_netlink_del_handle
*
* Delete a MIP handle previously registered using ipmip4_netlink_new_handle.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i facility
* The MIP facility. One of the IPCOM_IPD_ID_IPMIPXX product definitions.
* \i identity
* The unique identity parameter.
* \ie
*
* RETURNS: 0 on success
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_netlink_del_handle
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 facility,
Ip_u32 identity
);
/*******************************************************************************
*
* ipmip4_netlink_new_handle - ipmip4_netlink_new_handle
*
* Create a MIP handle.The facility/identity combination must be unique,
* or this method will fail with an EEXIST errno.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i facility
* The MIP facility. One of the IPCOM_IPD_ID_IPMIPXX product definitions.
* \i identity
* The unique identity parameter.
* \ie
*
* RETURNS: 0 on success
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_netlink_new_handle
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 facility,
Ip_u32 identity
);
/*******************************************************************************
*
* ipmip4_netlink_address_do - ipmip4_netlink_address_do
*
* Perform MIP4 specific address management. For example MIP exclusions,
* home address activation/deactivation etc.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i cmd
* The NETLINK command
* \i type
* The MIP sub command
* \i flags
* Command flags
* \i ifindex
* Interface index specifying the interface.
* \i family
* AF_INET or AF_INET6
* \i addr
* Address buffer
* \i reply
* Optional reply buffer.
* \ie
*
* RETURNS: 0 on success
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_netlink_address_do
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
int cmd,
Ip_u16 type,
Ip_u8 flags,
Ip_u32 ifindex,
Ip_u8 family,
const void *addr,
Ipmip_buffer_t *reply
);
/*******************************************************************************
*
* ipmip4_netlink_route_validate - ipmip4_netlink_route_validate
*
* Validate a particular route.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i cmd
* \i ifindex
* Interface index specifying the interface.
* \i addr
* The address to verify routing for.
* \i reply
* Optional reply buffer.
* \ie
*
* RETURNS: 0 on success
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_netlink_route_validate
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 ifindex,
Ip_u32 addr,
Ipmip_buffer_t *reply
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,177 @@
/* ipmip4_netlink_kern.h - ipmip4_netlink_kern.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_netlink_kern.h,v $ $Revision: 1.4.10.1 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_netlink_kern.h,v $
* $Author: svc-cmnet $ $Date: 2013-03-13 07:45:31 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_NETLINK_KERN_H
#define IPMIP4_NETLINK_KERN_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
MIP4 NETLINK KERNEL defines and attributes. Defines structures and attributes
that are used when communicating with the MIPv4 netlink kernel implementation.
The MIPv4 Kernel implementation integrates with IPNET flow and routing
management in order to provide MIPv4 functionality and forwarding.
The definitions in this file are used by the support functions defined in
ipmip4_netlink.h.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_netlink_kern.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
typedef struct Ipmip4_netlink_kern_statistics
{
Ip_u32 mip_s_octets;
Ip_u32 mip_s_pkts;
Ip_u32 mip_s_stamp_sec;
Ip_u32 mip_s_stamp_msec;
} Ipmip4_netlink_kern_statistics_t;
#define IP_WRMOB4_NEW_TYPE_SILENT (1 << 0)
#define IP_WRMOB4_NEW_TYPE_TEMPORARY (1 << 1)
enum Ip_wrmob4_deltype_t
{
IP_WRMOB4_DEL_UNSPEC,
IP_WRMOB4_DEL_LINK_TX,
IP_WRMOB4_DEL_LINK_RX,
IP_WRMOB4_DEL_HANDLE,
__IP_WRMOB4_DEL_MAX
};
enum Ip_wrmob4_gettype_t
{
IP_WRMOB4_GET_UNSPEC,
IP_WRMOB4_GET_HANDLE_STAT,
IP_WRMOB4_GET_VALIDATE_ROUTE,
__IP_WRMOB4_GET_MAX
};
enum Ip_wrmob4_newtype_t
{
IP_WRMOB4_NEW_UNSPEC,
IP_WRMOB4_NEW_LINK_TX,
IP_WRMOB4_NEW_LINK_RX,
IP_WRMOB4_NEW_HANDLE,
__IP_WRMOB4_NEW_MAX
};
enum
{
IP_WRMOB4_ROUTE_UNSPEC,
IP_WRMOB4_ROUTE_HOA,
IP_WRMOB4_ROUTE_FLAGS,
IP_WRMOB4_ROUTE_IFINDEX,
IP_WRMOB4_ROUTE_DST,
IP_WRMOB4_ROUTE_DST_LEN,
IP_WRMOB4_ROUTE_TABLE,
IP_WRMOB4_ROUTE_GW,
IP_WRMOB4_ROUTE_COA,
IP_WRMOB4_ROUTE_MTU,
IP_WRMOB4_ROUTE_SRCMAC,
IP_WRMOB4_ROUTE_NAT_PORT,
IP_WRMOB4_ROUTE_GRE_KEY,
IP_WRMOB4_ROUTE_HANDLE,
IP_WRMOB4_ROUTE_LINK,
__IP_WRMOB4_ROUTE_MAX
};
#define IP_WRMOB4_ROUTE_MAX (__IP_WRMOB4_ROUTE_MAX - 1)
enum
{
IP_WRMOB4_STATS_UNSPEC,
IP_WRMOB4_STATS_LINK_RECV,
IP_WRMOB4_STATS_LINK_SEND,
__IP_WRMOB4_STATS_MAX
};
#define IP_WRMOB4_STATS_MAX (__IP_WRMOB4_STATS_MAX - 1)
#define IP_WRMOB4_SET_FLAG_CLEAR (1 << 0)
enum Ip_wrmob4_settype_t
{
IP_WRMOB4_SET_UNSPEC,
IP_WRMOB4_SET_ADDRESS_ACTIVE,
IP_WRMOB4_SET_NO_GLOBAL_SRC,
__IP_WRMOB4_SET_MAX
};
enum
{
IP_WRMOB4_HOA_UNSPEC,
IP_WRMOB4_HOA_ADDRESS,
IP_WRMOB4_HOA_IFINDEX,
__IP_WRMOB4_HOA_MAX
};
#define IP_WRMOB4_HOA_MAX (__IP_WRMOB4_HOA_MAX - 1)
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifndef IPMIP_NATIVE_KERNEL
IP_GLOBAL void ipmip4_rtnetlink_init(void);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,80 @@
/* ipmip4_ntop.h - ipmip4_ntop.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_ntop.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_ntop.h,v $
* $Author: jhorteli $ $Date: 2009-04-23 14:13:30 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_NTOP_H
#define IPMIP4_NTOP_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Debug utility class providing functions to ease print's of various
* values such as hexarrays, lla's, addresses and non-zero-terminated
* strings.
*/
/*
DESCRIPTION
Debug utility class providing functions to ease print's of various
values such as hexarrays, lla's, addresses and non-zero-terminated
strings.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_ntop.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,833 @@
/* ipmip4_pkt.h - ipmip4_pkt.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_pkt.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_pkt.h,v $
* $Author: jhorteli $ $Date: 2011-01-21 15:31:36 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_PACKET_H
#define IPMIP4_PACKET_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Base packet management class, containing vital information for creating
* packets, receiving packets and sending packets.
*/
/*
DESCRIPTION
Base packet management class, containing vital information for creating
packets, receiving packets and sending packets.
EXAMPLE
These examples extends the example functions originally defined
ipmip4_context.h, and shows how should create and manage the packet
context.
.CS
IP_GLOBAL void
ipmip4_reg_recv(struct Ipmip4_my_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_pktbuf_t *pbuf,
void *arg)
{
/@ Process the registration request @/
/@ Release the packet buffer @/
ipmip_pktbuf_release(&ctx->ipmip4.ipmip, proc, &pbuf->ipmip);
}
IP_GLOBAL void
ipmip4_udp_recv(struct Ipmip4_my_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_pktbuf_t *pbuf,
void *arg)
{
/@ Process the UDP packet @/
/@ Release the packet buffer @/
ipmip_pktbuf_release(&ctx->ipmip4.ipmip, proc, &pbuf->ipmip);
}
IP_GLOBAL void
ipmip4_adv_recv(struct Ipmip4_my_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_pktbuf_t *pbuf)
{
Ipcom_icmp_header *icmph = IPMIP_BUFFER_PTR(&pbuf->ipmip.packet);
/@ Process the ICMP packet @/
/@ Release the packet buffer @/
ipmip_pktbuf_release(&data->ipmip4.ipmip, proc, &pbuf->ipmip4.ipmip);
}
struct Ipmip4_my_context *my_init_func4(Ipmip_proc_t *proc)
{
/@ Allocate my context; indicate the size of my overloaded structure @/
struct Ipmip4_my_context *ctx = (struct Ipmip_my_context *)ipmip_context_alloc(proc, sizeof(*ctx), "mymip4", IPCOM_LOG_DEBUG2, 10);
struct Ip_sockaddr_in udp;
/@ Initialize the MIP4 portion of the context @/
ipmip4_context_init(&ctx->ipmip4, proc);
/@ Create a packet context @/
ipmip4_pkt_context_create(&ctx->ipmip4,
proc,
IPMIP4_PKT_UDP_IN_434|IPMIP4_PKT_UDP_IN_OUT|IPMIP4_PKT_PKT_OUT|IPMIP4_PKT_ICMP_IN,
(Ipmip4_pkt_udp_cb_t)ipmip4_reg_recv,
(Ipmip4_pkt_icmp_cb_t)ipmip4_adv_recv,
IP_NULL);
/@ Register an extra UDP socket to the packet context @/
ipcom_memset(&udp, 0, sizeof(udp));
udp.sin_family = IP_AF_INET;
udp.sin_len = sizeof(udp);
udp.sin_addr.s_addr = 0;
udp.sin_port = ip_htons(1000);
ctx->udpr.udp_callback = (Ipmip4_pkt_udp_cb_t)ipmip4_udp_recv;
ctx->udpr.opaque = IP_NULL;
ctx->udpr.fd = ipmip_inet_udp_socket(&udp);
ipmip4_pkt_udp_register(&ctx->ipmip4, proc, &cfg->udpr);
/@ Start the context @/
ipmip4_context_start(&ctx->ipmip4, proc);
}
.CE
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_buffer.h>
#include <private/ipmip4_context.h>
#include <private/ipmip4_if.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_PKT_UDP_IN_434 (1 << 0)
#define IPMIP4_PKT_UDP_IN_OUT (1 << 1) /* Use two different sockets for in/out */
#define IPMIP4_PKT_PKT_IN (1 << 2) /* ARP/PACKET IN required */
#define IPMIP4_PKT_PKT_OUT (1 << 3) /* ARP/PACKET OUT required */
#define IPMIP4_PKT_ICMP_IN (1 << 4) /* Inbound ICMP packets */
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
#include "ipcom_align16.h"
/*
*===========================================================================
* Ipnet_pkt_arp
*===========================================================================
*/
typedef IP_PACKED1 struct Ipmip4_pkt_arp
{
/* ARP header. */
Ip_u16 hrd; /* Format of hardware address. */
Ip_u16 pro; /* Format of protocol address. */
Ip_u16 hln_pln; /* Length of hardware and protocol address. */
Ip_u16 op; /* Code */
Ip_u8 eth_src[IPMIP_ETH_ADDR_SIZE];
Ip_u16 ip_src[2];
Ip_u8 eth_dst[IPMIP_ETH_ADDR_SIZE];
Ip_u16 ip_dst[2];
}
IP_PACKED2 Ipmip4_pkt_arp_t;
#include "ipcom_align16.h"
struct Ipmip4_pktbuf;
struct Ipmip4_context;
struct Ipmip_proc;
typedef Ip_bool (*Ipmip4_pkt_udp_cb_t)
(
Ipmip4_context_t *context,
Ipmip_proc_t *proc,
struct Ipmip4_pktbuf *pbuf,
void *arg
);
typedef Ip_bool (*Ipmip4_pkt_icmp_cb_t)
(
Ipmip4_context_t *context,
Ipmip_proc_t *proc,
struct Ipmip4_pktbuf *pbuf
);
typedef Ip_bool (*Ipmip4_pkt_packet_cb_t)
(
Ipmip4_context_t *context,
Ipmip_proc_t *proc,
struct Ipmip4_pktbuf *pbuf
);
typedef struct Ipmip4_pkt_udp_register
{
Ipcom_list next;
Ipmip4_pkt_udp_cb_t udp_callback;
Ip_fd fd;
void *opaque;
} Ipmip4_pkt_udp_register_t;
typedef struct Ipmip4_pkt_context
{
Ipcom_list udp_sockets;
struct Ipmip_proc *proc;
Ip_fd fd_raw;
Ip_fd fd_pkt;
Ip_fd fd_icmp_in;
struct Ip_sockaddr_in s_udp_in;
struct Ip_sockaddr_in s_udp_out;
Ip_u32 flags;
Ipmip4_pkt_udp_register_t udp_in;
Ipmip4_pkt_udp_register_t udp_out;
/* Callbacks */
Ipmip4_pkt_udp_cb_t udp;
Ipmip4_pkt_icmp_cb_t icmp;
Ipmip4_pkt_packet_cb_t packet;
} Ipmip4_pkt_context_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_pkt_context_destroy - ipmip4_pkt_context_destroy
*
* Destroy the packet context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL void ipmip4_pkt_context_destroy
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc
);
/*******************************************************************************
*
* ipmip4_pkt_context_create - ipmip4_pkt_context_create
*
* Create the packet context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i flags
* Flags what packet context features we need.
* \i udp
* UDP callback
* \i icmp
* ICMP callback
* \i packet
* Packet callback
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_context_create
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 flags,
Ipmip4_pkt_udp_cb_t udp,
Ipmip4_pkt_icmp_cb_t icmp,
Ipmip4_pkt_packet_cb_t packet
);
/*******************************************************************************
*
* ipmip4_pkt_context_start - ipmip4_pkt_context_start
*
* Start the packet context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_context_start
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc
);
/*******************************************************************************
*
* ipmip4_pkt_context_stop - ipmip4_pkt_context_stop
*
* Stops the packet thread.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL void ipmip4_pkt_context_stop
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc
);
/*******************************************************************************
*
* ipmip4_pkt_icmp_write - ipmip4_pkt_icmp_write
*
* Write an ICMP message to a link local host.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i payload
* The payload packet
* \i from
* The source
* \i to
* The destination
* \i iff
* Outgoing interface
* \i lladdr
* Link level address
* \ie
*
* RETURNS: IP_TRUE if successful.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_icmp_write
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip_buffer_t *payload,
Ip_u32 from,
Ip_u32 to,
Ipmip4_if_t *iff,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_pkt_icmp_sendmsg - ipmip4_pkt_icmp_sendmsg
*
* Send an ICMP message
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i payload
* The payload packet
* \i from
* The source
* \i to
* The destination
* \i iff
* Outgoing interface
* \i ttl
* TTL
* \ie
*
* RETURNS: IP_TRUE if successful.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_icmp_sendmsg
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip_buffer_t *payload,
Ip_u32 from,
Ip_u32 to,
Ipmip4_if_t *iff,
Ip_u8 ttl
);
/*******************************************************************************
*
* ipmip4_pkt_udp_sendmsg - ipmip4_pkt_udp_sendmsg
*
* Send a UDP message to a remote host
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i payload
* The payload buffer
* \i from
* The source address
* \i from_port
* The source port in network byte order
* \i to
* The destination address
* \i to_port
* The destination port in network byte order
* \i iff
* If set; the interface to force the output on.
* \ie
*
* RETURNS: The resulting return code.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL int ipmip4_pkt_udp_sendmsg
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip_buffer_t *payload,
Ip_u32 from,
Ip_u16 from_port,
Ip_u32 to,
Ip_u16 to_port,
Ipmip4_if_t *iff
);
/*******************************************************************************
*
* ipmip4_pkt_udp_write - ipmip4_pkt_udp_write
*
* Send a UDP message to a link local host with the
* indicated MAC address.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i payload
* The payload buffer
* \i from
* The source address
* \i from_port
* The source port in netwrok byte order
* \i to
* The destination address
* \i to_port
* The destination port in network byte order
* \i iff
* Outgoing interface
* \i lladdr
* MAC address
* \ie
*
* RETURNS: The resulting return code.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL int ipmip4_pkt_udp_write
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip_buffer_t *payload,
Ip_u32 from,
Ip_u16 from_port,
Ip_u32 to,
Ip_u16 to_port,
Ipmip4_if_t *iff,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_pkt_arp_write - ipmip4_pkt_arp_write
*
* Send an ARP message to specific destination
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i from
* From IP address
* \i to
* To IP address
* \i iff
* Outgoing interface
* \i lladdr
* LLA destination
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL void ipmip4_pkt_arp_write
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 from,
Ip_u32 to,
Ipmip4_if_t *iff,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_pkt_icmp_echo_request - ipmip4_pkt_icmp_echo_request
*
* Send an echo request message
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i from
* Source IP
* \i to
* Destination IP
* \i iff
* Outgoing interface
* \ie
*
* RETURNS: IP_TRUE if successful.
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_icmp_echo_request
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 from,
Ip_u32 to,
Ipmip4_if_t *iff
);
/*******************************************************************************
*
* ipmip4_pkt_icmp_join - ipmip4_pkt_icmp_join
*
* Join a specific multicast group
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i group
* The group
* \i ifindex
* The ifindex
* \ie
*
* RETURNS: IP_TRUE on success
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL Ip_bool ipmip4_pkt_icmp_join
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ip_u32 group,
Ip_u32 ifindex
);
/*******************************************************************************
*
* ipmip4_pkt_udp_register - ipmip4_pkt_udp_register
*
* Register a UDP socket to the packet loop. Packets received on these
* sockets will be fed through the provided callback.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i udpr
* UDP registration structure.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_pkt_udp_register
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_pkt_udp_register_t *udpr
);
/*******************************************************************************
*
* ipmip4_pkt_udp_unregister - ipmip4_pkt_udp_unregister
*
* Unregister a UDP socket from the packet loop.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i udpr
* UDP registration structure.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_pkt_udp_unregister
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
Ipmip4_pkt_udp_register_t *udpr
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,99 @@
/* ipmip4_pktbuf.h - ipmip4_pktbuf.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_pktbuf.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_pktbuf.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_PKTBUF_H
#define IPMIP4_PKTBUF_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Packet buffer base class, which is usually overloaded by the various
* mobile agents and nodes in order to contain instantiation specific
* information.
*/
/*
DESCRIPTION
Packet buffer base class, which is usually overloaded by the various
mobile agents and nodes in order to contain instantiation specific
information.
This header file defines the IPMIP4 overloaded packet buffer. For examples
and more extensive explanation, see ipmip_pktbuf.h
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_pktbuf.h>
#include <private/ipmip4_msgext.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
union Ipmip4_pktbuf_ext
{
Ipmip4_msgext_icmp_t icmp;
Ipmip4_msgext_mobile_t mobile;
};
typedef struct Ipmip4_pktbuf
{
Ipmip_pktbuf_t ipmip;
union Ipmip4_pktbuf_ext ext;
} Ipmip4_pktbuf_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,723 @@
/* ipmip4_radius.h - ipmip4_radius.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_radius.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_radius.h,v $
* $Author: jhorteli $ $Date: 2011-01-21 15:31:36 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_RADIUS_H
#define IPMIP4_RADIUS_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Generic radius wrapper for use with AAA radius support. The functions
* declared here MUST be instantiated in another file provided by the
* customer, unless IPRADIUS is being used.
*/
/*
DESCRIPTION
Generic radius wrapper for use with AAA radius support. The functions
declared here MUST be instantiated in another file provided by the
customer, unless IPRADIUS is being used.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_RADIUS_ATTR_User_Name 1
#define IPMIP4_RADIUS_ATTR_User_Password 2
#define IPMIP4_RADIUS_ATTR_NAS_IP_Address 4
#define IPMIP4_RADIUS_ATTR_Framed_IP_Address 8
#define IPMIP4_RADIUS_ATTR_Vendor_Specific 26
#define IPMIP4_RADIUS_ATTR_Tunnel_Password 69
#define IPMIP4_RADIUS_VENDOR_3GGP2 5535
# define IPMIP4_RADIUS_VENDOR_3GPP2_Home_Agent_IP_Address 7
# define IPMIP4_RADIUS_VENDOR_3GPP2_MN_HA_SPI 57
# define IPMIP4_RADIUS_VENDOR_3GPP2_MN_HA_SHARED_KEY 58
# define IPMIP4_RADIUS_VENDOR_3GPP2_Foreign_Agent_Address 79
# define IPMIP4_RADIUS_VENDOR_3GPP2_MN_AAA_Removal_Indication 81
# define IPMIP4_RADIUS_VENDOR_3GPP2_MN_MIP4_Mesg_Id 173
#define IPMIP4_RADIUS_VENDOR_CISCO 9
#define IPMIP4_RADIUS_ACCT_Input_Octets 42
#define IPMIP4_RADIUS_ACCT_Output_Octets 43
#define IPMIP4_RADIUS_ACCT_Session_Time 46
#define IPMIP4_RADIUS_ACCT_Input_Packets 47
#define IPMIP4_RADIUS_ACCT_Output_Packets 48
#define IPMIP4_RADIUS_ACCT_Input_Gigawords 52
#define IPMIP4_RADIUS_ACCT_Output_Gigawords 53
/* Generic attribute macros */
#define IPMIP4_RADIUS_ATTR_TYPE(x) (((Ip_u8 *)(x))[0])
#define IPMIP4_RADIUS_ATTR_LEN(x) (((Ip_u8 *)(x))[1])
#define IPMIP4_RADIUS_ATTR_DATA(x,o) (((Ip_u8 *)(x)) + 2 + (o))
/* VSA specific macros */
#define IPMIP4_RADIUS_ATTR_VSA_VENDOR(x) IP_GET_NTOHL(IPMIP4_RADIUS_ATTR_DATA((x),0))
#define IPMIP4_RADIUS_ATTR_VSA_TYPE(x) (*IPMIP4_RADIUS_ATTR_DATA((x), 4))
#define IPMIP4_RADIUS_ATTR_VSA_LEN(x) (*IPMIP4_RADIUS_ATTR_DATA((x), 5))
#define IPMIP4_RADIUS_ATTR_VSA_DATA(x) IPMIP4_RADIUS_ATTR_DATA((x), 6)
#define IPMIP4_RADIUS_AUTH_CHAP 0
#define IPMIP4_RADIUS_AUTH_USER_PASSWORD 1
#define IPMIP4_RADIUS_ACCESS_REQUEST_SUCCESS (0)
#define IPMIP4_RADIUS_ACCESS_REQUEST_FAILURE (1)
#define IPMIP4_RADIUS_ACCOUNTING_START (2)
#define IPMIP4_RADIUS_ACCOUNTING_FAILED (3)
#define IPMIP4_RADIUS_ACCOUNTING_STOP (5)
#define IPMIP4_RADIUS_ACCOUNTING_START_RESPONSE (6)
#define IPMIP4_RADIUS_ACCOUNTING_STOP_RESPONSE (7)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip4_pktbuf;
struct Ipmip4_radius_context;
union Ipmip4_msgext_uhdr;
struct Ipmip_cli_message;
typedef void Ipmip4_radius_packet_t;
typedef void (*Ipmip4_radius_func_t) (int result,
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
struct Ipmip4_pktbuf *pbuf,
void *arg,
Ipmip4_radius_packet_t *request,
Ipmip4_radius_packet_t *reply);
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_radius_context_create - ipmip4_radius_context_create
*
* Create a radius context if so specified by the configuration
* parameters
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i format
* Base configuration path
* \i ...
* The format parameters
* \ie
*
* RETURNS: A radius context if properly configured and enabled
*
* ERRNO:
*
*/
IP_GLOBAL struct Ipmip4_radius_context * ipmip4_radius_context_create
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
const char *defbase,
const char *format,
...
);
/*******************************************************************************
*
* ipmip4_radius_context_dump - ipmip4_radius_context_dump
*
* Dump a radius context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i request
* CLI request
* \i format
* Base configuration path
* \i ...
* The format parameters
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
* NOMANUAL
*/
IP_GLOBAL void ipmip4_radius_context_dump
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
struct Ipmip_cli_message *request,
const char *format,
...
);
/*******************************************************************************
*
* ipmip4_radius_context_destroy - ipmip4_radius_context_destroy
*
* Stop and destroy a radius context
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context.
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_radius_context_destroy
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius
);
/*******************************************************************************
*
* ipmip4_radius_access_request - ipmip4_radius_access_request
*
* Do an ordinary access request; no challenge provided
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i func
* Radius callback function
* \i msg
* The radius packet
* \i pbuf
* Current transaction
* \i arg
* Extra arg
* \i auth_type
* Auth Type
* \ie
*
* RETURNS: IP_TRUE on successful request transmission.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_radius_access_request
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_func_t func,
Ipmip4_radius_packet_t *msg,
struct Ipmip4_pktbuf *pbuf,
void *arg,
int auth_type
);
/*******************************************************************************
*
* ipmip4_radius_access_request_init - ipmip4_radius_access_request_init
*
* Create a radius access base message
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \ie
*
* RETURNS: A message structure if successful
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_radius_packet_t* ipmip4_radius_access_request_init
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius
);
/*******************************************************************************
*
* ipmip4_radius_access_request_free - ipmip4_radius_access_request_free
*
* Free a radius access base message
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i msg
* Message
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_radius_access_request_free
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_packet_t *msg
);
/*******************************************************************************
*
* ipmip4_radius_attr_add - ipmip4_radius_attr_add
*
* Add a radius extension
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i msg
* Message
* \i type
* Type of extension
* \i data
* Payload
* \i size
* Size of payload
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_radius_attr_add
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_packet_t *msg,
Ip_u8 type,
void *data,
Ip_size_t size
);
/*******************************************************************************
*
* ipmip4_radius_attr_next - ipmip4_radius_attr_next
*
* Get next radius extension
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i msg
* Message
* \i last
* Last retrieved attribute or IP_NULL if first.
* \ie
*
* RETURNS: The next available attribute, or IP_NULL if no more attributes
* are available.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 * ipmip4_radius_attr_next
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_packet_t *msg,
Ip_u8 *last
);
/*******************************************************************************
*
* ipmip4_radius_accounting_start - ipmip4_radius_accounting_start
*
* Start radius accounting for the session
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i func
* Callback function
* \i unique_id
* Unique session ID
* \i pbuf
* Packet buffer
* \i arg
* Extra arg
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_radius_accounting_start
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_func_t func,
Ip_u32 unique_id,
struct Ipmip4_pktbuf *pbuf,
void *arg
);
/*******************************************************************************
*
* ipmip4_radius_accounting_stop - ipmip4_radius_accounting_stop
*
* Stop radius accounting for the session
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i unique_id
* Unique session ID
* \ie
*
* RETURNS: IP_TRUE on success.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip4_radius_accounting_stop
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ip_u32 unique_id
);
/*******************************************************************************
*
* ipmip4_radius_aaah - ipmip4_radius_aaah
*
* Return the AAAH NAI for a radius context. The memory is dynamically
* allocated and must be freed by the caller.
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius AAAH NAI
* \ie
*
* RETURNS: The AAAH NAI.
*
* ERRNO:
*
*/
IP_GLOBAL union Ipmip4_msgext_uhdr * ipmip4_radius_aaah
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius
);
/*******************************************************************************
*
* ipmip4_radius_decrypt_tunnel_password - ipmip4_radius_decrypt_tunnel_password
*
* Decrypt a RADIUS AVP encrypted using tunnel password
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i request
* Radus request packet
* \i attr
* Attribute
* \i attr_len
* Length of attribute
* \i buf
* A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h
* for more information regarding dynamic buffers and their capabilities. This
* buffer is used to store the decrypted AVP in.
* \ie
*
* RETURNS: A pointer to the decrypted value in the buffer.
*
* ERRNO:
*
*/
IP_GLOBAL const char *ipmip4_radius_decrypt_tunnel_password
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_packet_t *request,
Ip_u8 *attr,
Ip_size_t attr_len,
Ipmip_buffer_t *buf
);
/*******************************************************************************
*
* ipmip4_radius_attr_vendor_add - ipmip4_radius_attr_vendor_add
*
* Add a radius VSA
*
* Parameters:
* \is
* \i ctx
* The generic mobility singleton context for IPMIP4. For each started mobility
* entity, there exists a mobility context which tracks configuration, system
* events, available features and started processes. The mobility context is
* created using ipmip4_context_create(). See ipmip4_context.h for
* more information regarding the mobility entity context singleton.
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i radius
* Radius context
* \i msg
* Message
* \i vendor
* Vendor
* \i type
* Vendor Type
* \i data
* Payload
* \i size
* Size of payload
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_radius_attr_vendor_add
(
struct Ipmip4_context *ctx,
struct Ipmip_proc *proc,
struct Ipmip4_radius_context *radius,
Ipmip4_radius_packet_t *msg,
Ip_u32 vendor,
Ip_u8 type,
void *data,
Ip_size_t size
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,449 @@
/* ipmip4_sysext.h - ipmip4_sysext.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_sysext.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_sysext.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_SYSEXT_H
#define IPMIP4_SYSEXT_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Extended system configuration utility functions. These functions provide
* ease-of-use configuration retrieval mechanisms.
*/
/*
DESCRIPTION
Extended system configuration utility functions. These functions provide
ease-of-use configuration retrieval mechanisms.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_clib2.h>
#include <ipcom_list.h>
#include <ipcom_route.h>
#include <private/ipmip_sysvar.h>
#include <private/ipmip4_auth.h>
#include <private/ipmip4_msgext.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_auth_spi;
extern Ipmip_sysvar_key_map_t ipmip4_sysext_spi_method[];
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_sysext_nvse_alloc - ipmip4_sysext_nvse_alloc
*
* Create an NVSE extension based on vendor, subtype and data
*
* Parameters:
* \is
* \i vendor
* Vendor ID
* \i subtype
* Vendor NVSE subtype
* \i data
* The vendor value
* \i size
* The size of value
* \ie
*
* RETURNS: The newly allocated NVSE structure
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_uhdr_t * ipmip4_sysext_nvse_alloc
(
Ip_u32 vendor,
Ip_u16 subtype,
void *data,
Ip_size_t size
);
/*******************************************************************************
*
* ipmip4_sysext_cvse_alloc - ipmip4_sysext_cvse_alloc
*
* Create an CVSE extension based on vendor, subtype and data
*
* Parameters:
* \is
* \i vendor
* Vendor ID
* \i subtype
* Vendor CVSE subtype
* \i data
* The vendor value
* \i size
* The size of value
* \ie
*
* RETURNS: The newly allocated CVSE structure
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_uhdr_t * ipmip4_sysext_cvse_alloc
(
Ip_u32 vendor,
Ip_u16 subtype,
void *data,
Ip_size_t size
);
/*******************************************************************************
*
* ipmip4_sysext_foreach_spi - ipmip4_sysext_foreach_spi
*
* Parse the configured SPI's
*
* Parameters:
* \is
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i name
* Name of the sysvar key
* \i subkey
* The matched subkey
* \i value
* The SPI value
* \i spictx
* The spi context
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_sysext_foreach_spi
(
struct Ipmip_proc *proc,
char *name,
char *subkey,
const char *value,
Ipmip4_auth_context_t *spictx
);
/*******************************************************************************
*
* ipmip4_sysext_foreach_spiroute - ipmip4_sysext_foreach_spiroute
*
* Parse the configured SPI lookup definitions
*
* Parameters:
* \is
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i name
* Name of the sysvar key
* \i subkey
* The matched subkey
* \i value
* The SPI value
* \i rtab
* The route table
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_sysext_foreach_spiroute(struct Ipmip_proc *proc,
char *name,
char *subkey,
const char *value,
Ipmip4_auth_spi_table_t *rtab);
/*******************************************************************************
*
* ipmip4_sysext_foreach_spihash - ipmip4_sysext_foreach_spihash
*
* Parse the configured SPI lookup definitions regarding NAI's
*
* Parameters:
* \is
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i name
* Name of the sysvar key
* \i subkey
* The matched subkey
* \i value
* The SPI value
* \i htable
* The spu hash table
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_sysext_foreach_spihash
(
struct Ipmip_proc *proc,
char *name,
char *subkey,
const char *value,
Ipmip4_auth_spi_hash_t *htable
);
/*******************************************************************************
*
* ipmip4_sysext_nai_aaah - ipmip4_sysext_nai_aaah
*
* Parse and create a NAI AAAH from a sysvar
*
* Parameters:
* \is
* \i format
* The sysvar format key.
* \i ...
* Optional arguments
* \ie
*
* RETURNS: The newly allocated AAAH NAI structure
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_shdr_t * ipmip4_sysext_nai_aaah
(
const char *format,
/* args */ ...
);
/*******************************************************************************
*
* ipmip4_sysext_nai_ha - ipmip4_sysext_nai_ha
*
* Parse and create a NAI HA from a sysvar
*
* Parameters:
* \is
* \i format
* The sysvar format key.
* \i ...
* Optional arguments
* \ie
*
* RETURNS: The allocated HA NAI structure
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_shdr_t * ipmip4_sysext_nai_ha
(
const char *format,
/* args */ ...
);
/*******************************************************************************
*
* ipmip4_sysext_nai_mn - ipmip4_sysext_nai_mn
*
* Parse and create a NAI MN from a sysvar
*
* Parameters:
* \is
* \i format
* The sysvar format key.
* \i ...
* Optional arguments
* \ie
*
* RETURNS: The allocated MN NAI structure
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_shdr_t * ipmip4_sysext_nai_mn
(
const char *format,
/* args */ ...
);
/*******************************************************************************
*
* ipmip4_sysext_tunnel_type - ipmip4_sysext_tunnel_type
*
* Interpret a tunnel protocol to its tunnel type index
*
* Parameters:
* \is
* \i deftype
* Default type index
* \i format
* The sysvar format string
* \i ...
* The optional arguments
* \ie
*
* RETURNS: -1 on error, deftype on none, tunnel type index otherwise
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_sysext_tunnel_type
(
int deftype,
const char *format,
/* args */ ...
);
/*******************************************************************************
*
* ipmip4_sysext_spi_parse - ipmip4_sysext_spi_parse
*
* Parse a SPI definition defined in the format specification
* provided in this function call.
*
* Parameters:
* \is
* \i proc
* The process context associated with the currently executing thread. Each
* thread and/or process in MIP must have its own unique process context.
* If a process is started using ipmip_proc_start, the process context will
* be allocated automatically by the IPMIP framework. Otherwise it must
* be allocated using ipmip_proc_alloc().
* \i defspi
* The default SPI used if spi is zero and no
*
* SPI is defined in the format context.
* \i spi
* The spi to use
* \i secret
* The secret to use. If not specified, will be
*
* parsed in the format context.
* \i delim
* Pre-delimitor to be prepended to all format
*
* context parsings.
* \i format
* Format string
* \i ...
* Format arguments
* \ie
*
* RETURNS: The parsed security association.
*
* ERRNO:
*
*/
IP_GLOBAL struct Ipmip4_auth_spi * ipmip4_sysext_spi_parse
(
struct Ipmip_proc *proc,
Ip_u32 defspi,
Ip_u32 spi,
const char *secret,
const char *delim,
const char *format,
...
);
/*******************************************************************************
*
* ipmip4_sysext_nai_aaah_create - ipmip4_sysext_nai_aaah_create
*
* Create a AAAH nai based on provided data
*
* Parameters:
* \is
* \i data
* The data
* \i data_length
* The length of data
* \ie
*
* RETURNS: The AAAH Nai.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_msgext_shdr_t * ipmip4_sysext_nai_aaah_create
(
Ip_u8 *data,
Ip_size_t data_length
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,79 @@
/* ipmip4_usr.h - ipmip4_usr.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_usr.h,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_usr.h,v $
* $Author: jhorteli $ $Date: 2010-10-21 12:21:20 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_USR_H
#define IPMIP4_USR_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Wrapper functions to register information with the kernel.
*/
/*
DESCRIPTION
Wrapper functions to register information with the kernel. NO LONGER USED.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_context;
struct Ipmip_proc;
struct Ipmip4_if;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,97 @@
/* ipmip4_util.h - ipmip4_util.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_util.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_util.h,v $
* $Author: jhorteli $ $Date: 2009-03-31 14:59:24 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_UTIL_H
#define IPMIP4_UTIL_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Miscellaneous utility functions used by the MIP4 system
*/
/*
DESCRIPTION
Miscellaneous utility functions used by the MIP4 system
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_util.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_EVENT_IF(x, proc, call) IPMIP_DO_IF(x, IPMIP4_EVENT_PRIORITY, proc, call)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_util_now - ipmip4_util_now
*
* Return current NTP time
*
* Parameters:
*
* None.
*
* RETURNS: The current NTP time
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u32 ipmip4_util_now
(
void
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/