Files
2026-07-30 11:19:44 +05:30

527 lines
14 KiB
C

/* ipdiameter_eap.h - Diameter EAP head file */
/*
* Copyright (c) 2007 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement. No license to Wind River intellectual property rights
* is granted herein. All rights not licensed by Wind River are reserved
* by Wind River.
*/
/*
modification history
--------------------
01e,20mar09,tlu Add re-auth field to Diameter EAP request structure
01d,12mar09,tlu Modified EAP callback function prototyping
01c,14jan09,tlu Added DER structure deallocation function
01b,09dec08,tlu Added auth cookie and callback function prototype
01a,03dec08,tlu Created.
*/
#ifndef IPDIAMETER_EAP_H
#define IPDIAMETER_EAP_H
/*
****************************************************************************
* INCLUDE FILES
****************************************************************************
*/
#include <ipcom_tags.h>
#include <ipcom_type.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_list.h>
#include <ipcom_tmo2.h>
#include "ipdiameter_config.h"
#include <ipdiameter_constant.h>
#include <ipdiameter.h>
/*
****************************************************************************
* DEFINES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* Public TYPES
****************************************************************************
*/
/*
*===========================================================================
* Ipdiameter_tunneling
*===========================================================================
* This defines grouped tunneling AVP structure.
*/
typedef struct Ipdiameter_tunneling_struct
{
/* Tunnel-Type (must have) */
Ip_bool set_tunnel_type;
Ip_u32 tunnel_type;
/* Tunnel-Medium-Type (must have) */
Ip_bool set_tunnel_medium_type;
Ip_u32 tunnel_medium_type;
/* Tunnel-Client-Endpoint (must have) */
char *client_endpoint;
/* Tunnel-Server-Endpoint (must have) */
char *server_endpoint;
/* Tunnel-Preference (must have) */
Ip_bool set_tunnel_preference;
Ip_u32 tunnel_preference;
/* Tunnel-Client-Auth-Id (must have) */
char *client_auth_id;
/* Tunnel-Server-Auth-Id (must have) */
char *server_auth_id;
/* Tunnel-Assignment-Id (must have) */
char *assignment_id;
/* Tunnel-Password (must have) */
char *password;
/* Tunnel-Private-Group-Id (must have) */
char *private_group_id;
} Ipdiameter_tunneling;
/*
*===========================================================================
* Ipdiameter_customized_avp
*===========================================================================
* This defines customized AVP structure.
*/
typedef struct Ipdiameter_customized_avp_struct
{
Ipcom_list avp_list;
Ip_u8 flag; /* AVP flags */
Ip_u16 code; /* AVP code */
Ip_bool set_vendor_id;
Ip_u32 vendor_id; /* AVP vendor id: optional field,
present if V bit flag is set */
Ip_bool grouped_avp; /* Is a grouped AVP or not */
Ip_u8 *buf; /* AVP data: variable number/length
data field, must be multiple of
4 octets in length. */
} Ipdiameter_customized_avp;
/*
*===========================================================================
* Ipdiameter_eap_der
*===========================================================================
*/
typedef struct Ipdiameter_eap_der_struct
{
/* session-id (must have) */
char session_id[IPDIAMETER_MAX_SESSION_ID_SIZE];
/* dest-realm (optional in DER structure). If present, set */
/* the selected server in Diameter request structure to */
/* match this value */
char dest_realm[IPDIAMETER_MAX_FQDN_SIZE];
/* dest-host (optional). Same comment for dest-realm */
char dest_hostname[IPDIAMETER_MAX_FQDN_SIZE];
/* port-limit (optional) */
Ip_bool set_port_limit;
Ip_u32 port_limit;
/* user-name (optional) */
char user_name[IPDIAMETER_MAX_FQDN_SIZE];
/* eap-payload (must have) */
Ip_u16 eap_payload_length;
Ip_u8 *eap_payload;
/* eap-key-name (optional) */
char *eap_key_name;
/* service-type (optional) */
Ip_bool set_service_type;
Ip_u32 service_type;
/* state (optional) */
char *state;
/* authorization-lifetime (optinal) */
Ip_bool set_authorization_lifetime;
Ip_u32 authorization_lifetime;
/* auth-grace-period (optinal) */
Ip_bool set_auth_grace_period;
Ip_u32 auth_grace_period;
/* auth-session-state (optinal) */
Ip_bool set_auth_session_state;
Ip_u32 auth_session_state;
/* callback-number (optional) */
char *callback_number;
/* called-station-id (optional) */
char *called_station_id;
/* calling-station-id (optional) */
char *calling_station_id;
/* originating-line-info (optinal) */
char *originating_line_info;
/* connect-info (optinal) */
char *connect_info;
/* framed-compression (optional) */
Ip_bool set_framed_compression;
Ip_u32 framed_compression;
/* framed-interface-id (optional) */
Ip_bool set_framed_interface_id;
Ip_u64 framed_interface_id;
/* Framed-IP-Address (optional) */
char *framed_ip_address;
/* Framed-IPv6-Prefix (optional) */
char *framed_ipv6_prefix;
/* Framed-IP-Netmask (optional) */
char *framed_ip_netmask;
/* Framed-MTU (optional) */
Ip_bool set_framed_mtu;
Ip_u32 framed_mtu;
/* Framed-Protocol (optional) */
Ip_bool set_framed_protocol;
Ip_u32 framed_protocol;
/* grouped AVP -- Tunneling (optional) */
Ip_bool set_tunneling;
Ipdiameter_tunneling tunneling;
/* customized AVPs (optional) */
Ip_bool set_customized_avp;
Ipcom_list customized_avp_head;
}
Ipdiameter_eap_der;
/*
*===========================================================================
* Ipdiameter_eap_dea
*===========================================================================
*/
typedef struct Ipdiameter_eap_dea_struct
{
/* hop-by-hop id (must have) in Diameter header, RFC 3588, section 3 */
Ip_u32 hbh_id;
/* end-to-end id (must have) in Diameter header, RFC 3588, section 3 */
Ip_u32 e2e_id;
/* session-id (must have) */
char session_id[IPDIAMETER_MAX_SESSION_ID_SIZE];
/* user-name (optional) */
char user_name[IPDIAMETER_MAX_FQDN_SIZE];
/* eap-payload (optional) */
Ip_u16 eap_payload_length;
Ip_u8 *eap_payload;
/* eap-reissued-payload (optional) */
Ip_u16 eap_reissued_payload_length;
Ip_u8 *eap_reissued_payload;
/* eap-master_session_key (optional) */
char eap_master_session_key[IPDIAMETER_MAX_SESSION_ID_SIZE];
/* eap-key-name (optional) */
char *eap_key_name;
/* multi-round-time-out (optional) */
Ip_bool set_multi_round_time_out;
Ip_u32 multi_round_time_out;
/* accounting-eap-auth-method (optional) */
Ip_bool set_accounting_auth_method;
Ip_u64 accounting_auth_method;
/* service-type (optional) */
Ip_bool set_service_type;
Ip_u32 service_type;
/* class (optional) */
char *class_value;
/* configuration-token (optional) */
char *configuration_token;
/* acct-interim-interval (optional) */
Ip_bool set_acct_interim_interval;
Ip_u32 acct_interim_interval;
/* error-message (optional) */
char *error_message;
/* error-reporting-host (optional) */
char *error_reporting_host;
/* idle-timeout (optional) */
Ip_bool set_idle_timeout;
Ip_u32 idle_timeout;
/* authorization-lifetime (optional) */
Ip_bool set_authorization_lifetime;
Ip_u32 authorization_lifetime;
/* auth-grace-period (optional) */
Ip_bool set_auth_grace_period;
Ip_u32 auth_grace_period;
/* auth-session-state (optional) */
Ip_bool set_auth_session_state;
Ip_u32 auth_session_state;
/* re-auth-request-type (optional) */
Ip_bool set_re_auth_request_type;
Ip_u32 re_auth_request_type;
/* session-timeout (optional) */
Ip_bool set_session_timeout;
Ip_u32 session_timeout;
/* state (optional) */
char *state;
/* reply-message (optional) */
char *reply_message;
/* filter-id (optional) */
char *filter_id;
/* port-limit (optional) */
Ip_bool set_port_limit;
Ip_u32 port_limit;
/* callback-id (optional) */
char *callback_id;
/* callback-number (optional) */
char *callback_number;
/* framed-appletalk-link (optional) */
Ip_bool set_framed_appletalk_link;
Ip_u32 framed_appletalk_link;
/* framed-appletalk-network (optional) */
Ip_bool set_framed_appletalk_network;
Ip_u32 framed_appletalk_network;
/* framed-appletalk-zone (optional) */
char *framed_appletalk_zone;
/* framed-compression (optional) */
Ip_bool set_framed_compression;
Ip_u32 framed_compression;
/* framed-interface-id (optional) */
Ip_bool set_framed_interface_id;
Ip_u32 framed_interface_id;
/* framed-ip-address (optional) */
char *framed_ip_address;
/* framed-ipv6-prefix (optional) */
char *framed_ipv6_prefix;
/* framed-ipv6-pool (optional) */
char *framed_ipv6_pool;
/* framed-ipv6-route (optional) */
char *framed_ipv6_route;
/* framed-ip-netmask (optional) */
char *framed_ip_netmask;
/* framed-route (optional) */
char *framed_route;
/* framed-pool (optional) */
char *framed_pool;
/* framed-IPX-network (optional) */
Ip_bool set_framed_ipx_network;
Ip_u32 framed_ipx_network;
/* framed-MTU (optional) */
Ip_bool set_framed_mtu;
Ip_u32 framed_mtu;
/* framed-protocol (optional) */
Ip_bool set_framed_protocol;
Ip_u32 framed_protocol;
/* framed-routing (optional) */
Ip_bool set_framed_routing;
Ip_u32 framed_routing;
/* grouped AVP -- Tunneling (optional) */
Ip_bool set_tunneling;
Ipdiameter_tunneling tunneling;
/* customized AVPs (optional) */
Ip_bool set_customized_avp;
Ipcom_list customized_avp_head;
}
Ipdiameter_eap_dea;
/*
*===========================================================================
* Ipdiameter_eap_auth_cookie
*===========================================================================
*/
typedef Ip_err (*Ipdiameter_eap_callback_func_t)
(int event,
void *eap_context,
struct Ipdiameter_request_struct *req,
struct Ipdiameter_header *request_pkt,
struct Ipdiameter_header *reply_pkt);
typedef struct Ipdiameter_eap_auth_cookie_struct
{
/* EAP context associated with the request */
void *eap_context;
/* Result code from the request */
Ip_err retval;
/* EAP callback function */
Ipdiameter_eap_callback_func_t callback;
}
Ipdiameter_eap_auth_cookie;
/*
*===========================================================================
* Ipdiameter_eap_request
*===========================================================================
* Diameter EAP request structure for EAP authenticator to pass in service
* specific request information and supply the EAP callback function
*/
typedef struct Ipdiameter_eap_request_struct
{
/* EAP context associated with the request */
void *eap_context;
/* EAP callback function */
Ipdiameter_eap_callback_func_t callback;
/* Password information */
Ip_u32 pwd_type; /* password type:
IPDIAMETER_PAP_Password,
IPDIAMETER_CHAP_Password,
IPDIAMETER_No_Password */
char pwd[IPDIAMETER_MAX_PASSWORD_SIZE]; /* password */
Ip_u32 pwd_len; /* length of password */
Ip_u8 chap_ident; /* CHAP response ID */
Ip_u8 pad[3]; /* Unused, padding for alignment reasons */
/* server initiated re-auth request */
Ip_bool perform_re_auth;
/* whether to perform subseqent re-auth. */
/* (refer to draft-ietf-dime-rfc3588bits-xx,
section 8.3) */
/* DER data info to format DER package */
Ipdiameter_eap_der *der_data;
/*
* The following server information is only required and has effect for
* the first request in a session. Do NOT fill Destination-Host and
* Destination-Realm AVPs in the Dimaeter packets for any subseqent
* requests in the session.
*/
Ip_s8 selected_server;
/* Application selected server */
/* -1 means application didn't select any server */
/* if set,Destination-Host and Destination-Realm */
/* AVPs must match if they are present in the */
/* Diameter packet. */
Ip_u8 num_servers;
/* Number of valid entries in 'serv_list' below. */
/* User MUST supply at least one server, and no */
/* more than IPDIAMETER_MAX_SPECIFIED_SERVERS */
Ipdiameter_server serv_list[IPDIAMETER_MAX_SPECIFIED_SERVERS];
}
Ipdiameter_eap_request;
/*
****************************************************************************
* GLOBAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* Application APIs
****************************************************************************
*/
IP_PUBLIC Ip_err ipdiameter_eap_access_request(
Ipdiameter_eap_request *diameter_eap_req);
IP_PUBLIC void ipdiameter_eap_free_DER(Ipdiameter_eap_der *der_data);
#ifdef __cplusplus
}
#endif
#endif /* #ifndef IPDIAMETER_EAP_H */
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/