443 lines
14 KiB
C
443 lines
14 KiB
C
/* 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
|
|
****************************************************************************
|
|
*/
|