TT#24224 Switch from BSD to C99 integer types

Change-Id: I9e20626e4bbb9c3cf5cbb8534204f53393f972b5
changes/61/16761/1
Guillem Jover 8 years ago
parent e65f1fa26a
commit 881f534e6d

28
cdr.c

@ -5,8 +5,8 @@
#include "config.h"
#include "mediator.h"
static int cdr_create_cdrs(med_entry_t *records, u_int64_t count,
cdr_entry_t **cdrs, u_int64_t *cdr_count, u_int8_t *trash);
static int cdr_create_cdrs(med_entry_t *records, uint64_t count,
cdr_entry_t **cdrs, uint64_t *cdr_count, uint8_t *trash);
static const char* cdr_map_status(const char *sip_status)
{
@ -38,22 +38,22 @@ static const char* cdr_map_status(const char *sip_status)
return CDR_STATUS_UNKNOWN;
}
int cdr_process_records(med_entry_t *records, u_int64_t count, u_int64_t *ext_count, struct medmysql_batches *batches)
int cdr_process_records(med_entry_t *records, uint64_t count, uint64_t *ext_count, struct medmysql_batches *batches)
{
int ret = 0;
u_int8_t trash = 0;
u_int64_t i;
uint8_t trash = 0;
uint64_t i;
u_int16_t msg_invites = 0;
u_int16_t msg_byes = 0;
u_int16_t msg_unknowns = 0;
u_int16_t invite_200 = 0;
uint16_t msg_invites = 0;
uint16_t msg_byes = 0;
uint16_t msg_unknowns = 0;
uint16_t invite_200 = 0;
char *callid = records[0].callid;
cdr_entry_t *cdrs = NULL;
u_int64_t cdr_count;
uint64_t cdr_count;
*ext_count = 0;
@ -580,11 +580,11 @@ static int cdr_parse_dstleg(char *dstleg, cdr_entry_t *cdr)
}
static int cdr_create_cdrs(med_entry_t *records, u_int64_t count,
cdr_entry_t **cdrs, u_int64_t *cdr_count, u_int8_t *trash)
static int cdr_create_cdrs(med_entry_t *records, uint64_t count,
cdr_entry_t **cdrs, uint64_t *cdr_count, uint8_t *trash)
{
u_int64_t i = 0, cdr_index = 0;
u_int32_t invites = 0;
uint64_t i = 0, cdr_index = 0;
uint32_t invites = 0;
size_t cdr_size;
char *endtime = NULL;

26
cdr.h

@ -23,12 +23,12 @@ typedef struct {
char source_ext_subscriber_id[256];
char source_ext_contract_id[256];
char source_provider_id[256];
u_int64_t source_account_id;
uint64_t source_account_id;
char source_user[256];
char source_domain[256];
char source_cli[65];
char source_ip[65];
u_int8_t source_clir;
uint8_t source_clir;
char source_gpp[10][255];
char source_lnp_prefix[256];
char source_user_out[256];
@ -38,13 +38,13 @@ typedef struct {
char destination_provider_id[256];
char destination_ext_subscriber_id[256];
char destination_ext_contract_id[256];
u_int64_t destination_account_id;
uint64_t destination_account_id;
char destination_user[256];
char destination_domain[256];
char destination_user_in[256];
char destination_domain_in[256];
char destination_dialed[256];
u_int64_t destination_lcr_id;
uint64_t destination_lcr_id;
char destination_gpp[10][255];
char destination_lnp_prefix[256];
char destination_user_out[256];
@ -61,19 +61,19 @@ typedef struct {
double start_time;
double duration;
u_int32_t source_carrier_cost;
u_int32_t source_reseller_cost;
u_int32_t source_customer_cost;
u_int32_t destination_carrier_cost;
u_int32_t destination_reseller_cost;
u_int32_t destination_customer_cost;
uint32_t source_carrier_cost;
uint32_t source_reseller_cost;
uint32_t source_customer_cost;
uint32_t destination_carrier_cost;
uint32_t destination_reseller_cost;
uint32_t destination_customer_cost;
u_int8_t split;
uint8_t split;
} cdr_entry_t;
int cdr_process_records(med_entry_t *records, u_int64_t count, u_int64_t *cdr_count, struct medmysql_batches *);
void cdr_fix_accids(med_entry_t *records, u_int64_t count);
int cdr_process_records(med_entry_t *records, uint64_t count, uint64_t *cdr_count, struct medmysql_batches *);
void cdr_fix_accids(med_entry_t *records, uint64_t count);
int cdr_fill_record(cdr_entry_t *cdr);
void cdr_set_provider(cdr_entry_t *cdr);

@ -4,8 +4,8 @@
#include "mediator.h"
unsigned int config_interval = MEDIATOR_DEFAULT_INTERVAL;
u_int8_t config_dumpcdr = MEDIATOR_DEFAULT_DUMPCDR;
u_int8_t config_daemonize = MEDIATOR_DEFAULT_DAEMONIZE;
uint8_t config_dumpcdr = MEDIATOR_DEFAULT_DUMPCDR;
uint8_t config_daemonize = MEDIATOR_DEFAULT_DAEMONIZE;
char *config_pid_path;
char *config_med_host;

@ -1,10 +1,10 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#include <sys/types.h>
#include <stdint.h>
#include "mediator.h"
extern u_int8_t config_daemonize;
extern uint8_t config_daemonize;
extern char *config_pid_path;
extern char *config_hostname;
@ -34,7 +34,7 @@ extern char *config_stats_db;
extern med_stats_period_t config_stats_period;
extern unsigned int config_interval;
extern u_int8_t config_dumpcdr;
extern uint8_t config_dumpcdr;
extern int config_maintenance;
extern int strict_leg_tokens;

@ -19,7 +19,7 @@
sig_atomic_t mediator_shutdown = 0;
int mediator_lockfd = -1;
u_int64_t mediator_count = 0;
uint64_t mediator_count = 0;
GHashTable *med_peer_ip_table = NULL;
GHashTable *med_peer_host_table = NULL;
@ -139,9 +139,9 @@ static int mediator_lock()
#ifdef WITH_TIME_CALC
/**********************************************************************/
static u_int64_t mediator_calc_runtime(struct timeval *tv_start, struct timeval *tv_stop)
static uint64_t mediator_calc_runtime(struct timeval *tv_start, struct timeval *tv_stop)
{
return ((u_int64_t)((tv_stop->tv_sec * 1000000 + tv_stop->tv_usec) -
return ((uint64_t)((tv_stop->tv_sec * 1000000 + tv_stop->tv_usec) -
(tv_start->tv_sec * 1000000 + tv_start->tv_usec)) / 1000);
}
#endif
@ -152,14 +152,14 @@ int main(int argc, char **argv)
{
med_callid_t *callids;
med_entry_t *records;
u_int64_t id_count, rec_count, i;
u_int64_t cdr_count, last_count;
uint64_t id_count, rec_count, i;
uint64_t cdr_count, last_count;
int maprefresh;
struct medmysql_batches batches;
#ifdef WITH_TIME_CALC
struct timeval tv_start, tv_stop;
u_int64_t runtime;
uint64_t runtime;
#endif
openlog(MEDIATOR_SYSLOG_NAME, LOG_PID|LOG_NDELAY, LOG_DAEMON);

@ -1,6 +1,7 @@
#ifndef _MEDIATOR_H
#define _MEDIATOR_H
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@ -71,7 +72,7 @@ typedef struct {
char callid[256];
char timestamp[24];
double unix_timestamp;
u_int8_t valid;
uint8_t valid;
med_method_t method;
char sip_method[32];
} med_entry_t;

@ -304,16 +304,16 @@ void medmysql_cleanup()
}
/**********************************************************************/
med_callid_t *medmysql_fetch_callids(u_int64_t *count)
med_callid_t *medmysql_fetch_callids(uint64_t *count)
{
MYSQL_RES *res;
MYSQL_ROW row;
/* char query[1024] = ""; */
size_t callid_size;
u_int64_t i = 0;
uint64_t i = 0;
med_callid_t *callids = NULL;
*count = (u_int64_t) -1; /* non-zero count and return of NULL == error */
*count = (uint64_t) -1; /* non-zero count and return of NULL == error */
/* g_strlcpy(query, MED_CALLID_QUERY, sizeof(query)); */
@ -370,13 +370,13 @@ out:
/**********************************************************************/
int medmysql_fetch_records(med_callid_t *callid,
med_entry_t **entries, u_int64_t *count)
med_entry_t **entries, uint64_t *count)
{
MYSQL_RES *res;
MYSQL_ROW row;
char query[strlen(MED_FETCH_QUERY) + sizeof(callid->value) * 5 + 1];
size_t entry_size;
u_int64_t i = 0;
uint64_t i = 0;
int ret = 0;
int len;
@ -500,9 +500,9 @@ int medmysql_delete_entries(const char *callid, struct medmysql_batches *batches
#define CDRESCAPE(x) batches->cdrs.len += mysql_real_escape_string(med_handler->m, batches->cdrs.str + batches->cdrs.len, x, strlen(x))
/**********************************************************************/
int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_batches *batches)
int medmysql_insert_cdrs(cdr_entry_t *entries, uint64_t count, struct medmysql_batches *batches)
{
u_int64_t i;
uint64_t i;
int gpp;
for(i = 0; i < count; ++i)

@ -25,17 +25,17 @@ struct medmysql_batches {
struct medmysql_call_stat_info_t {
char period[STAT_PERIOD_SIZE];
char call_code[4];
u_int64_t amount;
uint64_t amount;
};
int medmysql_init();
void medmysql_cleanup();
med_callid_t *medmysql_fetch_callids(u_int64_t *count);
int medmysql_fetch_records(med_callid_t *callid, med_entry_t **entries, u_int64_t *count);
med_callid_t *medmysql_fetch_callids(uint64_t *count);
int medmysql_fetch_records(med_callid_t *callid, med_entry_t **entries, uint64_t *count);
int medmysql_trash_entries(const char *callid, struct medmysql_batches *);
int medmysql_backup_entries(const char *callid, struct medmysql_batches *);
int medmysql_delete_entries(const char *callid, struct medmysql_batches *);
int medmysql_insert_cdrs(cdr_entry_t *records, u_int64_t count, struct medmysql_batches *);
int medmysql_insert_cdrs(cdr_entry_t *records, uint64_t count, struct medmysql_batches *);
int medmysql_load_maps(GHashTable *ip_table, GHashTable *host_table, GHashTable *id_table);
int medmysql_load_uuids(GHashTable *uuid_table);
int medmysql_batch_start(struct medmysql_batches *);

Loading…
Cancel
Save