/* 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 ****************************************************************************** */ #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 **************************************************************************** */