123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- #ifndef __RESOURCEWATCHER_SERVER_G_H
- #define __RESOURCEWATCHER_SERVER_G_H
- #pragma once
- // This code is generated by spgen tool!
- #include "ResourceWatcher_def_g.h"
- namespace ResourceWatcher {
- class ResourceWatcherService_ServerSessionBase : public CServerSessionBase
- {
- public:
- ResourceWatcherService_ServerSessionBase()
- {
- /// override by user
- }
- virtual ~ResourceWatcherService_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 ResourceWatcherService_Method_Fetch:
- if (dwSignature == ResourceWatcherService_MethodSignature_Fetch) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetDevInfo:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetDevInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetCardSwiper:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetCardSwiper) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetCpuType:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetCpuType) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_OperateFile:
- if (dwSignature == ResourceWatcherService_MethodSignature_OperateFile) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_ExtractEventLog:
- if (dwSignature == ResourceWatcherService_MethodSignature_ExtractEventLog) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_UpdateDNS:
- if (dwSignature == ResourceWatcherService_MethodSignature_UpdateDNS) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetNetworkInfo:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetNetworkInfo) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetThirdPartyInstallState:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_InstallThirdPartyProgram:
- if (dwSignature == ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
- 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 ResourceWatcherService_Method_Fetch:
- if (dwSignature != ResourceWatcherService_MethodSignature_Fetch) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetDevInfo:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetDevInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetCardSwiper:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetCardSwiper) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetCpuType:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetCpuType) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_OperateFile:
- if (dwSignature != ResourceWatcherService_MethodSignature_OperateFile) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_ExtractEventLog:
- if (dwSignature != ResourceWatcherService_MethodSignature_ExtractEventLog) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_UpdateDNS:
- if (dwSignature != ResourceWatcherService_MethodSignature_UpdateDNS) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetNetworkInfo:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetNetworkInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetThirdPartyInstallState:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_InstallThirdPartyProgram:
- if (dwSignature != ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_Fetch(SpReqAnsContext<ResourceWatcherService_Fetch_Req, ResourceWatcherService_Fetch_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetDevInfo(SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req, ResourceWatcherService_GetDevInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetCardSwiper(SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req, ResourceWatcherService_GetCardSwiper_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetCpuType(SpReqAnsContext<ResourceWatcherService_GetCpuType_Req, ResourceWatcherService_GetCpuType_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_OperateFile(SpReqAnsContext<ResourceWatcherService_OperateFile_Req, ResourceWatcherService_OperateFile_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_ExtractEventLog(SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req, ResourceWatcherService_ExtractEventLog_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_UpdateDNS(SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req, ResourceWatcherService_UpdateDNS_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetNetworkInfo(SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req, ResourceWatcherService_GetNetworkInfo_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_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 ResourceWatcherService_Method_Fetch:
- {
- SpReqAnsContext<ResourceWatcherService_Fetch_Req,ResourceWatcherService_Fetch_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_Fetch_Req,ResourceWatcherService_Fetch_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_Fetch(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetDevInfo:
- {
- SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req,ResourceWatcherService_GetDevInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req,ResourceWatcherService_GetDevInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetDevInfo(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetCardSwiper:
- {
- SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req,ResourceWatcherService_GetCardSwiper_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req,ResourceWatcherService_GetCardSwiper_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetCardSwiper(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetCpuType:
- {
- SpReqAnsContext<ResourceWatcherService_GetCpuType_Req,ResourceWatcherService_GetCpuType_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetCpuType_Req,ResourceWatcherService_GetCpuType_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetCpuType(ctx);
- }
- break;
- case ResourceWatcherService_Method_OperateFile:
- {
- SpReqAnsContext<ResourceWatcherService_OperateFile_Req,ResourceWatcherService_OperateFile_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_OperateFile_Req,ResourceWatcherService_OperateFile_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_OperateFile(ctx);
- }
- break;
- case ResourceWatcherService_Method_ExtractEventLog:
- {
- SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req,ResourceWatcherService_ExtractEventLog_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req,ResourceWatcherService_ExtractEventLog_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_ExtractEventLog(ctx);
- }
- break;
- case ResourceWatcherService_Method_UpdateDNS:
- {
- SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req,ResourceWatcherService_UpdateDNS_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req,ResourceWatcherService_UpdateDNS_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_UpdateDNS(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetNetworkInfo:
- {
- SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req,ResourceWatcherService_GetNetworkInfo_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req,ResourceWatcherService_GetNetworkInfo_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetNetworkInfo(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetThirdPartyInstallState:
- {
- SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_GetThirdPartyInstallState(ctx);
- }
- break;
- case ResourceWatcherService_Method_InstallThirdPartyProgram:
- {
- SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,ResourceWatcherService_InstallThirdPartyProgram_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- Handle_InstallThirdPartyProgram(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace ResourceWatcher
- #endif // __RESOURCEWATCHER_SERVER_G_H
|