Example #1
0
        public override void Logon(IRpcController controller, LogonRequest request, Action <LogonResponse> done)
        {
            srp = new SRP(request.Email, "123");

            var message = srp.LogonChallenge;

            var moduleLoadRequest = ModuleLoadRequest.CreateBuilder()
                                    .SetModuleHandle(ContentHandle.CreateBuilder()
                                                     .SetRegion(Region)
                                                     .SetUsage(Usage)
                                                     .SetHash(ByteString.CopyFrom(ModuleHash)))
                                    .SetMessage(ByteString.CopyFrom(message))
                                    .Build();

            client.ListenerId = request.ListenerId;

            AuthenticationClient.CreateStub(client).ModuleLoad(controller, moduleLoadRequest, ClientServiceCallback);

            new Thread(() =>
            {
                wait.WaitOne();
                if (client.ErrorCode == AuthError.None)
                {
                    done(new LogonResponse.Builder
                    {
                        Account = new EntityId.Builder {
                            High = HighId.Account, Low = 0
                        }.Build(),
                        GameAccount = new EntityId.Builder {
                            High = HighId.GameAccount, Low = 0
                        }.Build(),
                    }.Build());
                }
                else
                {
                    done(new LogonResponse());
                }
            }).Start();
        }
 BattlenetRpcErrorCode HandleOnModuleLoad(ModuleLoadRequest request)
 {
     Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnModuleLoad: {1}",
                  GetCallerInfo(), request.ToString());
     return(BattlenetRpcErrorCode.RpcNotImplemented);
 }
        public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
        {
            switch (methodId)
            {
            case 1:
            {
                ModuleLoadRequest request = new ModuleLoadRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnModuleLoad(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnModuleLoad(bgs.protocol.authentication.v1.ModuleLoadRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 2:
            {
                ModuleMessageRequest request = new ModuleMessageRequest();
                request.MergeFrom(stream);


                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleOnModuleMessage(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnModuleMessage(bgs.protocol.authentication.v1.ModuleMessageRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 4:
            {
                ServerStateChangeRequest request = new ServerStateChangeRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnServerStateChange(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnServerStateChange(bgs.protocol.authentication.v1.ServerStateChangeRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 5:
            {
                LogonResult request = new LogonResult();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnLogonComplete(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonComplete(bgs.protocol.authentication.v1.LogonResult: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 6:
            {
                MemModuleLoadRequest request = new MemModuleLoadRequest();
                request.MergeFrom(stream);


                MemModuleLoadResponse response = new MemModuleLoadResponse();
                BattlenetRpcErrorCode status   = HandleOnMemModuleLoad(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnMemModuleLoad(bgs.protocol.authentication.v1.MemModuleLoadRequest: {1}) returned bgs.protocol.authentication.v1.MemModuleLoadResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 10:
            {
                LogonUpdateRequest request = new LogonUpdateRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnLogonUpdate(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonUpdate(bgs.protocol.authentication.v1.LogonUpdateRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 11:
            {
                VersionInfoNotification request = new VersionInfoNotification();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnVersionInfoUpdated(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnVersionInfoUpdated(bgs.protocol.authentication.v1.VersionInfoNotification: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 12:
            {
                LogonQueueUpdateRequest request = new LogonQueueUpdateRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnLogonQueueUpdate(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonQueueUpdate(bgs.protocol.authentication.v1.LogonQueueUpdateRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 13:
            {
                NoData request = new NoData();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnLogonQueueEnd(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnLogonQueueEnd(bgs.protocol.NoData: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 14:
            {
                GameAccountSelectedRequest request = new GameAccountSelectedRequest();
                request.MergeFrom(stream);


                BattlenetRpcErrorCode status = HandleOnGameAccountSelected(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationListener.OnGameAccountSelected(bgs.protocol.authentication.v1.GameAccountSelectedRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            default:
                Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
                SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
                break;
            }
        }
Example #4
0
 public override void ModuleLoad(Google.ProtocolBuffers.IRpcController controller, ModuleLoadRequest request, Action <ModuleLoadResponse> done)
 {
     throw new NotImplementedException();
 }
Example #5
0
		public override void ModuleLoad(Google.ProtocolBuffers.IRpcController controller, ModuleLoadRequest request, Action<ModuleLoadResponse> done) {
			throw new NotImplementedException();
		}