666 lines
23 KiB
C
666 lines
23 KiB
C
/* ipdiameter.h - Diameter 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
|
|
--------------------
|
|
01p,24apr09,tlu Update the Diameter version number to 2 as per
|
|
requirement from draft-ietf-dime-rfc3588bis-XXX
|
|
01o,20mar09,tlu Add re-auth field to request structure
|
|
01n,10mar09,tlu Fix Linux build warning
|
|
01m,11feb09,tlu Added definition for reserved bits in command flags
|
|
01l,12jan09,tlu Added Diameter EAP appl ID
|
|
01k,24apr08,ggz Added ipdiameter_set_wfd function
|
|
01j,25mar08,ggz Added prototypes for failover functions
|
|
01i,17apr08,tlu Add compile condition to call ipcom mutex utilities directly
|
|
for VxWorks, and call recursive semaphore for Linux
|
|
01h,01oct07,tlu Port to Linux
|
|
01g,08aug07,tlu Add TLS support
|
|
01f,01aug07,tlu Add session ID seed and node specific open function
|
|
01e,19jul07,tlu Move ipdiameter_avp_check() from application APIs to Diameter
|
|
internal APIs
|
|
01d,10jul07,tlu Add local node TCP listening port as a configuration parameter
|
|
01c,27jun07,tlu Add grouped AVP functions as application APIs
|
|
01b,19jun07,tlu Add AVP flags and vendor_id to ipdiameter_avp_add_** functions
|
|
01a,05apr07,tlu Created.
|
|
*/
|
|
|
|
#ifndef IPDIAMETER_H
|
|
#define IPDIAMETER_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>
|
|
|
|
#ifdef IPSSL
|
|
#include <openssl/ssl.h>
|
|
#else
|
|
typedef char SSL;
|
|
typedef char SSL_CTX;
|
|
#endif /* IPSSL */
|
|
|
|
#include "ipdiameter_config.h"
|
|
#include <ipdiameter_constant.h>
|
|
#include <ipdiameter_session.h>
|
|
#include <ipdiameter_peer.h>
|
|
#include <ipdiameter_tls.h>
|
|
#include <ipdiameter_routing.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPDIAMETER_ENABLE_REENTRANT
|
|
|
|
|
|
|
|
/* Syslog priority and facility. */
|
|
#undef IPCOM_SYSLOG_PRIORITY
|
|
#define IPCOM_SYSLOG_PRIORITY IPDIAMETER_SYSTEM_PRIORITY
|
|
#undef IPCOM_SYSLOG_FACILITY
|
|
#define IPCOM_SYSLOG_FACILITY IPCOM_LOG_IPDIAMETER
|
|
|
|
#define IPDIAMETER_LEAVE(xerrval) do { retval = xerrval; goto leave; } while(0)
|
|
#define IPDIAMETER_ERROUT(xerrval) do { retval = xerrval; goto errout; } while(0)
|
|
|
|
#define IPDIAMETER_AUTH_APP_ID(id) ((id == DIAMETER_NASREQ) || \
|
|
(id == DIAMETER_MIP) || \
|
|
(id == DIAMETER_EAP))
|
|
|
|
#define IPDIAMETER_ACCT_APP_ID(id) ((id == DIAMETER_Base_Accounting) || \
|
|
(id == DIAMETER_Credit_Control))
|
|
|
|
#define IPDIAMETER_VALID_APP_ID(id) ((id == DIAMETER_Common_Message) || \
|
|
(id == DIAMETER_NASREQ) || \
|
|
(id == DIAMETER_MIP) || \
|
|
(id == DIAMETER_Base_Accounting) || \
|
|
(id == DIAMETER_Credit_Control) || \
|
|
(id == DIAMETER_EAP) || \
|
|
(id == DIAMETER_Relay))
|
|
|
|
#define IPDIAMETER_VALID_COMMAND_CODE(code) ((code >= DIAMETER_CODE_MIN) && \
|
|
(code <= DIAMETER_CODE_MAX))
|
|
|
|
#define IPDIAMETER_MSEC(interval) (interval * 1000)
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* Public TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdiameter_server
|
|
*===========================================================================
|
|
*/
|
|
|
|
/* Ipdiameter_server server types: 'server_type' */
|
|
typedef enum
|
|
{
|
|
DIAMETER_ACCESS_SERVER = 1,
|
|
DIAMETER_ACCOUNTING_SERVER,
|
|
DIAMETER_FULL_SERVER
|
|
} Ipdiameter_server_type;
|
|
|
|
typedef struct Ipdiameter_server_struct
|
|
{
|
|
union Ip_sockaddr_union server_addr; /* Server IPv4/v6 socket address union */
|
|
|
|
Ipdiameter_server_type server_type;
|
|
|
|
|
|
/* secret to be shared between the DIAMETER client and this server */
|
|
Ip_u8 shared_secret[IPDIAMETER_MAX_SECRET_SIZE];
|
|
|
|
/* length of the shared secret */
|
|
Ip_u32 shared_secret_len;
|
|
|
|
/* server's realm and hostname */
|
|
char realm[IPDIAMETER_MAX_FQDN_SIZE];
|
|
char hostname[IPDIAMETER_MAX_FQDN_SIZE];
|
|
}
|
|
Ipdiameter_server;
|
|
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdiameter_header
|
|
*===========================================================================
|
|
*/
|
|
#define IPDIAMETER_HDRSIZE 20
|
|
#define IPDIAMETER_VERSION 1
|
|
#define IPDIAMETER_R_FLAG 0x80
|
|
#define IPDIAMETER_P_FLAG 0x40
|
|
#define IPDIAMETER_E_FLAG 0x20
|
|
#define IPDIAMETER_T_FLAG 0x10
|
|
#define IPDIAMETER_RES_FLAG 0x0F /* Reserved bits */
|
|
|
|
typedef struct Ipdiameter_header_struct
|
|
{
|
|
/* DIAMETER packet header. */
|
|
Ip_u8 version;
|
|
Ip_u8 length[3];
|
|
Ip_u8 flags;
|
|
Ip_u8 code[3];
|
|
Ip_u32 appl_id;
|
|
Ip_u32 hbh_id;
|
|
Ip_u32 e2e_id;
|
|
|
|
Ip_u8 avp[1]; /* variable number/length attribute field. */
|
|
}
|
|
Ipdiameter_header;
|
|
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdiameter_AVP_header
|
|
*===========================================================================
|
|
*/
|
|
#define DIAMETER_AVP_V_FLAG 0x80
|
|
#define DIAMETER_AVP_M_FLAG 0x40
|
|
#define DIAMETER_AVP_P_FLAG 0x20
|
|
|
|
typedef struct Ipdiameter_AVP_header_struct
|
|
{
|
|
/* DIAMETER packet AVP header. */
|
|
Ip_u32 code;
|
|
Ip_u8 flags;
|
|
Ip_u8 length[3];
|
|
Ip_u32 vendor_id; /* optional field, present if V bit flag is set */
|
|
Ip_u8 data[1]; /* variable number/length data field, must be
|
|
multiple of 4 octets in length. */
|
|
}
|
|
Ipdiameter_AVP_header;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdiameter_request
|
|
*===========================================================================
|
|
* The Ipdiameter_request structure is used for diameter applications to pass
|
|
* service specific request information and supply the user callback function
|
|
*/
|
|
|
|
|
|
/* pwd_type */
|
|
#define IPDIAMETER_No_Password 0
|
|
#define IPDIAMETER_PAP_Password 1
|
|
#define IPDIAMETER_CHAP_Password 2
|
|
|
|
|
|
typedef struct Ipdiameter_request_struct
|
|
{
|
|
void *cookie; /* handle for user callback. */
|
|
Ip_u32 unique; /* unique ID for each request to avoid spamming. */
|
|
/* will be used as the hop-by-hop id, and
|
|
end-to-end id at the request originating node */
|
|
Ip_err status; /* IPCOM_SUCCESS or IPCOM_ERR_FAILED. */
|
|
|
|
char session_id[IPDIAMETER_MAX_SESSION_ID_SIZE];
|
|
/* session id associated with the request. */
|
|
/* a string ends with "\0" */
|
|
/* session id should be formed as
|
|
local_host_FQDN;unique_ID
|
|
(refer to RFC 3588, section 8.8) */
|
|
|
|
Ip_u32 appl_id; /* Applicaiton ID, see RFC 3588, section 2.4 */
|
|
|
|
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 */
|
|
|
|
Ip_bool perform_re_auth;
|
|
/* whether to perform subseqent re-auth. */
|
|
/* (refer to draft-ietf-dime-rfc3588bits-xx,
|
|
section 8.3) */
|
|
|
|
/* Request event callback function pointer. */
|
|
Ip_err (*event_callback) (int event,
|
|
struct Ipdiameter_request_struct *request,
|
|
struct Ipdiameter_header *request_packet,
|
|
struct Ipdiameter_header *response_packet,
|
|
struct Ipdiameter_server *server) ;
|
|
|
|
/*
|
|
* 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_request;
|
|
|
|
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* LOCAL TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* IPDIAMETER data
|
|
*===========================================================================
|
|
*/
|
|
|
|
typedef struct Ipdiameter_data_struct
|
|
{
|
|
Ip_bool opened;
|
|
|
|
#ifdef IPDIAMETER_ENABLE_REENTRANT
|
|
Ipcom_mutex code_mutex; /* Mutex to protect IPDIAMETER global data. */
|
|
#endif
|
|
|
|
/* session ID seed */
|
|
Ip_u64 session_id_seed;
|
|
|
|
/* Timer related configurable parameters in seconds */
|
|
Ip_u16 session_timeout;
|
|
Ip_u16 auth_lifetime;
|
|
Ip_u16 auth_grace_period;
|
|
|
|
Ip_u16 peer_reconn_interval;
|
|
Ip_u16 max_reconn_attemp;
|
|
Ip_u16 watchdog_timeout;
|
|
Ip_u16 req_retx_interval;
|
|
Ip_u16 max_req_retx;
|
|
|
|
/* local host/node info */
|
|
union Ip_sockaddr_union addr;
|
|
char host_id[IPDIAMETER_MAX_FQDN_SIZE];
|
|
char realm_id[IPDIAMETER_MAX_FQDN_SIZE];
|
|
Ipdiameter_peer_type node_type;
|
|
Ip_u16 tcp_port;
|
|
|
|
/* supported application list */
|
|
Ip_u32 appl_ids[IPDIAMETER_MAX_APPL_IDS];
|
|
Ip_u32 num_appls;
|
|
|
|
/* vendor ID */
|
|
Ip_u32 vendor_id;
|
|
|
|
/* whether to terminate a session when receiving an ASR */
|
|
Ip_bool ASR_comply;
|
|
|
|
/* TLS related data */
|
|
Ip_bool tls_enabled;
|
|
char *certfile;
|
|
char *keyfile;
|
|
char *keypasswd;
|
|
char *cacertfile;
|
|
char *rootdir;
|
|
SSL_CTX *ssl_ctx;
|
|
|
|
/* Priority queue with all timeouts */
|
|
Ipcom_pqueue *tmo_head;
|
|
|
|
/* Diameter node TCP listening socket */
|
|
#ifdef IPCOM_USE_INET
|
|
/* Diameter node IPv4 TCP socket descriptor.
|
|
* Set to IP_INVALID_SOCKET if request shall not talk to IPv4 servers. */
|
|
Ip_fd fd;
|
|
#endif
|
|
#ifdef IPCOM_USE_INET6
|
|
/* Diameter node IPv6 TCP socket descriptor.
|
|
* Set to IP_INVALID_SOCKET if request shall not talk to IPv6 servers. */
|
|
Ip_fd fd6;
|
|
#endif
|
|
|
|
/* Current sessions */
|
|
Ip_u32 session_num; /* number of sessions. */
|
|
Ipcom_list session_head;
|
|
|
|
/* peer list */
|
|
Ip_u32 peer_num; /* number of peers. */
|
|
Ipcom_list peer_head;
|
|
|
|
/* select fd list */
|
|
Ip_u32 fd_num; /* number of fds */
|
|
Ipcom_list fd_head;
|
|
|
|
/* the process that currently holds the semaphore and taken counter */
|
|
Ip_pid_t pid;
|
|
Ip_u8 s_counter;
|
|
|
|
/* route entry list */
|
|
Ip_u32 route_num; /* number of route entries. */
|
|
Ipcom_list route_head;
|
|
|
|
/* policy entry list */
|
|
Ip_u32 policy_num; /* number of policy entries. */
|
|
Ipcom_list policy_head;
|
|
|
|
/* Close and exit functions, node specific open function */
|
|
Ip_err (*close) (void);
|
|
Ip_err (*exit) (void);
|
|
Ip_err (*open) (void);
|
|
|
|
/* MIP4 HAR callback function */
|
|
void (*user_callback) (Ip_u32 code,
|
|
Ipdiameter_header *packet,
|
|
Ipdiameter_peer_entry *peer,
|
|
void *opaque_callback_data);
|
|
void *opaque_callback_data;
|
|
|
|
/* Syslog output memory. */
|
|
char buf[48];
|
|
}
|
|
Ipdiameter_data;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* Ipdiameter_request_entry
|
|
*===========================================================================
|
|
*/
|
|
/* One for each request. Will be removed from request list (and thus no longer
|
|
* known to the protocol) once an answer has been received, or all servers
|
|
* have been tried.
|
|
*/
|
|
|
|
typedef struct Ipdiameter_request_entry_struct
|
|
{
|
|
Ipcom_list request_list;
|
|
|
|
|
|
/* seconds since the latest request packet was sent out */
|
|
Ip_time_t request_start_time;
|
|
|
|
/* timeout handler for request retransmission */
|
|
Ipcom_tmo2 retx_tmo;
|
|
Ip_u16 num_retx;
|
|
|
|
#ifdef IPDIAMETER_ENABLE_REENTRANT
|
|
Ipcom_mutex code_mutex; /* Mutex to protect request data. */
|
|
#endif
|
|
|
|
/* a diameter application request */
|
|
Ip_bool user_request;
|
|
|
|
/* the process that currently holds the semaphore and taken counter */
|
|
Ip_pid_t pid;
|
|
Ip_u8 s_counter;
|
|
|
|
Ipdiameter_session *session; /* session associated with request */
|
|
|
|
Ipdiameter_peer_entry *peer; /* peer associated with request */
|
|
Ipdiameter_agent_pending_packet_entry *agent_pkt_entry; /* pending packet entry. */
|
|
|
|
Ipdiameter_request request; /* User request structure. */
|
|
|
|
Ipdiameter_header hdr; /* DIAMETER packet.*/
|
|
}
|
|
Ipdiameter_request_entry;
|
|
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* Application APIs
|
|
****************************************************************************
|
|
*/
|
|
|
|
IP_PUBLIC Ipdiameter_header * ipdiameter_request_pkt_malloc(Ip_u32 length);
|
|
IP_PUBLIC Ip_err ipdiameter_request_pkt_free(Ipdiameter_header *packet);
|
|
IP_PUBLIC Ipdiameter_header * ipdiameter_answer_pkt_malloc(Ip_u32 length);
|
|
IP_PUBLIC Ip_err ipdiameter_answer_pkt_free(Ipdiameter_header *packet);
|
|
|
|
IP_PUBLIC void ipdiameter_set_hdr_code(Ip_u32 *packet, Ip_u32 code);
|
|
IP_PUBLIC Ip_u32 ipdiameter_get_hdr_code(Ip_u32 *packet);
|
|
IP_PUBLIC Ip_u32 ipdiameter_get_unique_id(void);
|
|
IP_PUBLIC Ip_err ipdiameter_get_session_id(char *session_id, Ip_u32 appl_id);
|
|
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_get_avp(Ipdiameter_header *hdr, Ip_u32 avp_code,
|
|
Ip_u32 *data_length, Ip_u8 **data);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_array(Ipdiameter_header *hdr,
|
|
Ip_u32 avp_code, Ip_u8 avp_flags, Ip_u32 *vendor_id,
|
|
Ip_u8 *data, Ip_u32 data_length);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_u32(Ipdiameter_header *hdr, Ip_u32 avp_code,
|
|
Ip_u8 avp_flags, Ip_u32 *vendor_id, Ip_u32 data);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_origin_host(Ipdiameter_header *message);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_origin_realm(Ipdiameter_header *message);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_host_address(Ipdiameter_header *message);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_ip_address(Ipdiameter_header *message,
|
|
Ip_u32 avp_code, Ip_u8 avp_flags, Ip_u32 *vendor_id,
|
|
union Ip_sockaddr_union addr);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_NAS_identifier(Ipdiameter_header *message);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_get_session_id(Ipdiameter_header *message,
|
|
char *session_id);
|
|
IP_PUBLIC Ip_err ipdiameter_avp_change_u32(Ipdiameter_header *hdr,
|
|
Ip_u32 avp_code, Ip_u32 data);
|
|
IP_PUBLIC void * ipdiameter_avp_get_next(Ipdiameter_header *hdr, Ip_u8 *avp);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_grouped_avp_add_array(Ipdiameter_AVP_header *hdr,
|
|
Ip_u32 avp_code, Ip_u8 avp_flags, Ip_u32 *vendor_id,
|
|
Ip_u8 *data, Ip_u32 data_length);
|
|
IP_PUBLIC Ip_err ipdiameter_grouped_avp_add_u32(Ipdiameter_AVP_header *hdr,
|
|
Ip_u32 avp_code, Ip_u8 avp_flags, Ip_u32 *vendor_id,
|
|
Ip_u32 data);
|
|
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_grouped_avp_get_avp(Ip_u8 *gavp_block,
|
|
Ip_u32 gavp_block_size, Ip_u32 avp_code,
|
|
Ip_u32 *data_length, Ip_u8 **data);
|
|
IP_PUBLIC void * ipdiameter_grouped_avp_get_next(Ip_u8 *gavp_block,
|
|
Ip_u32 gavp_block_size, Ip_u8 *avp);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_peer_pkt_send(Ipdiameter_peer_entry *peer,
|
|
Ipdiameter_header *package);
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_common_create(Ipdiameter_peer_type node_type);
|
|
IP_PUBLIC Ip_err ipdiameter_common_open(void);
|
|
IP_PUBLIC Ip_err ipdiameter_common_start(char *proc_name);
|
|
IP_PUBLIC Ip_err ipdiameter_common_stop(void);
|
|
IP_PUBLIC Ip_err ipdiameter_common_close(void);
|
|
IP_PUBLIC Ip_err ipdiameter_common_exit(void);
|
|
IP_PUBLIC const char *ipdiameter_version(void);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_node_add_session(Ipdiameter_session *session);
|
|
IP_PUBLIC void ipdiameter_node_remove_session(Ipdiameter_session *session);
|
|
IP_PUBLIC Ip_err ipdiameter_node_add_peer(Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC void ipdiameter_node_remove_peer(Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_err ipdiameter_select_add_fd(Ip_fd fd, Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_err ipdiameter_select_del_fd(Ip_fd fd);
|
|
IP_PUBLIC void ipdiameter_set_wfd(Ip_fd fd);
|
|
IP_PUBLIC void ipdiameter_node_show_peer(void);
|
|
IP_PUBLIC void ipdiameter_node_show_session(void);
|
|
IP_PUBLIC void ipdiameter_node_show_config(void);
|
|
IP_PUBLIC void ipdiameter_node_show_route(void);
|
|
IP_PUBLIC void ipdiameter_node_show_policy(void);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_avp_check(Ipdiameter_header *hdr,
|
|
Ipdiameter_request_entry *reqent, Ip_u8 *errattr);
|
|
IP_PUBLIC void ipdiameter_set_hdr_length(Ip_u32 *packet, Ip_u32 length);
|
|
IP_PUBLIC Ip_u32 ipdiameter_get_hdr_length(Ip_u32 *packet);
|
|
IP_PUBLIC void ipdiameter_set_avp_length(Ip_u32 *avp, Ip_u32 length);
|
|
IP_PUBLIC Ip_u32 ipdiameter_get_avp_length(Ip_u32 *avp);
|
|
|
|
IP_PUBLIC Ip_bool ipdiameter_check_request_pending(Ipdiameter_request_entry *reqent);
|
|
IP_PUBLIC void ipdiameter_reqent_free(Ipdiameter_request_entry *reqent);
|
|
IP_PUBLIC Ipdiameter_request_entry *
|
|
ipdiameter_request_entry_find(Ipdiameter_header *hdr,
|
|
union Ip_sockaddr_union *from_addr);
|
|
IP_PUBLIC void ipdiameter_reqent_set_session(Ipdiameter_request_entry *reqent,
|
|
Ipdiameter_session *session);
|
|
IP_PUBLIC void ipdiameter_reqent_set_peer(Ipdiameter_request_entry *reqent,
|
|
Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC void ipdiameter_reqent_copy_req(Ipdiameter_request_entry *reqent,
|
|
Ipdiameter_request *request);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_pkt_send(Ip_fd fd, SSL *ssl,
|
|
Ipdiameter_header *package);
|
|
IP_PUBLIC Ip_err ipdiameter_request_pkt_send(Ipdiameter_request_entry *reqent,
|
|
Ip_bool start_timer);
|
|
IP_PUBLIC Ip_err ipdiameter_session_pkt_send(Ipdiameter_session *session,
|
|
Ipdiameter_header *package);
|
|
IP_PUBLIC Ip_err ipdiameter_send_ASA(Ipdiameter_session *session, Ip_fd fd,
|
|
SSL *ssl, Ipdiameter_header *ASR_package,
|
|
Ip_u32 result_code);
|
|
IP_PUBLIC Ip_err ipdiameter_send_STR(Ipdiameter_session *session, Ip_u32 cause);
|
|
IP_PUBLIC Ip_err ipdiameter_send_CER(Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_err ipdiameter_send_CEA(Ipdiameter_peer_entry *peer,
|
|
Ipdiameter_header *CER_package, Ip_u32 result_code);
|
|
IP_PUBLIC Ip_err ipdiameter_send_DWR(Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_err ipdiameter_send_DWA(Ipdiameter_peer_entry *peer,
|
|
Ipdiameter_header *DWR_package, Ip_u32 result_code);
|
|
IP_PUBLIC Ip_err ipdiameter_send_DPR(Ipdiameter_peer_entry *peer, Ip_u32 cause);
|
|
IP_PUBLIC Ip_err ipdiameter_send_DPA(Ipdiameter_peer_entry *peer,
|
|
Ipdiameter_header *DPR_package, Ip_u32 result_code);
|
|
IP_PUBLIC Ip_err ipdiameter_send_RAA(Ipdiameter_session *session, Ip_fd fd,
|
|
SSL *ssl, Ipdiameter_header *RAR_package,
|
|
Ip_u32 result_code);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_avp_add_appl_ids(Ipdiameter_header *message);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_ctrl_recv(Ip_fd fd);
|
|
IP_PUBLIC Ip_err ipdiameter_recv(Ip_fd fd, Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_err ipdiameter_read(Ip_fd fd, void *buf, Ip_size_t len,
|
|
Ipdiameter_peer_entry *peer);
|
|
|
|
IP_PUBLIC char * ipdiameter_addr_to_str(union Ip_sockaddr_union *addr);
|
|
IP_PUBLIC char * ipdiameter_errname(Ip_err err);
|
|
|
|
IP_PUBLIC void ipdiameter_pkt_set_starttime(Ipdiameter_header *package);
|
|
IP_PUBLIC Ip_err ipdiameter_pkt_start_timer(Ipdiameter_header *package);
|
|
|
|
IP_PUBLIC Ip_err ipdiameter_set_server(Ipdiameter_session *session);
|
|
IP_PUBLIC void ipdiameter_reset_tried_servers(Ipdiameter_session *session);
|
|
|
|
|
|
IP_PUBLIC Ip_bool ipdiameter_inaddr_equal(union Ip_sockaddr_union *addr1,
|
|
union Ip_sockaddr_union *addr2);
|
|
IP_PUBLIC void ipdiameter_attr_add_message_auth(Ipdiameter_request_entry
|
|
*reqent);
|
|
IP_PUBLIC void ipdiameter_password_insert(Ipdiameter_request_entry *reqent);
|
|
|
|
IP_PUBLIC void ipdiameter_print_pkt(Ipdiameter_header *packet);
|
|
IP_PUBLIC void ipdiameter_print_peer(Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC void ipdiameter_print_session(Ipdiameter_session *session);
|
|
IP_PUBLIC void ipdiameter_print_request(Ipdiameter_request *request);
|
|
IP_PUBLIC void ipdiameter_print_reqent(Ipdiameter_request_entry *reqent);
|
|
|
|
IP_PUBLIC void ipdiameter_print_route(Ipdiameter_route_entry *route);
|
|
IP_PUBLIC Ip_bool ipdiameter_routing_packet(Ipdiameter_header *packet,
|
|
Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC Ip_bool ipdiameter_rerouting_packet(Ipdiameter_header *packet,
|
|
Ipdiameter_peer_entry *peer);
|
|
IP_PUBLIC void ipdiameter_print_policy(Ipdiameter_policy_entry *policy);
|
|
|
|
|
|
IP_PUBLIC Ipdiameter_request_entry
|
|
*ipdiameter_agent_request_entry_find( Ipdiameter_peer_entry *peer,
|
|
Ipdiameter_header *hdr);
|
|
IP_PUBLIC Ip_bool
|
|
ipdiameter_agent_packet_response( Ipdiameter_request_entry *entry,
|
|
Ipdiameter_header *hdr);
|
|
|
|
|
|
IP_PUBLIC void ipdiameter_lck(void);
|
|
IP_PUBLIC void ipdiameter_unlck(void);
|
|
IP_PUBLIC void ipdiameter_request_lck(Ipdiameter_request_entry *reqent);
|
|
IP_PUBLIC void ipdiameter_request_unlck(Ipdiameter_request_entry *reqent);
|
|
|
|
|
|
#ifdef IPDIAMETER_ENABLE_REENTRANT
|
|
|
|
#ifdef IP_PORT_VXWORKS
|
|
|
|
#define IPDIAMETER_LOCK() ipcom_mutex_lock(ipdiameter.code_mutex)
|
|
#define IPDIAMETER_UNLOCK() ipcom_mutex_unlock(ipdiameter.code_mutex)
|
|
|
|
#define IPDIAMETER_REQUEST_LOCK(request) ipcom_mutex_lock(request->code_mutex)
|
|
#define IPDIAMETER_REQUEST_UNLOCK(request) ipcom_mutex_unlock(request->code_mutex)
|
|
|
|
#else /* !IP_PORT_VXWORKS, Linux recursive semaphore */
|
|
|
|
#define IPDIAMETER_LOCK() ipdiameter_lck()
|
|
#define IPDIAMETER_UNLOCK() ipdiameter_unlck()
|
|
|
|
#define IPDIAMETER_REQUEST_LOCK(request) ipdiameter_request_lck(request)
|
|
#define IPDIAMETER_REQUEST_UNLOCK(request) ipdiameter_request_unlck(request)
|
|
|
|
#endif /* IP_PORT_VXWORKS */
|
|
|
|
#else
|
|
|
|
#define IPDIAMETER_LOCK() IP_NOOP
|
|
#define IPDIAMETER_UNLOCK() IP_NOOP
|
|
|
|
#define IPDIAMETER_REQUEST_LOCK(request) IP_NOOP
|
|
#define IPDIAMETER_REQUEST_UNLOCK(request) IP_NOOP
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* #ifndef IPDIAMETER_H */
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
|