original files of m241
This commit is contained in:
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_radius.h,v $ $Revision: 1.7 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike_radius.h,v $
|
||||
* $Author: edahlber $ $Date: 2010-04-23 15:31:41 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#if !defined(IPIKE_RADIUS_H) && defined(IPIKE_USE_RADIUS) && defined(IPIKE_USE_EAP)
|
||||
#define IPIKE_RADIUS_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipike_config.h"
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <ipradius.h>
|
||||
#include <ipeap.h>
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#define IPIKE_RADIUS_MAX_KEY_LEN 64
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct Ipike_radius_server_st
|
||||
{
|
||||
Ip_u8 id;
|
||||
Ip_fd fd;
|
||||
Ipradius_server server;
|
||||
union Ip_sockaddr_union local_addr;
|
||||
} Ipike_radius_server;
|
||||
|
||||
typedef struct Ipike_radius_ctx_st
|
||||
{
|
||||
Ipike_radius_server* server;
|
||||
char identity[IPEAP_IDENTITY_MAX_LEN];
|
||||
Ipradius_header* last_msg;
|
||||
} Ipike_radius_ctx;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_create
|
||||
*===========================================================================
|
||||
* Description: Open a new connection towards a radius server and return a
|
||||
* context if successful.
|
||||
* Parameters: server_address - A string represtation of server address.
|
||||
* local_address - A string represtation of local address.
|
||||
* shared_secret - The shared secret used to secure the
|
||||
* connection.
|
||||
* Returns: A radius context if successful (otherwise IP_NULL)
|
||||
*/
|
||||
IP_GLOBAL Ipike_radius_ctx*
|
||||
ipike_radius_create(
|
||||
const char* ike_id,
|
||||
union Ip_sockaddr_union* server_addr,
|
||||
union Ip_sockaddr_union* local_addr,
|
||||
const char* shared_secret);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_free
|
||||
*===========================================================================
|
||||
* Description: Close the radius connection and free all allocated resources.
|
||||
* Parameters: server - The server that should be connected.
|
||||
* Returns: A radius context if successful (otherwise IP_NULL)
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipike_radius_free(Ipike_radius_ctx* ctx);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_send
|
||||
*===========================================================================
|
||||
* Description: Send a message to a radius server.
|
||||
* Parameters: ctx - The radius context.
|
||||
* unique_id - Buffer with unique id that will be returned at
|
||||
* receive.
|
||||
* unique_id_len - Length of unique id buffer.
|
||||
* pkt - The message to send.
|
||||
* Returns: IPIKE_SUCCESS
|
||||
* IPIKE_FAILED
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_radius_send(
|
||||
Ipike_radius_ctx* ctx,
|
||||
Ip_u8* unique_id,
|
||||
Ip_u32 unique_id_len,
|
||||
Ipeap_pkt* pkt);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_receive
|
||||
*===========================================================================
|
||||
* Description: Receive a message from a radius server.
|
||||
* Parameters: fd - The radius socket.
|
||||
* eap - Will receive the eap message (if successful).
|
||||
* unique_id - Buffer that will receive unique id that was sent.
|
||||
* unique_id_len - Length of unique id buffer.
|
||||
* Returns: IPIKE_SUCCESS
|
||||
* IPIKE_FAILED
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_radius_receive(
|
||||
Ip_fd fd,
|
||||
Ipike_value* eap,
|
||||
Ip_u8* unique_id,
|
||||
Ip_u32* unique_id_len,
|
||||
Ipradius_header** last_msg);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_process_pkt
|
||||
*===========================================================================
|
||||
* Description: Process EAP packet.
|
||||
* Parameters: ctx - The radius context.
|
||||
* Returns: IPEAP_FAILURE
|
||||
* IPEAP_PENDING_SEND_OUT_PKT
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_radius_process_pkt(
|
||||
Ipike_radius_ctx* ctx,
|
||||
Ip_u8* unique_id,
|
||||
Ip_u32 unique_id_len,
|
||||
Ipeap_pkt* pkt_in,
|
||||
Ipeap_pkt* pkt_out);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_process_dispatcher_event
|
||||
*===========================================================================
|
||||
* Description: A radius message is available on the socket. Find the
|
||||
* corresponing EAP exchange and process the message.
|
||||
* Parameters: fd - The radius socket.
|
||||
* Returns:
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipike_radius_process_dispatcher_event(Ip_fd fd);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_process_dispatcher_event
|
||||
*===========================================================================
|
||||
* Description: Extract key from radius message. Will return zero length key
|
||||
* if no key available.
|
||||
* Parameters: ctx - The radius context.
|
||||
* key - Buffer that will receive the key value.
|
||||
* key_len - Length of key buffer and will receive key length.
|
||||
* Returns:
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipike_radius_extract_key(Ipike_radius_ctx* ctx, Ip_u8* key, Ip_u32* key_len);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_startup
|
||||
*===========================================================================
|
||||
* Description: Initialize radius.
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_GLOBAL Ipike_error
|
||||
ipike_radius_startup(void);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipike_radius_shutdown
|
||||
*===========================================================================
|
||||
* Description: Finalize radius.
|
||||
* Parameters:
|
||||
* Returns:
|
||||
*/
|
||||
IP_GLOBAL void
|
||||
ipike_radius_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user