📄 notify_strategy.c
字号:
#include "grs_warning_module.h"
#include "list.h"
#include "notify_strategy.h"
char notifystr[128];
time_t start_time;
pLink * head,*pfind,*pnew;
int notify_strategy(sinfo_c)
{
// time_t err_time = sinfo->sip_errTime;
/* sprintf(notifystr,"serverinfo->%s@%s:%d-%s-%d",
sinfo->sip_usrName,sinfo->sip_proxyIP,sinfo->sip_proxyPort,
sinfo->sip_testNum,sinfo->sip_timeInt);*/
strcpy(notifystr,"2008-12-15 Test1");
head=init();
if((pfind=search(head,notifystr))==NULL )/* Can't find any!*/
{
if(sinfo_c->sip_totalState == -1)
{
pnew = (pLink *)malloc(sizeof(struct node));
strcpy(pnew->notifystr,notifystr);
head = insert(head,pnew);
start_time=time(NULL);
printf("send\t NOT ERROR\n");
print_list(head);
/*send_email();
send_sms();*/
}
/*以前没错误,再来一个OK 不做处理*/
}else /*find*/
{
if (sinfo_c->sip_totalState == 0)
{
/*不管什么时间,出现正确后,若以前有错误状态
都删除以前的,同时做发送处理*/
head = del(head,pfind);
printf("send\t FIND Correct\n");
print_list(head);
/*send_email();
send_sms();*/
}
else /*错误状态*/
{
if ((time(NULL) - start_time) > ERR_TIME)
{
head = del(head,pfind);/*先删除以前的*/
pnew = (pLink *)malloc(sizeof(struct node));
strcpy(pnew->notifystr,notifystr);
head = insert(head,pnew);
start_time=time(NULL);
printf("send\t FIND ERROR\n");
print_list(head);
/* send_email();
send_sms();*/
}
/*小于2小时不做任何处理*/
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -