300 lines
9.1 KiB
C
300 lines
9.1 KiB
C
/* 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
|
|
****************************************************************************
|
|
*/
|