SIPPhone_server_g.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. #ifndef __SIPPHONE_SERVER_G_H
  2. #define __SIPPHONE_SERVER_G_H
  3. #pragma once
  4. // This code is generated by spgen tool!
  5. #include "SIPPhone_def_g.h"
  6. namespace SIPPhone {
  7. class PhoneService_ServerSessionBase : public CServerSessionBase
  8. {
  9. public:
  10. PhoneService_ServerSessionBase()
  11. {
  12. /// override by user
  13. }
  14. virtual ~PhoneService_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 PhoneService_Method_MakeCall:
  25. if (dwSignature == PhoneService_MethodSignature_MakeCall) {
  26. bOverlap = true;
  27. } else {
  28. Error = Error_MethodSignatureFailed;
  29. }
  30. break;
  31. case PhoneService_Method_HangupCall:
  32. if (dwSignature == PhoneService_MethodSignature_HangupCall) {
  33. bOverlap = true;
  34. } else {
  35. Error = Error_MethodSignatureFailed;
  36. }
  37. break;
  38. case PhoneService_Method_StartVideo:
  39. if (dwSignature == PhoneService_MethodSignature_StartVideo) {
  40. bOverlap = true;
  41. } else {
  42. Error = Error_MethodSignatureFailed;
  43. }
  44. break;
  45. case PhoneService_Method_StopVideo:
  46. if (dwSignature == PhoneService_MethodSignature_StopVideo) {
  47. bOverlap = true;
  48. } else {
  49. Error = Error_MethodSignatureFailed;
  50. }
  51. break;
  52. case PhoneService_Method_RealErrorCheck:
  53. if (dwSignature == PhoneService_MethodSignature_RealErrorCheck) {
  54. bOverlap = true;
  55. } else {
  56. Error = Error_MethodSignatureFailed;
  57. }
  58. break;
  59. case PhoneService_Method_ReleaseCall:
  60. if (dwSignature == PhoneService_MethodSignature_ReleaseCall) {
  61. bOverlap = true;
  62. } else {
  63. Error = Error_MethodSignatureFailed;
  64. }
  65. break;
  66. case PhoneService_Method_BeginState:
  67. if (dwSignature == PhoneService_MethodSignature_BeginState) {
  68. bOverlap = false;
  69. } else {
  70. Error = Error_MethodSignatureFailed;
  71. }
  72. break;
  73. case PhoneService_Method_EndState:
  74. if (dwSignature == PhoneService_MethodSignature_EndState) {
  75. bOverlap = true;
  76. } else {
  77. Error = Error_MethodSignatureFailed;
  78. }
  79. break;
  80. case PhoneService_Method_SetCallingParam:
  81. if (dwSignature == PhoneService_MethodSignature_SetCallingParam) {
  82. bOverlap = true;
  83. } else {
  84. Error = Error_MethodSignatureFailed;
  85. }
  86. break;
  87. case PhoneService_Method_GetHandfreeOutVolume:
  88. if (dwSignature == PhoneService_MethodSignature_GetHandfreeOutVolume) {
  89. bOverlap = true;
  90. } else {
  91. Error = Error_MethodSignatureFailed;
  92. }
  93. break;
  94. case PhoneService_Method_SetHandfreeOutVolume:
  95. if (dwSignature == PhoneService_MethodSignature_SetHandfreeOutVolume) {
  96. bOverlap = true;
  97. } else {
  98. Error = Error_MethodSignatureFailed;
  99. }
  100. break;
  101. case PhoneService_Method_SetPickupOutVolume:
  102. if (dwSignature == PhoneService_MethodSignature_SetPickupOutVolume) {
  103. bOverlap = true;
  104. } else {
  105. Error = Error_MethodSignatureFailed;
  106. }
  107. break;
  108. case PhoneService_Method_GetPickupOutVolume:
  109. if (dwSignature == PhoneService_MethodSignature_GetPickupOutVolume) {
  110. bOverlap = true;
  111. } else {
  112. Error = Error_MethodSignatureFailed;
  113. }
  114. break;
  115. case PhoneService_Method_StartVideoRender:
  116. if (dwSignature == PhoneService_MethodSignature_StartVideoRender) {
  117. bOverlap = true;
  118. } else {
  119. Error = Error_MethodSignatureFailed;
  120. }
  121. break;
  122. case PhoneService_Method_StopVideoRender:
  123. if (dwSignature == PhoneService_MethodSignature_StopVideoRender) {
  124. bOverlap = true;
  125. } else {
  126. Error = Error_MethodSignatureFailed;
  127. }
  128. break;
  129. default:
  130. Error = Error_MethodNotFound;
  131. break;
  132. }
  133. return Error;
  134. }
  135. int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
  136. {
  137. ErrorCodeEnum Error = Error_Succeed;
  138. switch (dwMessageID) {
  139. case PhoneService_Method_MakeCall:
  140. if (dwSignature != PhoneService_MethodSignature_MakeCall) {
  141. Error = Error_MethodSignatureFailed;
  142. }
  143. break;
  144. case PhoneService_Method_HangupCall:
  145. if (dwSignature != PhoneService_MethodSignature_HangupCall) {
  146. Error = Error_MethodSignatureFailed;
  147. }
  148. break;
  149. case PhoneService_Method_StartVideo:
  150. if (dwSignature != PhoneService_MethodSignature_StartVideo) {
  151. Error = Error_MethodSignatureFailed;
  152. }
  153. break;
  154. case PhoneService_Method_StopVideo:
  155. if (dwSignature != PhoneService_MethodSignature_StopVideo) {
  156. Error = Error_MethodSignatureFailed;
  157. }
  158. break;
  159. case PhoneService_Method_RealErrorCheck:
  160. if (dwSignature != PhoneService_MethodSignature_RealErrorCheck) {
  161. Error = Error_MethodSignatureFailed;
  162. }
  163. break;
  164. case PhoneService_Method_ReleaseCall:
  165. if (dwSignature != PhoneService_MethodSignature_ReleaseCall) {
  166. Error = Error_MethodSignatureFailed;
  167. }
  168. break;
  169. case PhoneService_Method_BeginState:
  170. if (dwSignature != PhoneService_MethodSignature_BeginState) {
  171. Error = Error_MethodSignatureFailed;
  172. }
  173. break;
  174. case PhoneService_Method_EndState:
  175. if (dwSignature != PhoneService_MethodSignature_EndState) {
  176. Error = Error_MethodSignatureFailed;
  177. }
  178. break;
  179. case PhoneService_Method_SetCallingParam:
  180. if (dwSignature != PhoneService_MethodSignature_SetCallingParam) {
  181. Error = Error_MethodSignatureFailed;
  182. }
  183. break;
  184. case PhoneService_Method_GetHandfreeOutVolume:
  185. if (dwSignature != PhoneService_MethodSignature_GetHandfreeOutVolume) {
  186. Error = Error_MethodSignatureFailed;
  187. }
  188. break;
  189. case PhoneService_Method_SetHandfreeOutVolume:
  190. if (dwSignature != PhoneService_MethodSignature_SetHandfreeOutVolume) {
  191. Error = Error_MethodSignatureFailed;
  192. }
  193. break;
  194. case PhoneService_Method_SetPickupOutVolume:
  195. if (dwSignature != PhoneService_MethodSignature_SetPickupOutVolume) {
  196. Error = Error_MethodSignatureFailed;
  197. }
  198. break;
  199. case PhoneService_Method_GetPickupOutVolume:
  200. if (dwSignature != PhoneService_MethodSignature_GetPickupOutVolume) {
  201. Error = Error_MethodSignatureFailed;
  202. }
  203. break;
  204. case PhoneService_Method_StartVideoRender:
  205. if (dwSignature != PhoneService_MethodSignature_StartVideoRender) {
  206. Error = Error_MethodSignatureFailed;
  207. }
  208. break;
  209. case PhoneService_Method_StopVideoRender:
  210. if (dwSignature != PhoneService_MethodSignature_StopVideoRender) {
  211. Error = Error_MethodSignatureFailed;
  212. }
  213. break;
  214. default:
  215. Error = Error_MethodNotFound;
  216. break;
  217. }
  218. return Error;
  219. }
  220. virtual void Handle_MakeCall(SpReqAnsContext<PhoneService_MakeCall_Req, PhoneService_MakeCall_Ans>::Pointer ctx)
  221. {
  222. /// override by user
  223. }
  224. virtual void Handle_HangupCall(SpReqAnsContext<PhoneService_HangupCall_Req, PhoneService_HangupCall_Ans>::Pointer ctx)
  225. {
  226. /// override by user
  227. }
  228. virtual void Handle_StartVideo(SpOnewayCallContext<PhoneService_StartVideo_Info>::Pointer ctx)
  229. {
  230. /// override by user
  231. }
  232. virtual void Handle_StopVideo(SpOnewayCallContext<PhoneService_StopVideo_Info>::Pointer ctx)
  233. {
  234. /// override by user
  235. }
  236. virtual void Handle_RealErrorCheck(SpOnewayCallContext<PhoneService_RealErrorCheck_Info>::Pointer ctx)
  237. {
  238. /// override by user
  239. }
  240. virtual void Handle_ReleaseCall(SpReqAnsContext<PhoneService_ReleaseCall_Req, PhoneService_ReleaseCall_Ans>::Pointer ctx)
  241. {
  242. /// override by user
  243. }
  244. virtual void Handle_BeginState(SpSubscribeContext<PhoneService_BeginState_Sub, PhoneService_PhoneState_Info>::Pointer ctx)
  245. {
  246. /// override by user
  247. }
  248. virtual void Handle_EndState(SpOnewayCallContext<PhoneService_EndState_Info>::Pointer ctx)
  249. {
  250. /// override by user
  251. }
  252. virtual void Handle_SetCallingParam(SpOnewayCallContext<PhoneService_SetCallingParam_Info>::Pointer ctx)
  253. {
  254. /// override by user
  255. }
  256. virtual void Handle_GetHandfreeOutVolume(SpReqAnsContext<PhoneService_GetHandfreeOutVolume_Req, PhoneService_GetHandfreeOutVolume_Ans>::Pointer ctx)
  257. {
  258. /// override by user
  259. }
  260. virtual void Handle_SetHandfreeOutVolume(SpReqAnsContext<PhoneService_SetHandfreeOutVolume_Req, PhoneService_SetHandfreeOutVolume_Ans>::Pointer ctx)
  261. {
  262. /// override by user
  263. }
  264. virtual void Handle_SetPickupOutVolume(SpReqAnsContext<PhoneService_SetPickupOutVolume_Req, PhoneService_SetPickupOutVolume_Ans>::Pointer ctx)
  265. {
  266. /// override by user
  267. }
  268. virtual void Handle_GetPickupOutVolume(SpReqAnsContext<PhoneService_GetPickupOutVolume_Req, PhoneService_GetPickupOutVolume_Ans>::Pointer ctx)
  269. {
  270. /// override by user
  271. }
  272. virtual void Handle_StartVideoRender(SpOnewayCallContext<PhoneService_StartVideoRender_Info>::Pointer ctx)
  273. {
  274. /// override by user
  275. }
  276. virtual void Handle_StopVideoRender(SpOnewayCallContext<PhoneService_StopVideoRender_Info>::Pointer ctx)
  277. {
  278. /// override by user
  279. }
  280. virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
  281. {
  282. CAutoBuffer Buf;
  283. DWORD dwMessageID;
  284. DWORD dwMessageSignature;
  285. ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
  286. if (Error == Error_Succeed) {
  287. #ifdef DEBUG
  288. assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
  289. #else
  290. if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
  291. pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
  292. return;
  293. }
  294. #endif
  295. switch (dwMessageID) {
  296. case PhoneService_Method_MakeCall:
  297. {
  298. SpReqAnsContext<PhoneService_MakeCall_Req,PhoneService_MakeCall_Ans>::Pointer ctx;
  299. ctx.Attach(new SpReqAnsContext<PhoneService_MakeCall_Req,PhoneService_MakeCall_Ans>(pTransactionContext));
  300. SpBuffer2Object(Buf, ctx->Req);
  301. pTransactionContext->GetLinkContext(ctx->link);
  302. EntityResource::setLink(ctx->link);
  303. Handle_MakeCall(ctx);
  304. }
  305. break;
  306. case PhoneService_Method_HangupCall:
  307. {
  308. SpReqAnsContext<PhoneService_HangupCall_Req,PhoneService_HangupCall_Ans>::Pointer ctx;
  309. ctx.Attach(new SpReqAnsContext<PhoneService_HangupCall_Req,PhoneService_HangupCall_Ans>(pTransactionContext));
  310. SpBuffer2Object(Buf, ctx->Req);
  311. pTransactionContext->GetLinkContext(ctx->link);
  312. EntityResource::setLink(ctx->link);
  313. Handle_HangupCall(ctx);
  314. }
  315. break;
  316. case PhoneService_Method_StartVideo:
  317. {
  318. SpOnewayCallContext<PhoneService_StartVideo_Info>::Pointer ctx;
  319. ctx.Attach(new SpOnewayCallContext<PhoneService_StartVideo_Info>());
  320. SpBuffer2Object(Buf, ctx->Info);
  321. pTransactionContext->GetLinkContext(ctx->link);
  322. EntityResource::setLink(ctx->link);
  323. Handle_StartVideo(ctx);
  324. }
  325. break;
  326. case PhoneService_Method_StopVideo:
  327. {
  328. SpOnewayCallContext<PhoneService_StopVideo_Info>::Pointer ctx;
  329. ctx.Attach(new SpOnewayCallContext<PhoneService_StopVideo_Info>());
  330. SpBuffer2Object(Buf, ctx->Info);
  331. pTransactionContext->GetLinkContext(ctx->link);
  332. EntityResource::setLink(ctx->link);
  333. Handle_StopVideo(ctx);
  334. }
  335. break;
  336. case PhoneService_Method_RealErrorCheck:
  337. {
  338. SpOnewayCallContext<PhoneService_RealErrorCheck_Info>::Pointer ctx;
  339. ctx.Attach(new SpOnewayCallContext<PhoneService_RealErrorCheck_Info>());
  340. SpBuffer2Object(Buf, ctx->Info);
  341. pTransactionContext->GetLinkContext(ctx->link);
  342. EntityResource::setLink(ctx->link);
  343. Handle_RealErrorCheck(ctx);
  344. }
  345. break;
  346. case PhoneService_Method_ReleaseCall:
  347. {
  348. SpReqAnsContext<PhoneService_ReleaseCall_Req,PhoneService_ReleaseCall_Ans>::Pointer ctx;
  349. ctx.Attach(new SpReqAnsContext<PhoneService_ReleaseCall_Req,PhoneService_ReleaseCall_Ans>(pTransactionContext));
  350. SpBuffer2Object(Buf, ctx->Req);
  351. pTransactionContext->GetLinkContext(ctx->link);
  352. EntityResource::setLink(ctx->link);
  353. Handle_ReleaseCall(ctx);
  354. }
  355. break;
  356. case PhoneService_Method_BeginState:
  357. {
  358. SpSubscribeContext<PhoneService_BeginState_Sub,PhoneService_PhoneState_Info>::Pointer ctx;
  359. ctx.Attach(new SpSubscribeContext<PhoneService_BeginState_Sub,PhoneService_PhoneState_Info>(pTransactionContext));
  360. SpBuffer2Object(Buf, ctx->Req);
  361. Handle_BeginState(ctx);
  362. }
  363. break;
  364. case PhoneService_Method_EndState:
  365. {
  366. SpOnewayCallContext<PhoneService_EndState_Info>::Pointer ctx;
  367. ctx.Attach(new SpOnewayCallContext<PhoneService_EndState_Info>());
  368. SpBuffer2Object(Buf, ctx->Info);
  369. Handle_EndState(ctx);
  370. }
  371. break;
  372. case PhoneService_Method_SetCallingParam:
  373. {
  374. SpOnewayCallContext<PhoneService_SetCallingParam_Info>::Pointer ctx;
  375. ctx.Attach(new SpOnewayCallContext<PhoneService_SetCallingParam_Info>());
  376. SpBuffer2Object(Buf, ctx->Info);
  377. pTransactionContext->GetLinkContext(ctx->link);
  378. EntityResource::setLink(ctx->link);
  379. Handle_SetCallingParam(ctx);
  380. }
  381. break;
  382. case PhoneService_Method_GetHandfreeOutVolume:
  383. {
  384. SpReqAnsContext<PhoneService_GetHandfreeOutVolume_Req,PhoneService_GetHandfreeOutVolume_Ans>::Pointer ctx;
  385. ctx.Attach(new SpReqAnsContext<PhoneService_GetHandfreeOutVolume_Req,PhoneService_GetHandfreeOutVolume_Ans>(pTransactionContext));
  386. SpBuffer2Object(Buf, ctx->Req);
  387. pTransactionContext->GetLinkContext(ctx->link);
  388. EntityResource::setLink(ctx->link);
  389. Handle_GetHandfreeOutVolume(ctx);
  390. }
  391. break;
  392. case PhoneService_Method_SetHandfreeOutVolume:
  393. {
  394. SpReqAnsContext<PhoneService_SetHandfreeOutVolume_Req,PhoneService_SetHandfreeOutVolume_Ans>::Pointer ctx;
  395. ctx.Attach(new SpReqAnsContext<PhoneService_SetHandfreeOutVolume_Req,PhoneService_SetHandfreeOutVolume_Ans>(pTransactionContext));
  396. SpBuffer2Object(Buf, ctx->Req);
  397. pTransactionContext->GetLinkContext(ctx->link);
  398. EntityResource::setLink(ctx->link);
  399. Handle_SetHandfreeOutVolume(ctx);
  400. }
  401. break;
  402. case PhoneService_Method_SetPickupOutVolume:
  403. {
  404. SpReqAnsContext<PhoneService_SetPickupOutVolume_Req,PhoneService_SetPickupOutVolume_Ans>::Pointer ctx;
  405. ctx.Attach(new SpReqAnsContext<PhoneService_SetPickupOutVolume_Req,PhoneService_SetPickupOutVolume_Ans>(pTransactionContext));
  406. SpBuffer2Object(Buf, ctx->Req);
  407. pTransactionContext->GetLinkContext(ctx->link);
  408. EntityResource::setLink(ctx->link);
  409. Handle_SetPickupOutVolume(ctx);
  410. }
  411. break;
  412. case PhoneService_Method_GetPickupOutVolume:
  413. {
  414. SpReqAnsContext<PhoneService_GetPickupOutVolume_Req,PhoneService_GetPickupOutVolume_Ans>::Pointer ctx;
  415. ctx.Attach(new SpReqAnsContext<PhoneService_GetPickupOutVolume_Req,PhoneService_GetPickupOutVolume_Ans>(pTransactionContext));
  416. SpBuffer2Object(Buf, ctx->Req);
  417. pTransactionContext->GetLinkContext(ctx->link);
  418. EntityResource::setLink(ctx->link);
  419. Handle_GetPickupOutVolume(ctx);
  420. }
  421. break;
  422. case PhoneService_Method_StartVideoRender:
  423. {
  424. SpOnewayCallContext<PhoneService_StartVideoRender_Info>::Pointer ctx;
  425. ctx.Attach(new SpOnewayCallContext<PhoneService_StartVideoRender_Info>());
  426. SpBuffer2Object(Buf, ctx->Info);
  427. pTransactionContext->GetLinkContext(ctx->link);
  428. EntityResource::setLink(ctx->link);
  429. Handle_StartVideoRender(ctx);
  430. }
  431. break;
  432. case PhoneService_Method_StopVideoRender:
  433. {
  434. SpOnewayCallContext<PhoneService_StopVideoRender_Info>::Pointer ctx;
  435. ctx.Attach(new SpOnewayCallContext<PhoneService_StopVideoRender_Info>());
  436. SpBuffer2Object(Buf, ctx->Info);
  437. pTransactionContext->GetLinkContext(ctx->link);
  438. EntityResource::setLink(ctx->link);
  439. Handle_StopVideoRender(ctx);
  440. }
  441. break;
  442. default:
  443. assert(0);
  444. break;
  445. }
  446. } else {
  447. pTransactionContext->SendAnswer(Error);
  448. }
  449. }
  450. };
  451. ///////////////////////////
  452. } // namespace SIPPhone
  453. #endif // __SIPPHONE_SERVER_G_H