#ifndef __SIPPHONE_SERVER_G_H #define __SIPPHONE_SERVER_G_H #pragma once // This code is generated by spgen tool! #include "SIPPhone_def_g.h" namespace SIPPhone { class PhoneService_ServerSessionBase : public CServerSessionBase { public: PhoneService_ServerSessionBase() { /// override by user } virtual ~PhoneService_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 PhoneService_Method_MakeCall: if (dwSignature == PhoneService_MethodSignature_MakeCall) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_HangupCall: if (dwSignature == PhoneService_MethodSignature_HangupCall) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartVideo: if (dwSignature == PhoneService_MethodSignature_StartVideo) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopVideo: if (dwSignature == PhoneService_MethodSignature_StopVideo) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_RealErrorCheck: if (dwSignature == PhoneService_MethodSignature_RealErrorCheck) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_ReleaseCall: if (dwSignature == PhoneService_MethodSignature_ReleaseCall) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_BeginState: if (dwSignature == PhoneService_MethodSignature_BeginState) { bOverlap = false; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_EndState: if (dwSignature == PhoneService_MethodSignature_EndState) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetCallingParam: if (dwSignature == PhoneService_MethodSignature_SetCallingParam) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetHandfreeOutVolume: if (dwSignature == PhoneService_MethodSignature_GetHandfreeOutVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetHandfreeOutVolume: if (dwSignature == PhoneService_MethodSignature_SetHandfreeOutVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetPickupOutVolume: if (dwSignature == PhoneService_MethodSignature_SetPickupOutVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetPickupOutVolume: if (dwSignature == PhoneService_MethodSignature_GetPickupOutVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartVideoRender: if (dwSignature == PhoneService_MethodSignature_StartVideoRender) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopVideoRender: if (dwSignature == PhoneService_MethodSignature_StopVideoRender) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetHandfreeInVolume: if (dwSignature == PhoneService_MethodSignature_GetHandfreeInVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetHandfreeInVolume: if (dwSignature == PhoneService_MethodSignature_SetHandfreeInVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetPickupInVolume: if (dwSignature == PhoneService_MethodSignature_SetPickupInVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetPickupInVolume: if (dwSignature == PhoneService_MethodSignature_GetPickupInVolume) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetAudioDevices: if (dwSignature == PhoneService_MethodSignature_GetAudioDevices) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartCameraRender: if (dwSignature == PhoneService_MethodSignature_StartCameraRender) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopCameraRender: if (dwSignature == PhoneService_MethodSignature_StopCameraRender) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_IsCameraRender: if (dwSignature == PhoneService_MethodSignature_IsCameraRender) { bOverlap = true; } else { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartBothCameraRender: if (dwSignature == PhoneService_MethodSignature_StartBothCameraRender) { 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 PhoneService_Method_MakeCall: if (dwSignature != PhoneService_MethodSignature_MakeCall) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_HangupCall: if (dwSignature != PhoneService_MethodSignature_HangupCall) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartVideo: if (dwSignature != PhoneService_MethodSignature_StartVideo) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopVideo: if (dwSignature != PhoneService_MethodSignature_StopVideo) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_RealErrorCheck: if (dwSignature != PhoneService_MethodSignature_RealErrorCheck) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_ReleaseCall: if (dwSignature != PhoneService_MethodSignature_ReleaseCall) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_BeginState: if (dwSignature != PhoneService_MethodSignature_BeginState) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_EndState: if (dwSignature != PhoneService_MethodSignature_EndState) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetCallingParam: if (dwSignature != PhoneService_MethodSignature_SetCallingParam) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetHandfreeOutVolume: if (dwSignature != PhoneService_MethodSignature_GetHandfreeOutVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetHandfreeOutVolume: if (dwSignature != PhoneService_MethodSignature_SetHandfreeOutVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetPickupOutVolume: if (dwSignature != PhoneService_MethodSignature_SetPickupOutVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetPickupOutVolume: if (dwSignature != PhoneService_MethodSignature_GetPickupOutVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartVideoRender: if (dwSignature != PhoneService_MethodSignature_StartVideoRender) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopVideoRender: if (dwSignature != PhoneService_MethodSignature_StopVideoRender) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetHandfreeInVolume: if (dwSignature != PhoneService_MethodSignature_GetHandfreeInVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetHandfreeInVolume: if (dwSignature != PhoneService_MethodSignature_SetHandfreeInVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_SetPickupInVolume: if (dwSignature != PhoneService_MethodSignature_SetPickupInVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetPickupInVolume: if (dwSignature != PhoneService_MethodSignature_GetPickupInVolume) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_GetAudioDevices: if (dwSignature != PhoneService_MethodSignature_GetAudioDevices) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartCameraRender: if (dwSignature != PhoneService_MethodSignature_StartCameraRender) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StopCameraRender: if (dwSignature != PhoneService_MethodSignature_StopCameraRender) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_IsCameraRender: if (dwSignature != PhoneService_MethodSignature_IsCameraRender) { Error = Error_MethodSignatureFailed; } break; case PhoneService_Method_StartBothCameraRender: if (dwSignature != PhoneService_MethodSignature_StartBothCameraRender) { Error = Error_MethodSignatureFailed; } break; default: Error = Error_MethodNotFound; break; } return Error; } virtual void Handle_MakeCall(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_HangupCall(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_StartVideo(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_StopVideo(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_RealErrorCheck(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_ReleaseCall(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_BeginState(SpSubscribeContext::Pointer ctx) { /// override by user } virtual void Handle_EndState(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_SetCallingParam(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_GetHandfreeOutVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_SetHandfreeOutVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_SetPickupOutVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_GetPickupOutVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_StartVideoRender(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_StopVideoRender(SpOnewayCallContext::Pointer ctx) { /// override by user } virtual void Handle_GetHandfreeInVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_SetHandfreeInVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_SetPickupInVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_GetPickupInVolume(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_GetAudioDevices(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_StartCameraRender(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_StopCameraRender(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_IsCameraRender(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void Handle_StartBothCameraRender(SpReqAnsContext::Pointer ctx) { /// override by user } virtual void OnRequest(CSmartPointer 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 PhoneService_Method_MakeCall: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_MakeCall(ctx); } break; case PhoneService_Method_HangupCall: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_HangupCall(ctx); } break; case PhoneService_Method_StartVideo: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StartVideo(ctx); } break; case PhoneService_Method_StopVideo: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StopVideo(ctx); } break; case PhoneService_Method_RealErrorCheck: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_RealErrorCheck(ctx); } break; case PhoneService_Method_ReleaseCall: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_ReleaseCall(ctx); } break; case PhoneService_Method_BeginState: { SpSubscribeContext::Pointer ctx; ctx.Attach(new SpSubscribeContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); Handle_BeginState(ctx); } break; case PhoneService_Method_EndState: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); Handle_EndState(ctx); } break; case PhoneService_Method_SetCallingParam: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_SetCallingParam(ctx); } break; case PhoneService_Method_GetHandfreeOutVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_GetHandfreeOutVolume(ctx); } break; case PhoneService_Method_SetHandfreeOutVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_SetHandfreeOutVolume(ctx); } break; case PhoneService_Method_SetPickupOutVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_SetPickupOutVolume(ctx); } break; case PhoneService_Method_GetPickupOutVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_GetPickupOutVolume(ctx); } break; case PhoneService_Method_StartVideoRender: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StartVideoRender(ctx); } break; case PhoneService_Method_StopVideoRender: { SpOnewayCallContext::Pointer ctx; ctx.Attach(new SpOnewayCallContext()); SpBuffer2Object(Buf, ctx->Info); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StopVideoRender(ctx); } break; case PhoneService_Method_GetHandfreeInVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_GetHandfreeInVolume(ctx); } break; case PhoneService_Method_SetHandfreeInVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_SetHandfreeInVolume(ctx); } break; case PhoneService_Method_SetPickupInVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_SetPickupInVolume(ctx); } break; case PhoneService_Method_GetPickupInVolume: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_GetPickupInVolume(ctx); } break; case PhoneService_Method_GetAudioDevices: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_GetAudioDevices(ctx); } break; case PhoneService_Method_StartCameraRender: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StartCameraRender(ctx); } break; case PhoneService_Method_StopCameraRender: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StopCameraRender(ctx); } break; case PhoneService_Method_IsCameraRender: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_IsCameraRender(ctx); } break; case PhoneService_Method_StartBothCameraRender: { SpReqAnsContext::Pointer ctx; ctx.Attach(new SpReqAnsContext(pTransactionContext)); SpBuffer2Object(Buf, ctx->Req); pTransactionContext->GetLinkContext(ctx->link); EntityResource::setLink(ctx->link); Handle_StartBothCameraRender(ctx); } break; default: assert(0); break; } } else { pTransactionContext->SendAnswer(Error); } } }; /////////////////////////// } // namespace SIPPhone #endif // __SIPPHONE_SERVER_G_H