ResourceWatcher_server_g.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. #ifndef __RESOURCEWATCHER_SERVER_G_H
  2. #define __RESOURCEWATCHER_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "ResourceWatcher_def_g.h"
  6. namespace ResourceWatcher {
  7. class ResourceWatcherService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. ResourceWatcherService_ServerSessionBase()
  11. {
  12. /// override by user
  13. }
  14. virtual ~ResourceWatcherService_ServerSessionBase()
  15. {
  16. /// override by user
  17. }
  18. virtual bool IsExclusive() { return false; }
  19. virtual bool IsSessionOverlap() { return true; }
  20. virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
  21. {
  22. ErrorCodeEnum Error = Error_Succeed;
  23. switch (dwMessageID) {
  24. case ResourceWatcherService_Method_Fetch:
  25. if (dwSignature == ResourceWatcherService_MethodSignature_Fetch) {
  26. bOverlap = true;
  27. } else {
  28. Error = Error_MethodSignatureFailed;
  29. }
  30. break;
  31. case ResourceWatcherService_Method_GetDevInfo:
  32. if (dwSignature == ResourceWatcherService_MethodSignature_GetDevInfo) {
  33. bOverlap = true;
  34. } else {
  35. Error = Error_MethodSignatureFailed;
  36. }
  37. break;
  38. case ResourceWatcherService_Method_GetCardSwiper:
  39. if (dwSignature == ResourceWatcherService_MethodSignature_GetCardSwiper) {
  40. bOverlap = true;
  41. } else {
  42. Error = Error_MethodSignatureFailed;
  43. }
  44. break;
  45. case ResourceWatcherService_Method_GetCpuType:
  46. if (dwSignature == ResourceWatcherService_MethodSignature_GetCpuType) {
  47. bOverlap = true;
  48. } else {
  49. Error = Error_MethodSignatureFailed;
  50. }
  51. break;
  52. case ResourceWatcherService_Method_OperateFile:
  53. if (dwSignature == ResourceWatcherService_MethodSignature_OperateFile) {
  54. bOverlap = true;
  55. } else {
  56. Error = Error_MethodSignatureFailed;
  57. }
  58. break;
  59. case ResourceWatcherService_Method_ExtractEventLog:
  60. if (dwSignature == ResourceWatcherService_MethodSignature_ExtractEventLog) {
  61. bOverlap = true;
  62. } else {
  63. Error = Error_MethodSignatureFailed;
  64. }
  65. break;
  66. case ResourceWatcherService_Method_UpdateDNS:
  67. if (dwSignature == ResourceWatcherService_MethodSignature_UpdateDNS) {
  68. bOverlap = true;
  69. } else {
  70. Error = Error_MethodSignatureFailed;
  71. }
  72. break;
  73. case ResourceWatcherService_Method_GetNetworkInfo:
  74. if (dwSignature == ResourceWatcherService_MethodSignature_GetNetworkInfo) {
  75. bOverlap = true;
  76. } else {
  77. Error = Error_MethodSignatureFailed;
  78. }
  79. break;
  80. case ResourceWatcherService_Method_GetThirdPartyInstallState:
  81. if (dwSignature == ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
  82. bOverlap = true;
  83. } else {
  84. Error = Error_MethodSignatureFailed;
  85. }
  86. break;
  87. case ResourceWatcherService_Method_InstallThirdPartyProgram:
  88. if (dwSignature == ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
  89. bOverlap = true;
  90. } else {
  91. Error = Error_MethodSignatureFailed;
  92. }
  93. break;
  94. case ResourceWatcherService_Method_CheckNetType:
  95. if (dwSignature == ResourceWatcherService_MethodSignature_CheckNetType) {
  96. bOverlap = true;
  97. } else {
  98. Error = Error_MethodSignatureFailed;
  99. }
  100. break;
  101. case ResourceWatcherService_Method_GetBizLinks:
  102. if (dwSignature == ResourceWatcherService_MethodSignature_GetBizLinks) {
  103. bOverlap = true;
  104. } else {
  105. Error = Error_MethodSignatureFailed;
  106. }
  107. break;
  108. case ResourceWatcherService_Method_BizLinkDetect:
  109. if (dwSignature == ResourceWatcherService_MethodSignature_BizLinkDetect) {
  110. bOverlap = true;
  111. } else {
  112. Error = Error_MethodSignatureFailed;
  113. }
  114. break;
  115. default:
  116. Error = Error_MethodNotFound;
  117. break;
  118. }
  119. return Error;
  120. }
  121. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  122. {
  123. ErrorCodeEnum Error = Error_Succeed;
  124. switch (dwMessageID) {
  125. case ResourceWatcherService_Method_Fetch:
  126. if (dwSignature != ResourceWatcherService_MethodSignature_Fetch) {
  127. Error = Error_MethodSignatureFailed;
  128. }
  129. break;
  130. case ResourceWatcherService_Method_GetDevInfo:
  131. if (dwSignature != ResourceWatcherService_MethodSignature_GetDevInfo) {
  132. Error = Error_MethodSignatureFailed;
  133. }
  134. break;
  135. case ResourceWatcherService_Method_GetCardSwiper:
  136. if (dwSignature != ResourceWatcherService_MethodSignature_GetCardSwiper) {
  137. Error = Error_MethodSignatureFailed;
  138. }
  139. break;
  140. case ResourceWatcherService_Method_GetCpuType:
  141. if (dwSignature != ResourceWatcherService_MethodSignature_GetCpuType) {
  142. Error = Error_MethodSignatureFailed;
  143. }
  144. break;
  145. case ResourceWatcherService_Method_OperateFile:
  146. if (dwSignature != ResourceWatcherService_MethodSignature_OperateFile) {
  147. Error = Error_MethodSignatureFailed;
  148. }
  149. break;
  150. case ResourceWatcherService_Method_ExtractEventLog:
  151. if (dwSignature != ResourceWatcherService_MethodSignature_ExtractEventLog) {
  152. Error = Error_MethodSignatureFailed;
  153. }
  154. break;
  155. case ResourceWatcherService_Method_UpdateDNS:
  156. if (dwSignature != ResourceWatcherService_MethodSignature_UpdateDNS) {
  157. Error = Error_MethodSignatureFailed;
  158. }
  159. break;
  160. case ResourceWatcherService_Method_GetNetworkInfo:
  161. if (dwSignature != ResourceWatcherService_MethodSignature_GetNetworkInfo) {
  162. Error = Error_MethodSignatureFailed;
  163. }
  164. break;
  165. case ResourceWatcherService_Method_GetThirdPartyInstallState:
  166. if (dwSignature != ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
  167. Error = Error_MethodSignatureFailed;
  168. }
  169. break;
  170. case ResourceWatcherService_Method_InstallThirdPartyProgram:
  171. if (dwSignature != ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
  172. Error = Error_MethodSignatureFailed;
  173. }
  174. break;
  175. case ResourceWatcherService_Method_CheckNetType:
  176. if (dwSignature != ResourceWatcherService_MethodSignature_CheckNetType) {
  177. Error = Error_MethodSignatureFailed;
  178. }
  179. break;
  180. case ResourceWatcherService_Method_GetBizLinks:
  181. if (dwSignature != ResourceWatcherService_MethodSignature_GetBizLinks) {
  182. Error = Error_MethodSignatureFailed;
  183. }
  184. break;
  185. case ResourceWatcherService_Method_BizLinkDetect:
  186. if (dwSignature != ResourceWatcherService_MethodSignature_BizLinkDetect) {
  187. Error = Error_MethodSignatureFailed;
  188. }
  189. break;
  190. default:
  191. Error = Error_MethodNotFound;
  192. break;
  193. }
  194. return Error;
  195. }
  196. virtual void Handle_Fetch(SpReqAnsContext<ResourceWatcherService_Fetch_Req, ResourceWatcherService_Fetch_Ans>::Pointer ctx)
  197. {
  198. /// override by user
  199. }
  200. virtual void Handle_GetDevInfo(SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req, ResourceWatcherService_GetDevInfo_Ans>::Pointer ctx)
  201. {
  202. /// override by user
  203. }
  204. virtual void Handle_GetCardSwiper(SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req, ResourceWatcherService_GetCardSwiper_Ans>::Pointer ctx)
  205. {
  206. /// override by user
  207. }
  208. virtual void Handle_GetCpuType(SpReqAnsContext<ResourceWatcherService_GetCpuType_Req, ResourceWatcherService_GetCpuType_Ans>::Pointer ctx)
  209. {
  210. /// override by user
  211. }
  212. virtual void Handle_OperateFile(SpReqAnsContext<ResourceWatcherService_OperateFile_Req, ResourceWatcherService_OperateFile_Ans>::Pointer ctx)
  213. {
  214. /// override by user
  215. }
  216. virtual void Handle_ExtractEventLog(SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req, ResourceWatcherService_ExtractEventLog_Ans>::Pointer ctx)
  217. {
  218. /// override by user
  219. }
  220. virtual void Handle_UpdateDNS(SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req, ResourceWatcherService_UpdateDNS_Ans>::Pointer ctx)
  221. {
  222. /// override by user
  223. }
  224. virtual void Handle_GetNetworkInfo(SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req, ResourceWatcherService_GetNetworkInfo_Ans>::Pointer ctx)
  225. {
  226. /// override by user
  227. }
  228. virtual void Handle_GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx)
  229. {
  230. /// override by user
  231. }
  232. virtual void Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx)
  233. {
  234. /// override by user
  235. }
  236. virtual void Handle_CheckNetType(SpReqAnsContext<ResourceWatcherService_CheckNetType_Req, ResourceWatcherService_CheckNetType_Ans>::Pointer ctx)
  237. {
  238. /// override by user
  239. }
  240. virtual void Handle_GetBizLinks(SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req, ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx)
  241. {
  242. /// override by user
  243. }
  244. virtual void Handle_BizLinkDetect(SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req, ResourceWatcherService_BizLinkDetect_Ans>::Pointer ctx)
  245. {
  246. /// override by user
  247. }
  248. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  249. {
  250. CAutoBuffer Buf;
  251. DWORD dwMessageID;
  252. DWORD dwMessageSignature;
  253. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  254. if (Error == Error_Succeed) {
  255. #ifdef DEBUG
  256. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  257. #else
  258. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  259. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  260. return;
  261. }
  262. #endif
  263. switch (dwMessageID) {
  264. case ResourceWatcherService_Method_Fetch:
  265. {
  266. SpReqAnsContext<ResourceWatcherService_Fetch_Req,ResourceWatcherService_Fetch_Ans>::Pointer ctx;
  267. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_Fetch_Req,ResourceWatcherService_Fetch_Ans>(pTransactionContext));
  268. SpBuffer2Object(Buf, ctx->Req);
  269. Handle_Fetch(ctx);
  270. }
  271. break;
  272. case ResourceWatcherService_Method_GetDevInfo:
  273. {
  274. SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req,ResourceWatcherService_GetDevInfo_Ans>::Pointer ctx;
  275. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req,ResourceWatcherService_GetDevInfo_Ans>(pTransactionContext));
  276. SpBuffer2Object(Buf, ctx->Req);
  277. Handle_GetDevInfo(ctx);
  278. }
  279. break;
  280. case ResourceWatcherService_Method_GetCardSwiper:
  281. {
  282. SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req,ResourceWatcherService_GetCardSwiper_Ans>::Pointer ctx;
  283. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetCardSwiper_Req,ResourceWatcherService_GetCardSwiper_Ans>(pTransactionContext));
  284. SpBuffer2Object(Buf, ctx->Req);
  285. Handle_GetCardSwiper(ctx);
  286. }
  287. break;
  288. case ResourceWatcherService_Method_GetCpuType:
  289. {
  290. SpReqAnsContext<ResourceWatcherService_GetCpuType_Req,ResourceWatcherService_GetCpuType_Ans>::Pointer ctx;
  291. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetCpuType_Req,ResourceWatcherService_GetCpuType_Ans>(pTransactionContext));
  292. SpBuffer2Object(Buf, ctx->Req);
  293. Handle_GetCpuType(ctx);
  294. }
  295. break;
  296. case ResourceWatcherService_Method_OperateFile:
  297. {
  298. SpReqAnsContext<ResourceWatcherService_OperateFile_Req,ResourceWatcherService_OperateFile_Ans>::Pointer ctx;
  299. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_OperateFile_Req,ResourceWatcherService_OperateFile_Ans>(pTransactionContext));
  300. SpBuffer2Object(Buf, ctx->Req);
  301. Handle_OperateFile(ctx);
  302. }
  303. break;
  304. case ResourceWatcherService_Method_ExtractEventLog:
  305. {
  306. SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req,ResourceWatcherService_ExtractEventLog_Ans>::Pointer ctx;
  307. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_ExtractEventLog_Req,ResourceWatcherService_ExtractEventLog_Ans>(pTransactionContext));
  308. SpBuffer2Object(Buf, ctx->Req);
  309. Handle_ExtractEventLog(ctx);
  310. }
  311. break;
  312. case ResourceWatcherService_Method_UpdateDNS:
  313. {
  314. SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req,ResourceWatcherService_UpdateDNS_Ans>::Pointer ctx;
  315. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_UpdateDNS_Req,ResourceWatcherService_UpdateDNS_Ans>(pTransactionContext));
  316. SpBuffer2Object(Buf, ctx->Req);
  317. Handle_UpdateDNS(ctx);
  318. }
  319. break;
  320. case ResourceWatcherService_Method_GetNetworkInfo:
  321. {
  322. SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req,ResourceWatcherService_GetNetworkInfo_Ans>::Pointer ctx;
  323. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetNetworkInfo_Req,ResourceWatcherService_GetNetworkInfo_Ans>(pTransactionContext));
  324. SpBuffer2Object(Buf, ctx->Req);
  325. Handle_GetNetworkInfo(ctx);
  326. }
  327. break;
  328. case ResourceWatcherService_Method_GetThirdPartyInstallState:
  329. {
  330. SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx;
  331. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>(pTransactionContext));
  332. SpBuffer2Object(Buf, ctx->Req);
  333. Handle_GetThirdPartyInstallState(ctx);
  334. }
  335. break;
  336. case ResourceWatcherService_Method_InstallThirdPartyProgram:
  337. {
  338. SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx;
  339. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,ResourceWatcherService_InstallThirdPartyProgram_Ans>(pTransactionContext));
  340. SpBuffer2Object(Buf, ctx->Req);
  341. Handle_InstallThirdPartyProgram(ctx);
  342. }
  343. break;
  344. case ResourceWatcherService_Method_CheckNetType:
  345. {
  346. SpReqAnsContext<ResourceWatcherService_CheckNetType_Req,ResourceWatcherService_CheckNetType_Ans>::Pointer ctx;
  347. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_CheckNetType_Req,ResourceWatcherService_CheckNetType_Ans>(pTransactionContext));
  348. SpBuffer2Object(Buf, ctx->Req);
  349. Handle_CheckNetType(ctx);
  350. }
  351. break;
  352. case ResourceWatcherService_Method_GetBizLinks:
  353. {
  354. SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx;
  355. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,ResourceWatcherService_GetBizLinks_Ans>(pTransactionContext));
  356. SpBuffer2Object(Buf, ctx->Req);
  357. Handle_GetBizLinks(ctx);
  358. }
  359. break;
  360. case ResourceWatcherService_Method_BizLinkDetect:
  361. {
  362. SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req,ResourceWatcherService_BizLinkDetect_Ans>::Pointer ctx;
  363. ctx.Attach(new SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req,ResourceWatcherService_BizLinkDetect_Ans>(pTransactionContext));
  364. SpBuffer2Object(Buf, ctx->Req);
  365. Handle_BizLinkDetect(ctx);
  366. }
  367. break;
  368. default:
  369. assert(0);
  370. break;
  371. }
  372. } else {
  373. pTransactionContext->SendAnswer(Error);
  374. }
  375. }
  376. };
  377. ///////////////////////////
  378. } // namespace ResourceWatcher
  379. #endif // __RESOURCEWATCHER_SERVER_G_H