init ems server code
This commit is contained in:
139
src/accountMgr/c_program/wxc1AndWxc2ConverseTools/cdrmain.c
Normal file
139
src/accountMgr/c_program/wxc1AndWxc2ConverseTools/cdrmain.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*************************************************
|
||||
File name: cdr.c
|
||||
Author:
|
||||
Version: 9:00:00
|
||||
Date: 2002-5-7
|
||||
Description:cdrCollectorģ<72><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>snmp<6D><70>iptransģ<73>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD>cdr.c<><63><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
||||
<09><><EFBFBD>嶨ʱ<E5B6A8><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>ʱ
|
||||
|
||||
<09><><EFBFBD><EFBFBD><EFBFBD>ⲿģ<E2B2BF><C4A3><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
||||
void snmp_init(WORD nport);
|
||||
void iptrans_init();
|
||||
|
||||
|
||||
History:
|
||||
No.
|
||||
Author:
|
||||
Date:
|
||||
Version:
|
||||
Description:
|
||||
*************************************************/
|
||||
|
||||
#include "cdr.h"
|
||||
|
||||
static struct itimerval itimer, old_itimer;
|
||||
static void On_Timer();
|
||||
static void SetTimer();
|
||||
|
||||
/*************************************************
|
||||
Function: // main
|
||||
Description: // <20><>ʼ<EFBFBD><CABC>snmp<6D><70>iptransģ<73><C4A3>,<2C><>ʼ<EFBFBD><CABC><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Calls: // iptrans_init; snmp_init;
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
pid_t pid;
|
||||
//debug_init();
|
||||
|
||||
//fprintf(stderr, "\n Calling iptrans_init()");
|
||||
//iptrans_init();
|
||||
|
||||
//fprintf(stderr, "\n Calling snmp_init()");
|
||||
//snmp_init(CDR_PORT);
|
||||
|
||||
/*
|
||||
if (argc == 2 && strstr(argv[1], "-d")) {
|
||||
if ((pid = fork()) != 0)
|
||||
exit(0);
|
||||
setsid();
|
||||
//umask(0);
|
||||
}*/
|
||||
|
||||
if (argc != 4) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(totalCdrFileName,argv[1]);
|
||||
strcpy(cdrFileName,argv[2]);
|
||||
cdrHour=atoi(argv[3]);
|
||||
|
||||
|
||||
cdr_init();
|
||||
|
||||
//cdr_start();
|
||||
|
||||
|
||||
converseFile();
|
||||
|
||||
/*
|
||||
SetTimer();
|
||||
while (1) {
|
||||
//cdr_loop();
|
||||
usleep(50);
|
||||
}
|
||||
return 1;
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // On_Timer
|
||||
Description: // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Calls: // cdr_timer
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
void On_Timer()
|
||||
{
|
||||
//debug_rt();
|
||||
//snmp_timer();
|
||||
cdr_timer();
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
Function: // SetTimer
|
||||
Description: // <20><><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Calls: // On_Timer
|
||||
Called By: //
|
||||
Table Accessed: //
|
||||
Table Updated: //
|
||||
Input: //
|
||||
Output: //
|
||||
Return: //
|
||||
Others: //
|
||||
*************************************************/
|
||||
void SetTimer()
|
||||
{
|
||||
struct sigaction act;
|
||||
act.sa_handler = On_Timer;
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
if (sigaction(SIGALRM, &act, NULL) < 0) {
|
||||
perror("Produce Sigaction");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
itimer.it_interval.tv_sec = 0;
|
||||
itimer.it_interval.tv_usec = 20 * 1000;
|
||||
itimer.it_value.tv_sec = 0;
|
||||
itimer.it_value.tv_usec = 20 * 1000;
|
||||
|
||||
if (setitimer(ITIMER_REAL, &itimer, &old_itimer) != 0) {
|
||||
printf("Setting Timer error! \n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user