本文整理汇总了C++中CMultiXAppMsg类的典型用法代码示例。如果您正苦于以下问题:C++ CMultiXAppMsg类的具体用法?C++ CMultiXAppMsg怎么用?C++ CMultiXAppMsg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMultiXAppMsg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Owner
void CMultiXProcess::OnNewMsgFromTpm(CMultiXAppMsg &AppMsg)
{
if(Owner()->TpmProcID() == 0)
Owner()->m_TpmProcID = this->ProcessID();
if(Owner()->TpmProcID() != this->ProcessID())
{
Reject();
} else
{
switch(AppMsg.MsgCode())
{
case CMultiXTpmCtrlMsg::ConfigDataMsgCode :
{
OnTpmConfigData(AppMsg);
break;
}
case CMultiXTpmCtrlMsg::ProcessShutdownMsgCode :
OnPrepareForShutdown(AppMsg);
break;
case CMultiXTpmCtrlMsg::ProcessRestartMsgCode :
OnProcessRestart(AppMsg);
break;
case CMultiXTpmCtrlMsg::ProcessSuspendMsgCode :
OnProcessSuspend(AppMsg);
break;
case CMultiXTpmCtrlMsg::ProcessResumeMsgCode :
OnProcessResume(AppMsg);
break;
}
}
AppMsg.Reply(MultiXNoError);
}
示例2:
void CISO8583AcquirerGatewayFEServerSession::OnNetworkManagementRequest(CMultiXAppMsg &Msg)
{
CISO8583Msg ISOMsg;
CISO8583Msg::TValidationError Error = ISOMsg.FromISO((const byte_t *)Msg.AppData(),Msg.AppDataSize());
if(Error != CISO8583Msg::NoError)
{
Msg.Reply(Error);
return;
}
/*
Since Network Management messages include the destination gateway ID, we use it to find the link associated with this gateway.
*/
int ReplyError = ErrUnableToForwardMsg;
CISO8583AcquirerGatewayFELink *Link = Owner()->FindReadyLink(ISOMsg.TransactionDestinationInstitutionIdentificationCode());
if(Link)
{
std::string MsgKey = ISOMsg.STAN() + ISOMsg.DateTimeLocal() + ISOMsg.TransactionOriginatorInstitutionIdentificationCode();
ReplyError = Link->Forward(Msg,MsgKey);
}
if(ReplyError == 0)
{
Msg.Keep();
} else
{
Msg.Reply(ReplyError);
}
}
示例3: switch
void CISO8583BackEndServerSession::OnSendMsgFailed(CMultiXAppMsg &FailedMsg,bool bTimeout)
{
/*
If we forwarded a message to another process, we need to check the failure and decide what to do.
*/
switch(CISO8583Msg::VersionIndependentMTI(FailedMsg.MsgCode())) // this will give us version independent MTI
{
case CISO8583Msg::MTIAuthorizationMessageRequest :
case CISO8583Msg::MTIReversalMessageAdvice :
case CISO8583Msg::MTIReversalMessageAdviceRepeat :
{
/*
These are all messages we received from acquirer gateways or acquirers in general,
and failed to forward them to remote gateways/issuers, so we respond to the acquirer
with an error indicating that we were unable to forward the request.
*/
// We extract the acquirer we saved when we forwarded the message.
CMultiXAppMsg *AcquirerMsg = (CMultiXAppMsg *)FailedMsg.SavedContext();
AcquirerMsg->Reply(CISO8583Msg::ForwardToIssuerFailed);
delete AcquirerMsg; // WE MUST DELETE THE MESSAGE BECAUSE WE CALLED "Keep()" BEFORE WE FORWARDED IT.
}
break;
}
}
示例4:
void CISO8583AuthorizerServerSession::OnNewMsg(CMultiXAppMsg &Msg)
{
DebugPrint(1,"New Message Received\n");
switch(CISO8583Msg::VersionIndependentMTI(Msg.MsgCode())) // we check the ISO8583 Version independent MTI value
{
case CISO8583Msg::MTIAuthorizationMessageRequest :
case CISO8583Msg::MTIFinancialMessageRequest :
{
// If we have an ISO 8583 Msg Code, we try to parse the msg to make sure that
// we have a valid ISO 8583
CISO8583Msg ISOMsg;
CISO8583Msg::TValidationError Error = ISOMsg.FromISO((const byte_t *)Msg.AppData(),Msg.AppDataSize());
if(Error != CISO8583Msg::NoError)
{
Msg.Reply(Error);
} else if(ISOMsg.Version() != CISO8583Msg::ISO8583_1_1987) // we Support only 1987 version
{
Msg.Reply(CISO8583Msg::VersionNotSupported);
} else
{
OnISO8583Msg(Msg,ISOMsg);
}
}
break;
default :
// We do not know this message, reply with error
Msg.Reply(CISO8583Msg::MTINotSupported);
break;
}
}
示例5: if
bool CMultiXAppMsg::Reply(MultiXError Error,int32_t MsgCode, const CMultiXBufferArray &Bufs, int Flags,int Priority, uint32_t Timeout, void *Context,TMultiXProcID RoutedFrom)
{
if(ReplySent())
return false;
if(!this->NotifyAny())
return false;
if(!m_pProcess->SenderEnabled())
return false;
if(m_pProcess->RestartCount() != m_OwnerInstance)
return false;
if(RoutedFrom == 0)
RoutedFrom = m_pProcess->Owner()->ProcessID();
CMultiXAppMsg *Msg = m_pProcess->CreateNewAppMsg();
m_pProcess->AddToMsgQueue(m_pProcess->m_pOutQueue, Msg);
Msg->AllocateL7XMsg(MsgCode);
Msg->AddReceiverMsgID(this->SenderMsgID());
if(this->IsCtrlMsgFromTpm())
Flags |= FlagControlToTpm;
else if(this->IsCtrlMsgToTpm())
Flags |= FlagControlFromTpm;
if(Bufs.Count() == 0)
Flags &= ~CMultiXAppMsg::FlagResponseRequired;
Msg->AddInfo(Bufs,Flags | FlagMsgIsResponse,this->m_SessionID,Priority,Timeout,Context,Error,RoutedFrom,NULL,NULL,NULL,NULL);
if(Msg->NotifyAny())
m_pProcess->Send(*Msg);
else
{
m_pProcess->Send(*Msg);
delete Msg;
}
SetReplySent(true);
return true;
}
示例6:
void CMultiXWSServerServerSession::OnNewMsg(CMultiXAppMsg &Msg)
{
DebugPrint(1,"New Message Received\n");
if(!Msg.IsWebServiceCall())
{
DebugPrint(1,"Error Reply TpmErrMsgNotSupported\n");
Msg.Reply(TpmErrMsgNotSupported);
return;
}
try
{
if(m_pStream == NULL)
m_pStream = new CMultiXWSStream(Msg.WSDllFile(),*this);
bool bSuccess = m_pStream->CallServiceNoWait(Msg);
if(!bSuccess)
{
Owner()->Logger()->ReportError(DebugPrint(0,"Error on CallServiceNoWait\n"));
Msg.Reply(WSErrgSoapDllNotFound);
}
}catch(...)
{
DebugPrint(1,"Error Reply WSErrgSoapDllNotFound\n");
Msg.Reply(WSErrgSoapDllNotFound);
}
}
示例7: OnGetListeningAddressFailed
void CMultiXProcess::OnGetListeningAddressFailed(CMultiXAppMsg &OriginalMsg)
{
CMultiXMsg Msg(*Owner());
Msg.Append(OriginalMsg.AppData(),OriginalMsg.AppDataSize());
TMultiXProcID ProcID = 0;
Msg.GetItemData(ProcID);
Owner()->OnConnectProcessFailed(ProcID);
}
示例8:
bool CMultiXWSStream::CallServiceNoWait(CMultiXAppMsg &Msg)
{
if(!IsRunning())
if(!Start())
return false;
CMultiXWSStreamEvent *Ev = new CMultiXWSStreamEvent(CMultiXWSStreamEvent::CallServiceFromMessage);
Msg.Keep();
Ev->m_MsgID = Msg.ID();
QueueEvent(Ev);
return true;
}
示例9: switch
void CMultiXProcessAlertableObject::OnTimer(CMultiXTimer *Timer)
{
CMultiXProcessTimer *T = (CMultiXProcessTimer *)Timer;
switch(T->TimerCode())
{
case CMultiXProcessTimer::SendMsgTimerCode :
CMultiXAppMsg *Msg = T->MsgID().GetObject();
if(Msg)
{
OwnerProcess()->m_NonResponding = true;
Msg->SetError(MsgErrTimeout);
T->MsgID().Owner()->CancelMsg(T->MsgID(),true);
}
break;
}
}
示例10: DebugPrint
//! see CMultiXSession::OnDataReplyReceived
void CISO8583BackEndServerSession::OnDataReplyReceived(CMultiXAppMsg &ReplyMsg,CMultiXAppMsg &ForwardedMsg)
{
DebugPrint(3,"Data Reply Received\n");
/*
We get here when we receive a response for a message we forwarded before. In this case we will forward the response back to
the originator, we do not care for the content, we forward it back almost AS IS except for few fields that
we need to restore because changed them before we forwarded the message, the fields are:
MTI - Convert it to 1993 version.
BMP 7 - Set Transmission time
BMP 11 - restore sender STAN
BMP 12 - Restore sender Date and Time Local
BMP 32 - Restore senders Acquiring Institution Identification Code
*/
/*
In order to restore old values, we need to restore the message we received originaly from the acquirer or from the pos terminal.
this message is saved in the SaveContext() of the ForwardedMsg.
*/
CMultiXAppMsg *AcquirerMsg = (CMultiXAppMsg *)ForwardedMsg.SavedContext();
CISO8583Msg AcquirerISO;
CISO8583Msg ReplyISO;
AcquirerISO.FromISO((const byte_t *)AcquirerMsg->AppData(),AcquirerMsg->AppDataSize());
ReplyISO.FromISO((const byte_t *)ReplyMsg.AppData(),ReplyMsg.AppDataSize());
ReplyISO.SetTimes(time(NULL),true);
ReplyISO.SetDateTimeLocal(AcquirerISO.DateTimeLocal());
ReplyISO.SetSTAN(AcquirerISO.STAN());
ReplyISO.SetAcquiringInstitutionIdentificationCode(AcquirerISO.AcquiringInstitutionIdentificationCode());
ReplyISO.ToISO();
AcquirerMsg->Reply(CISO8583Msg::VersionDependentMTI(CISO8583Msg::ISO8583_2_1993,ReplyMsg.MsgCode()),
ReplyISO.ISOBuffer(),
ReplyISO.ISOBufferSize(),0,0,0,0,0,ReplyMsg.Error());
delete AcquirerMsg; // WE MUST DELETE THE MESSAGE BECAUSE WE CALLED "Keep()" BEFORE WE FORWARDED IT.
/*
we reply the ReplyMsg for the case that the process that replied to us expects to receive a notification that we
received the reply, if it does not wait for the reply, no reply is sent.
*/
ReplyMsg.Reply();
}
示例11: EnableSender
void CMultiXProcess::EnableSender(bool bValue)
{
if(SenderEnabled() == bValue)
return;
m_bSenderEnabled = bValue;
if(!SenderEnabled())
{
m_SupportedMsgs.clear();
CMultiXAppMsg *Msg;
m_pOutQueue->Lock();
while(Msg = m_pOutQueue->GetFirst())
{
Msg->SetError(MsgErrCanceled);
CancelMsg(Msg->ID(),false);
}
}
}
示例12:
void CMultiplexerServerFEServerSession::OnNewMsg(CMultiXAppMsg &Msg)
{
DebugPrint(1,"New Message Received\n");
int ReplyError = ErrUnableToForwardMsg;
CMultiplexerServerFELink *Link = Owner()->FindReadyLink(Msg.MsgCode());
if(Link)
{
ReplyError = Link->Forward(Msg);
}
if(ReplyError == 0)
{
Msg.Keep();
} else
{
Msg.Reply(ReplyError);
}
}
示例13: Value
void CISO8583AuthorizerServerSession::ForwardToIssuer(int CreditAccountAtIssuer,CMultiXAppMsg &Msg,CISO8583Msg &ISOMsg)
{
/*
we get here if we need someone else to authorize the request. In that case we need to forward the request to our Acquirer Gateway Front End.
To do that we need to forward it with a different message code, so MultiXTpm will not forward it back to us. The way we do it,
the message code change is by setting the MTI version field to CISO8583Msg::ISO8583_Private. When the message is received by our
Gateway process, it will revert back to CISO8583Msg::ISO8583_2_1993 and forward it on.
When we forward a request, we do not block for a response, when a response arrives, we get it thru
the event "OnDataReplyReceived". in order to be able to associate the response with the original msg,
we pass a pointer to the original message in the "Context" parameter of the "Send" function, and when
"OnDataReplyReceived" is called, we retrieve this pointer by using "SavedContext()" in the Original msg we sent.
Since MultiX automatically destroys messages it forwards to the application, we must call "Keep()" on
the received message, to prevent it from being destroyed, in that case, when the reply is received, we need
to destroy the original message ourselves.
When we play the role of an acquirer gateway, usualy get the request from the POS terminal, do validation required
and maybe modify some data, and then forward the message to the issuer gateway, in our case, the forward will be to a process
in our system, that will decide to which issuer to forward to, based on that, will use a specific connection to the spcific
issuer gateway.
*/
/*
Before we forward the request, we need to set 3 fields to identify the message as a one sent from this process :
BMP 11 - STAN,
BMP 12 - Times,
BMP 32 - Our Acquirer ID
BMP 42 - our account within the issuer
When we receive the response from the remote gateway/issuer, we must replace these fields again to the orignal values
that the sender set before sending the request to us
*/
ISOMsg.SetTimes(time(NULL));
ISOMsg.SetSTAN(Owner()->GetNextSTAN());
ISOMsg.SetAcquiringInstitutionIdentificationCode(Owner()->MyAcquirerID());
CISO8583ElementValue Value(CISO8583Utilities::ToString(CreditAccountAtIssuer),CISO8583ElementValue::ISO8583ElementTypeNumeric);
ISOMsg.SetCardAcceptorIdentificationCode(Value);
ISOMsg.ToISO();
if(Send(CISO8583Msg::VersionDependentMTI(CISO8583Msg::ISO8583_Private,Msg.MsgCode()),ISOMsg.ISOBuffer(),ISOMsg.ISOBufferSize(),CMultiXAppMsg::FlagNotifyAll,0,0,&Msg))
Msg.Keep();
else
Msg.Reply(ErrUnableToForwardMsg);
}
示例14: CreateNewAppMsg
bool CMultiXProcess::Send(int32_t MsgCode, const CMultiXBufferArray &Bufs,int Flags, const TMultiXSessionID &SessionID,int Priority, uint32_t Timeout, void *Context,TMultiXProcID RoutedFrom,const char *WSURL,const char *WSSoapAction,const char *WSDllFile,const char *WSDllFunction)
{
if(!SenderEnabled())
return false;
CMultiXAppMsg *Msg = CreateNewAppMsg();
AddToMsgQueue(m_pOutQueue,Msg);
Msg->AllocateL7XMsg(MsgCode);
if(RoutedFrom == 0)
RoutedFrom = Owner()->ProcessID();
Msg->AddInfo(Bufs,Flags & (~CMultiXAppMsg::FlagMsgIsResponse),SessionID,Priority,Timeout,Context,MultiXNoError,RoutedFrom,WSURL,WSSoapAction,WSDllFile,WSDllFunction);
if(Msg->NotifyAny())
return Send(*Msg);
else
{
Send(*Msg);
delete Msg;
}
return true;
}
示例15: OnPrepareForShutdown
void CMultiXProcess::OnPrepareForShutdown(CMultiXAppMsg &AppMsg)
{
CMultiXMsg Msg(*Owner());
Msg.Append(AppMsg.AppData(),AppMsg.AppDataSize());
int32_t GracePeriod = 0;
while(Msg.Next())
{
switch(Msg.GetItemCode())
{
case CMultiXTpmCtrlMsg::GracePeriodItemCode :
Msg.GetItemData(GracePeriod);
break;
}
}
AppMsg.Reply(MultiXNoError);
Owner()->OnPrepareForShutdown(GracePeriod);
}