123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- #ifndef __PINPAD_SERVER_G_H
- #define __PINPAD_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "PinPad_def_g.h"
- namespace PinPad {
- class PinPadService_ServerSessionBase : public CServerSessionBase
- {
- public:
- PinPadService_ServerSessionBase()
- {
- /// override by user
- }
- virtual ~PinPadService_ServerSessionBase()
- {
- /// override by user
- }
- virtual bool IsExclusive() { return false; }
- virtual bool IsSessionOverlap() { return true; }
- virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case PinPadService_Method_InputWaitMore:
- if (dwSignature == PinPadService_MethodSignature_InputWaitMore) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancel:
- if (dwSignature == PinPadService_MethodSignature_InputCancel) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_Exit:
- if (dwSignature == PinPadService_MethodSignature_Exit) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputJS:
- if (dwSignature == PinPadService_MethodSignature_GetInputJS) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancelJS:
- if (dwSignature == PinPadService_MethodSignature_InputCancelJS) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputSM:
- if (dwSignature == PinPadService_MethodSignature_GetInputSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- if (dwSignature == PinPadService_MethodSignature_LoadKeysSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- if (dwSignature == PinPadService_MethodSignature_EncryptDataSM) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_QueryFunc:
- if (dwSignature == PinPadService_MethodSignature_QueryFunc) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetCheckCode:
- if (dwSignature == PinPadService_MethodSignature_GetCheckCode) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetDevInfo:
- if (dwSignature == PinPadService_MethodSignature_GetDevInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
- {
- ErrorCodeEnum Error = Error_Succeed;
- switch (dwMessageID) {
- case PinPadService_Method_InputWaitMore:
- if (dwSignature != PinPadService_MethodSignature_InputWaitMore) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancel:
- if (dwSignature != PinPadService_MethodSignature_InputCancel) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_Exit:
- if (dwSignature != PinPadService_MethodSignature_Exit) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputJS:
- if (dwSignature != PinPadService_MethodSignature_GetInputJS) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_InputCancelJS:
- if (dwSignature != PinPadService_MethodSignature_InputCancelJS) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetInputSM:
- if (dwSignature != PinPadService_MethodSignature_GetInputSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- if (dwSignature != PinPadService_MethodSignature_LoadKeysSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- if (dwSignature != PinPadService_MethodSignature_EncryptDataSM) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_QueryFunc:
- if (dwSignature != PinPadService_MethodSignature_QueryFunc) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetCheckCode:
- if (dwSignature != PinPadService_MethodSignature_GetCheckCode) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case PinPadService_Method_GetDevInfo:
- if (dwSignature != PinPadService_MethodSignature_GetDevInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_InputWaitMore(SpOnewayCallContext<PinPadService_InputWaitMore_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InputCancel(SpOnewayCallContext<PinPadService_InputCancel_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_Exit(SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetInputJS(SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadService_GetInputJS_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InputCancelJS(SpReqAnsContext<PinPadService_InputCancelJS_Req, PinPadService_InputCancelJS_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetInputSM(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_LoadKeysSM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadService_LoadKeysSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_EncryptDataSM(SpReqAnsContext<PinPadService_EncryptDataSM_Req, PinPadService_EncryptDataSM_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_QueryFunc(SpReqAnsContext<PinPadService_QueryFunc_Req, PinPadService_QueryFunc_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetDevInfo(SpReqAnsContext<PinPadService_GetDevInfo_Req, PinPadService_GetDevInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
- {
- CAutoBuffer Buf;
- DWORD dwMessageID;
- DWORD dwMessageSignature;
- ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
- if (Error == Error_Succeed) {
- #ifdef DEBUG
- assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
- #else
- if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
- pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
- return;
- }
- #endif
- switch (dwMessageID) {
- case PinPadService_Method_InputWaitMore:
- {
- SpOnewayCallContext<PinPadService_InputWaitMore_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_InputWaitMore_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_InputWaitMore(ctx);
- }
- break;
- case PinPadService_Method_InputCancel:
- {
- SpOnewayCallContext<PinPadService_InputCancel_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_InputCancel_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_InputCancel(ctx);
- }
- break;
- case PinPadService_Method_Exit:
- {
- SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx;
- ctx.Attach(new SpOnewayCallContext<PinPadService_Exit_Info>());
- SpBuffer2Object(Buf, ctx->Info);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_Exit(ctx);
- }
- break;
- case PinPadService_Method_GetInputJS:
- {
- SpReqAnsContext<PinPadService_GetInputJS_Req,PinPadService_GetInputJS_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetInputJS_Req,PinPadService_GetInputJS_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetInputJS(ctx);
- }
- break;
- case PinPadService_Method_InputCancelJS:
- {
- SpReqAnsContext<PinPadService_InputCancelJS_Req,PinPadService_InputCancelJS_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_InputCancelJS_Req,PinPadService_InputCancelJS_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_InputCancelJS(ctx);
- }
- break;
- case PinPadService_Method_GetInputSM:
- {
- SpReqAnsContext<PinPadService_GetInputSM_Req,PinPadService_GetInputSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetInputSM_Req,PinPadService_GetInputSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetInputSM(ctx);
- }
- break;
- case PinPadService_Method_LoadKeysSM:
- {
- SpReqAnsContext<PinPadService_LoadKeysSM_Req,PinPadService_LoadKeysSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_LoadKeysSM_Req,PinPadService_LoadKeysSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_LoadKeysSM(ctx);
- }
- break;
- case PinPadService_Method_EncryptDataSM:
- {
- SpReqAnsContext<PinPadService_EncryptDataSM_Req,PinPadService_EncryptDataSM_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_EncryptDataSM_Req,PinPadService_EncryptDataSM_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_EncryptDataSM(ctx);
- }
- break;
- case PinPadService_Method_QueryFunc:
- {
- SpReqAnsContext<PinPadService_QueryFunc_Req,PinPadService_QueryFunc_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_QueryFunc_Req,PinPadService_QueryFunc_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_QueryFunc(ctx);
- }
- break;
- case PinPadService_Method_GetCheckCode:
- {
- SpReqAnsContext<PinPadService_GetCheckCode_Req,PinPadService_GetCheckCode_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetCheckCode_Req,PinPadService_GetCheckCode_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetCheckCode(ctx);
- }
- break;
- case PinPadService_Method_GetDevInfo:
- {
- SpReqAnsContext<PinPadService_GetDevInfo_Req,PinPadService_GetDevInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<PinPadService_GetDevInfo_Req,PinPadService_GetDevInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetDevInfo(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace PinPad
- #endif // __PINPAD_SERVER_G_H
|