📄 new_repos.c
字号:
/**************************************************************
功能:
作者:
王永忠:2001/03/29:规范程序设计
周国祥:2001/04/27: 修改
****************************************************************/
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include "all.h"
#include "macro_def.h"
#include "new_monitor.h"
extern int tomon;
/*
* 功能:
* 写监控信息
* ENTRY:
* long type 信息类型:交易或其它
* char *buf 数据缓存
* int len 长度
* RETURN:
* 0:函数执行结束或监控暂停都返回0
* -1:交易监控消息队列不存在或向交易监控消息队列发送消息失败
*/
/*
int new_repos(type, buf, len)
long type;
char *buf;
int len;
{
int mqid,i;
MONITOR_MSG msnd;
PUBLIC *pub;
T_msgtrans tran;
if (getmon() == -1)
return(-1);
if (!monitor_ok()) {
errcall(DEBUG, "monitor 未激活状态或共享内存异常.");
#ifdef zgx020417_modi
#ifdef wyz_mod_020127
return(0);
#endif
#else
return(-1);
#endif
}
msnd.wtype = type;
memset(msnd.buff, '\0', sizeof(msnd.buff));
if (type == MSG_TRANS) {
pub = (PUBLIC *) buf;
tran.tran_type = pub->Tran_type;
tran.old_tran_type = pub->Void_tran_type;
tran.oldold_tran_type = pub->Void_old_tran_type;
strcpy ( tran.msgid, pub->Msg_id);
strcpy ( tran.merchant_id, pub->Merchant_id);
strcpy ( tran.terminal_id, pub->Terminal_id);
if ( tran.tran_type == NET_LOGIN ||
tran.tran_type == NET_CHGKEY ||
tran.tran_type == CUT_START ||
tran.tran_type == CUT_END ||
tran.tran_type == NET_LOGOUT ) {
#ifndef zgx010511_modi
strcpy( tran.acq_bankid, pub->Snd_bank_id);
strcpy( tran.acq_hostid, pub->Snd_host_id);
#else
strcpy( tran.acq_bankid, pub->Rcv_bank_id);
strcpy( tran.acq_hostid, pub->Rcv_host_id);
#endif
} else {
strcpy ( tran.acq_bankid, pub->Acq_bank_id);
strcpy ( tran.acq_hostid, pub->Acq_host_id);
}
tran.saf_flag = pub->Saf_flag;
strcpy(tran.mcc, pub->Mcc);
strcpy(tran.mode, pub->Input_mode);
strcpy(tran.card_no, pub->Card_no);
strcpy(tran.expire, pub->Exp_date);
strcpy(tran.amount, pub->Tran_amount);
strcpy(tran.authno, pub->Auth_no);
strcpy(tran.ret_code, pub->Resp_code);
#ifdef zgx010616_modi
strcpy(tran.ret_bankid, pub->Resp_bank_id);
strcpy(tran.ret_hostid, pub->Resp_host_id);
#else
if ( tran.tran_type == NET_LOGIN ||
tran.tran_type == NET_CHGKEY ||
tran.tran_type == NET_LOGOUT ) {
strcpy(tran.ret_bankid, pub->Rcv_bank_id);
strcpy(tran.ret_hostid, pub->Rcv_host_id);
} else {
strcpy(tran.ret_bankid, pub->Resp_bank_id);
if (!strcmp(pub->Resp_host_id, ""))
strcpy(tran.ret_hostid, "00");
else
strcpy(tran.ret_hostid, pub->Resp_host_id);
}
#endif
#ifdef zgx020417_added
#else
strcpy(tran.card_type, pub->Card_type);
strcpy(tran.bank_type, pub->Bank_type);
strcpy(tran.sign_bankid, pub->Sign_bankid);
tran.local_flag = pub->Local_flag;
tran.union_flag = pub->Union_flag;
#endif
memcpy(msnd.buff, &tran, sizeof(msnd.buff));
} else
memcpy(msnd.buff, buf, sizeof(msnd.buff));
i = msgsnd(tomon, &msnd, sizeof(msnd.buff), IPC_NOWAIT);
if (i == -1) {
errcall(ERROR, "msgsnd monitor err![%d:%d]", tomon, errno);
return(-1);
}
return(0);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -