123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- #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_GetDevInfo:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetDevInfo) {
- 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_CheckNetType:
- if (dwSignature == ResourceWatcherService_MethodSignature_CheckNetType) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetBizLinks:
- if (dwSignature == ResourceWatcherService_MethodSignature_GetBizLinks) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_BizLinkDetect:
- if (dwSignature == ResourceWatcherService_MethodSignature_BizLinkDetect) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_InstallThirdPartyProgram:
- if (dwSignature == ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_FilesClean:
- if (dwSignature == ResourceWatcherService_MethodSignature_FilesClean) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_FetchSystemSnapshot:
- if (dwSignature == ResourceWatcherService_MethodSignature_FetchSystemSnapshot) {
- bOverlap = true;
- } else {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_CheckIsFileExists:
- if (dwSignature == ResourceWatcherService_MethodSignature_CheckIsFileExists) {
- 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_GetDevInfo:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetDevInfo) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_OperateFile:
- if (dwSignature != ResourceWatcherService_MethodSignature_OperateFile) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_CheckNetType:
- if (dwSignature != ResourceWatcherService_MethodSignature_CheckNetType) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_GetBizLinks:
- if (dwSignature != ResourceWatcherService_MethodSignature_GetBizLinks) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_BizLinkDetect:
- if (dwSignature != ResourceWatcherService_MethodSignature_BizLinkDetect) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_InstallThirdPartyProgram:
- if (dwSignature != ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_FilesClean:
- if (dwSignature != ResourceWatcherService_MethodSignature_FilesClean) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_FetchSystemSnapshot:
- if (dwSignature != ResourceWatcherService_MethodSignature_FetchSystemSnapshot) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- case ResourceWatcherService_Method_CheckIsFileExists:
- if (dwSignature != ResourceWatcherService_MethodSignature_CheckIsFileExists) {
- Error = Error_MethodSignatureFailed;
- }
- break;
- default:
- Error = Error_MethodNotFound;
- break;
- }
- return Error;
- }
- virtual void Handle_GetDevInfo(SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req, ResourceWatcherService_GetDevInfo_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_CheckNetType(SpReqAnsContext<ResourceWatcherService_CheckNetType_Req, ResourceWatcherService_CheckNetType_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_GetBizLinks(SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req, ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_BizLinkDetect(SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req, ResourceWatcherService_BizLinkDetect_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_FilesClean(SpReqAnsContext<ResourceWatcherService_FilesClean_Req, ResourceWatcherService_FilesClean_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_FetchSystemSnapshot(SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req, ResourceWatcherService_FetchSystemSnapshot_Ans>::Pointer ctx)
- {
- /// override by user
- }
- virtual void Handle_CheckIsFileExists(SpReqAnsContext<ResourceWatcherService_CheckIsFileExists_Req, ResourceWatcherService_CheckIsFileExists_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_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);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetDevInfo(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);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_OperateFile(ctx);
- }
- break;
- case ResourceWatcherService_Method_CheckNetType:
- {
- SpReqAnsContext<ResourceWatcherService_CheckNetType_Req,ResourceWatcherService_CheckNetType_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_CheckNetType_Req,ResourceWatcherService_CheckNetType_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_CheckNetType(ctx);
- }
- break;
- case ResourceWatcherService_Method_GetBizLinks:
- {
- SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,ResourceWatcherService_GetBizLinks_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_GetBizLinks(ctx);
- }
- break;
- case ResourceWatcherService_Method_BizLinkDetect:
- {
- SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req,ResourceWatcherService_BizLinkDetect_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req,ResourceWatcherService_BizLinkDetect_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_BizLinkDetect(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);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_InstallThirdPartyProgram(ctx);
- }
- break;
- case ResourceWatcherService_Method_FilesClean:
- {
- SpReqAnsContext<ResourceWatcherService_FilesClean_Req,ResourceWatcherService_FilesClean_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_FilesClean_Req,ResourceWatcherService_FilesClean_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_FilesClean(ctx);
- }
- break;
- case ResourceWatcherService_Method_FetchSystemSnapshot:
- {
- SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req,ResourceWatcherService_FetchSystemSnapshot_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req,ResourceWatcherService_FetchSystemSnapshot_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_FetchSystemSnapshot(ctx);
- }
- break;
- case ResourceWatcherService_Method_CheckIsFileExists:
- {
- SpReqAnsContext<ResourceWatcherService_CheckIsFileExists_Req,ResourceWatcherService_CheckIsFileExists_Ans>::Pointer ctx;
- ctx.Attach(new SpReqAnsContext<ResourceWatcherService_CheckIsFileExists_Req,ResourceWatcherService_CheckIsFileExists_Ans>(pTransactionContext));
- SpBuffer2Object(Buf, ctx->Req);
- pTransactionContext->GetLinkContext(ctx->link);
- EntityResource::setLink(ctx->link);
- Handle_CheckIsFileExists(ctx);
- }
- break;
- default:
- assert(0);
- break;
- }
-
- } else {
- pTransactionContext->SendAnswer(Error);
- }
- }
- };
- ///////////////////////////
- } // namespace ResourceWatcher
- #endif // __RESOURCEWATCHER_SERVER_G_H
|