This commit is contained in:
zhangsz
2025-03-03 11:01:26 +08:00
parent 5f1710dc22
commit dae6fc93f7
1057 changed files with 519829 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2013, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
#ifndef _EXTENSION_H
#define _EXTENSION_H
#ifdef __cplusplus
extern "C" {
#endif
/* Include definition of freeDiameter API */
#include "freeDiameter-host.h"
#include "libfdcore.h"
/* Macro that define the entry point of the extension */
#define EXTENSION_ENTRY(_name, _function, _depends...) \
const char *fd_ext_depends[] = { _name , ## _depends , NULL }; \
static int extension_loaded = 0; \
int fd_ext_init(int major, int minor, char * conffile) { \
if ((major != FD_PROJECT_VERSION_MAJOR) \
|| (minor != FD_PROJECT_VERSION_MINOR)) { \
TRACE_ERROR("This extension (" _name ") was compiled for a different version of freeDiameter."); \
TRACE_DEBUG(INFO, "daemon %d.%d != ext %d.%d", \
major, minor, \
FD_PROJECT_VERSION_MAJOR, FD_PROJECT_VERSION_MINOR); \
return EINVAL; \
} \
if (extension_loaded) { \
TRACE_ERROR("Extension (" _name ") cannot be loaded twice!"); \
return ENOTSUP; \
} \
extension_loaded++; \
return (_function)(conffile); \
}
#ifdef __cplusplus
}
#endif
#endif /* _EXTENSION_H */

View File

@@ -0,0 +1,106 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2013, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Configuration from compile-time */
#ifndef FD_IS_CONFIG
#define FD_IS_CONFIG
#ifdef __cplusplus
extern "C" {
#endif
#cmakedefine HAVE_NTOHLL
#cmakedefine HAVE_MALLOC_H
#cmakedefine HAVE_SIGNALENT_H
#cmakedefine HAVE_AI_ADDRCONFIG
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_STRNDUP
#cmakedefine HAVE_PTHREAD_BAR
#cmakedefine HOST_BIG_ENDIAN @HOST_BIG_ENDIAN@
#cmakedefine DISABLE_SCTP
#cmakedefine DEBUG_SCTP
#cmakedefine DEBUG_WITH_META
#cmakedefine SCTP_USE_MAPPED_ADDRESSES
#cmakedefine SCTP_CONNECTX_4_ARGS
#cmakedefine SKIP_DLCLOSE
#cmakedefine DIAMID_IDNA_IGNORE
#cmakedefine DIAMID_IDNA_REJECT
#cmakedefine DISABLE_PEER_EXPIRY
#cmakedefine WORKAROUND_ACCEPT_INVALID_VSAI
#cmakedefine GNUTLS_VERSION_210
#cmakedefine GNUTLS_VERSION_212
#cmakedefine GNUTLS_VERSION_300
#cmakedefine GNUTLS_VERSION_310
#cmakedefine ERRORS_ON_TODO
#cmakedefine DEBUG
#cmakedefine FD_PROJECT_BINARY "@FD_PROJECT_BINARY@"
#cmakedefine FD_PROJECT_NAME "@FD_PROJECT_NAME@"
#cmakedefine FD_PROJECT_VERSION_MAJOR @FD_PROJECT_VERSION_MAJOR@
#ifndef FD_PROJECT_VERSION_MAJOR
# define FD_PROJECT_VERSION_MAJOR 0
#endif /*FD_PROJECT_VERSION_MAJOR*/
#cmakedefine FD_PROJECT_VERSION_MINOR @FD_PROJECT_VERSION_MINOR@
#ifndef FD_PROJECT_VERSION_MINOR
# define FD_PROJECT_VERSION_MINOR 0
#endif /*FD_PROJECT_VERSION_MINOR*/
#cmakedefine FD_PROJECT_VERSION_REV @FD_PROJECT_VERSION_REV@
#ifndef FD_PROJECT_VERSION_REV
# define FD_PROJECT_VERSION_REV 0
#endif /*FD_PROJECT_VERSION_REV*/
#cmakedefine FD_PROJECT_VERSION_API @FD_PROJECT_VERSION_API@
#ifndef FD_PROJECT_VERSION_API
# define FD_PROJECT_VERSION_API 0
#endif /*FD_PROJECT_VERSION_API*/
#cmakedefine FD_PROJECT_COPYRIGHT "@FD_PROJECT_COPYRIGHT@"
#cmakedefine DEFAULT_CONF_PATH "@DEFAULT_CONF_PATH@"
#cmakedefine DEFAULT_EXTENSIONS_PATH "@DEFAULT_EXTENSIONS_PATH@"
#ifndef FD_DEFAULT_CONF_FILENAME
#define FD_DEFAULT_CONF_FILENAME "freeDiameter.conf"
#endif /* FD_DEFAULT_CONF_FILENAME */
/* Maximum number of hooks handlers that can be registered. Make this compilation option if needed */
#define FD_HOOK_HANDLE_LIMIT 5
#ifdef __cplusplus
}
#endif
#endif /* FD_IS_CONFIG */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
/* Following variable is expended at build time based on the result of "hg id" command */
#cmakedefine FD_PROJECT_VERSION_HG
#define FD_PROJECT_VERSION_HG_VAL "@FD_PROJECT_VERSION_HG@"

View File

@@ -0,0 +1,159 @@
#ifndef _GY_MSG_H
#define _GY_MSG_H
#define MAX_GY_PORT 16384// 8192
#define INVALID_GY_PORT 0xFFFF
#define NUMBER_LEN 32
#define GY_APN_LEN 64
//#define ADDRESS_LEN 64
#define CONTEXT_ID_LEN 128
typedef enum GY_MSG_TYPE
{
GY_MSG_CCR,
GY_MSG_CCA,
}_GY_MSG_TYPE;
typedef enum SERVICE_TYPE
{
ST_CS_VOICE,
ST_CS_SMS,
ST_CS_VEDIO,
ST_PS_DATA,
ST_PS_VEDIO,
}_SERVICE_TYPE;
typedef enum REQUEST_TYPE
{
RT_INITIAL_REQUEST=1,
RT_UPDATE_REQUEST,
RT_TERMINATE_REQUEST,
RT_EVENT_REQUEST,
}_REQUEST_TYPE;
typedef enum REQUEST_ACTION
{
RA_DIRECT_DEBITING = 0,
RA_REFUND_ACCOUNT = 1,
RA_CHECK_BALANCE = 2,
RA_PRICE_ENQUIRY = 3,
}_REQUEST_ACTION;
typedef enum CHECK_BALANCE_RESULT
{
CBR_ENOUGH_CREDIT = 0,
CBR_NO_CREDIT = 1,
}_CHECK_BALANCE_RESULT;
typedef enum REPORTING_REASON
{
RR_THRESHOLD = 0,
RR_QHT = 1,
RR_FINAL = 2,
RR_QUOTA_EXHAUSTED = 3,
RR_VALIDITY_TIME = 4,
RR_OTHER_QUOTA_TYPE = 5,
RR_RATING_CONDITION_CHANGE = 6,
RR_FORCED_REAUTHORISATION = 7,
RR_POOL_EXHAUSTED = 8,
}_REPORTING_REASON;
typedef struct gy_ccr
{
char caller[NUMBER_LEN];
char called[NUMBER_LEN];
char smsc[NUMBER_LEN];
char origin_caller[NUMBER_LEN];
char msc_addr[NUMBER_LEN];
char vlr_number[NUMBER_LEN];
char imsi[NUMBER_LEN];
char apn[GY_APN_LEN];
char cellid[16];
int sgsn_ip;
int ggsn_ip;
char request_action;
char cellid_presented;
//char mscc_presented;
char role_of_node;
//long balance_to_check;
float req_service_unit;
int service_key;
int reporting_reason;
int sent_msg_num;
long used_unit;
}_gy_ccr;
typedef struct gy_cca
{
int result;
int check_balance_result;
long grant_value;
long volume_threshold;
long time_threshold;
int is_final;
}_gy_cca;
typedef struct gy_msg
{
int fd_port;
int app_port;
enum GY_MSG_TYPE msg_type;
enum SERVICE_TYPE service_type;
enum REQUEST_TYPE request_type;
int request_number;
int service_identifier;
int rating_group;
char cxt_id[CONTEXT_ID_LEN];
struct msg_body
{
_gy_ccr ccr;
_gy_cca cca;
}msg_body;
}_gy_msg;
typedef struct gy_port
{
int used_flag;
int index;
long updated_ts;
int app_port;
char context_id[CONTEXT_ID_LEN];
enum SERVICE_TYPE service_type;
int request_number;
int as_client;
}_gy_port;
typedef struct gy_space
{
int cur_index;
int used_ports;
_gy_port gy_port[MAX_GY_PORT];
}_gy_space;
typedef struct gy_msg_stat
{
int ccr;
int ccr_init;
int ccr_update;
int ccr_terminate;
int ccr_event;
int cca;
int cca_init;
int cca_update;
int cca_terminate;
int cca_event;
}_gy_msg_stat;
typedef struct gy_stat
{
_gy_msg_stat send_stat;
_gy_msg_stat recv_stat;
}_gy_stat;
#endif