Ported .Net Core commits:

hondacrx:
- Initial commit: Switch to .Net Core 2.0
- Fix build and removed not needed files
Fabi:
- Updated solution platforms.
- Changed folder structure.
- Change library target framework to netstandard2.0.
- Updated solution platforms again...
- Removed windows specific kernel32 function usage (Ctrl-C handler).
This commit is contained in:
Fabian
2017-10-26 17:23:44 +02:00
parent 227702e19c
commit a3dc7b3f48
844 changed files with 26064 additions and 1824 deletions
@@ -0,0 +1,582 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Account.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class AccountService : ServiceBase
{
public AccountService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 12:
{
GameAccountHandle request = new GameAccountHandle();
request.MergeFrom(stream);
GameAccountBlob response = new GameAccountBlob();
BattlenetRpcErrorCode status = HandleGetGameAccountBlob(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameAccountBlob(GameAccountHandle: {1}) returned GameAccountBlob: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 13:
{
GetAccountRequest request = new GetAccountRequest();
request.MergeFrom(stream);
GetAccountResponse response = new GetAccountResponse();
BattlenetRpcErrorCode status = HandleGetAccount(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAccount(GetAccountRequest: {1}) returned GetAccountResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 14:
{
CreateGameAccountRequest request = new CreateGameAccountRequest();
request.MergeFrom(stream);
GameAccountHandle response = new GameAccountHandle();
BattlenetRpcErrorCode status = HandleCreateGameAccount(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.CreateGameAccount(CreateGameAccountRequest: {1}) returned GameAccountHandle: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 15:
{
IsIgrAddressRequest request = new IsIgrAddressRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleIsIgrAddress(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.IsIgrAddress(IsIgrAddressRequest: {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 20:
{
CacheExpireRequest request = new CacheExpireRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleCacheExpire(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.CacheExpire(CacheExpireRequest: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 21:
{
CredentialUpdateRequest request = new CredentialUpdateRequest();
request.MergeFrom(stream);
CredentialUpdateResponse response = new CredentialUpdateResponse();
BattlenetRpcErrorCode status = HandleCredentialUpdate(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.CredentialUpdate(CredentialUpdateRequest: {1}) returned CredentialUpdateResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 25:
{
SubscriptionUpdateRequest request = new SubscriptionUpdateRequest();
request.MergeFrom(stream);
SubscriptionUpdateResponse response = new SubscriptionUpdateResponse();
BattlenetRpcErrorCode status = HandleSubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.Subscribe(SubscriptionUpdateRequest: {1}) returned SubscriptionUpdateResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 26:
{
SubscriptionUpdateRequest request = new SubscriptionUpdateRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUnsubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.Unsubscribe(SubscriptionUpdateRequest: {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 30:
{
GetAccountStateRequest request = new GetAccountStateRequest();
request.MergeFrom(stream);
GetAccountStateResponse response = new GetAccountStateResponse();
BattlenetRpcErrorCode status = HandleGetAccountState(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAccountState(GetAccountStateRequest: {1}) returned GetAccountStateResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 31:
{
GetGameAccountStateRequest request = new GetGameAccountStateRequest();
request.MergeFrom(stream);
GetGameAccountStateResponse response = new GetGameAccountStateResponse();
BattlenetRpcErrorCode status = HandleGetGameAccountState(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameAccountState(GetGameAccountStateRequest: {1}) returned GetGameAccountStateResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 32:
{
GetLicensesRequest request = new GetLicensesRequest();
request.MergeFrom(stream);
GetLicensesResponse response = new GetLicensesResponse();
BattlenetRpcErrorCode status = HandleGetLicenses(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetLicenses(GetLicensesRequest: {1}) returned GetLicensesResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 33:
{
GetGameTimeRemainingInfoRequest request = new GetGameTimeRemainingInfoRequest();
request.MergeFrom(stream);
GetGameTimeRemainingInfoResponse response = new GetGameTimeRemainingInfoResponse();
BattlenetRpcErrorCode status = HandleGetGameTimeRemainingInfo(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameTimeRemainingInfo(GetGameTimeRemainingInfoRequest: {1}) returned GetGameTimeRemainingInfoResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 34:
{
GetGameSessionInfoRequest request = new GetGameSessionInfoRequest();
request.MergeFrom(stream);
GetGameSessionInfoResponse response = new GetGameSessionInfoResponse();
BattlenetRpcErrorCode status = HandleGetGameSessionInfo(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameSessionInfo(GetGameSessionInfoRequest: {1}) returned GetGameSessionInfoResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 35:
{
GetCAISInfoRequest request = new GetCAISInfoRequest();
request.MergeFrom(stream);
GetCAISInfoResponse response = new GetCAISInfoResponse();
BattlenetRpcErrorCode status = HandleGetCAISInfo(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetCAISInfo(GetCAISInfoRequest: {1}) returned GetCAISInfoResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 36:
{
ForwardCacheExpireRequest request = new ForwardCacheExpireRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleForwardCacheExpire(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.ForwardCacheExpire(ForwardCacheExpireRequest: {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 37:
{
GetAuthorizedDataRequest request = new GetAuthorizedDataRequest();
request.MergeFrom(stream);
GetAuthorizedDataResponse response = new GetAuthorizedDataResponse();
BattlenetRpcErrorCode status = HandleGetAuthorizedData(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetAuthorizedData(GetAuthorizedDataRequest: {1}) returned GetAuthorizedDataResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 38:
{
AccountFlagUpdateRequest request = new AccountFlagUpdateRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleAccountFlagUpdate(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.AccountFlagUpdate(AccountFlagUpdateRequest: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 39:
{
GameAccountFlagUpdateRequest request = new GameAccountFlagUpdateRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleGameAccountFlagUpdate(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GameAccountFlagUpdate(GameAccountFlagUpdateRequest: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
/* case 40:
{
UpdateParentalControlsAndCAISRequest request = new UpdateParentalControlsAndCAISRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUpdateParentalControlsAndCAIS(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.UpdateParentalControlsAndCAIS(UpdateParentalControlsAndCAISRequest: {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 41:
{
CreateGameAccountRequest request = new CreateGameAccountRequest();
request.MergeFrom(stream);
CreateGameAccountResponse response = new CreateGameAccountResponse();
BattlenetRpcErrorCode status = HandleCreateGameAccount2(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.CreateGameAccount2(CreateGameAccountRequest: {1}) returned CreateGameAccountResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 42:
{
GetGameAccountRequest request = new GetGameAccountRequest();
request.MergeFrom(stream);
GetGameAccountResponse response = new GetGameAccountResponse();
BattlenetRpcErrorCode status = HandleGetGameAccount(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.GetGameAccount(GetGameAccountRequest: {1}) returned GetGameAccountResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, &response);
else
SendResponse(token, status);
break;
}
case 43:
{
QueueDeductRecordRequest request = new QueueDeductRecordRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleQueueDeductRecord(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountService.QueueDeductRecord(QueueDeductRecordRequest: {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;
}*/
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleGetGameAccountBlob(GameAccountHandle request, GameAccountBlob response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetAccount({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetAccount(GetAccountRequest request, GetAccountResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetAccount({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleCreateGameAccount(CreateGameAccountRequest request, GameAccountHandle response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.CreateGameAccount({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleIsIgrAddress(IsIgrAddressRequest request, NoData response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.IsIgrAddress({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleCacheExpire(CacheExpireRequest request)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.CacheExpire({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleCredentialUpdate(CredentialUpdateRequest request, CredentialUpdateResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.CredentialUpdate({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSubscribe(SubscriptionUpdateRequest request, SubscriptionUpdateResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.Subscribe({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUnsubscribe(SubscriptionUpdateRequest request, NoData response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.Unsubscribe({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetAccountState(GetAccountStateRequest request, GetAccountStateResponse response)
{
return _session.HandleGetAccountState(request, response);
}
BattlenetRpcErrorCode HandleGetGameAccountState(GetGameAccountStateRequest request, GetGameAccountStateResponse response)
{
return _session.HandleGetGameAccountState(request, response);
}
BattlenetRpcErrorCode HandleGetLicenses(GetLicensesRequest request, GetLicensesResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetLicenses({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetGameTimeRemainingInfo(GetGameTimeRemainingInfoRequest request, GetGameTimeRemainingInfoResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetGameTimeRemainingInfo({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetGameSessionInfo(GetGameSessionInfoRequest request, GetGameSessionInfoResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetGameSessionInfo({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetCAISInfo(GetCAISInfoRequest request, GetCAISInfoResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetCAISInfo({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleForwardCacheExpire(ForwardCacheExpireRequest request, NoData response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.ForwardCacheExpire({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetAuthorizedData(GetAuthorizedDataRequest request, GetAuthorizedDataResponse response)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetAuthorizedData({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleAccountFlagUpdate(AccountFlagUpdateRequest request)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.AccountFlagUpdate({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGameAccountFlagUpdate(GameAccountFlagUpdateRequest request)
{
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GameAccountFlagUpdate({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
/*BattlenetRpcErrorCode HandleUpdateParentalControlsAndCAIS(UpdateParentalControlsAndCAISRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.UpdateParentalControlsAndCAIS: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleCreateGameAccount2(CreateGameAccountRequest request, CreateGameAccountResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.CreateGameAccount2: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetGameAccount(GetGameAccountRequest request, GetGameAccountResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.GetGameAccount: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleQueueDeductRecord(QueueDeductRecordRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountService.QueueDeductRecord: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
*/
}
class AccountListener : ServiceBase
{
public AccountListener(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
AccountStateNotification request = new AccountStateNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnAccountStateUpdated(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnAccountStateUpdated(AccountStateNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 2:
{
GameAccountStateNotification request = new GameAccountStateNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnGameAccountStateUpdated(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameAccountStateUpdated(GameAccountStateNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 3:
{
GameAccountNotification request = new GameAccountNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnGameAccountsUpdated(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameAccountsUpdated(GameAccountNotification: {1} status: {2}.", GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 4:
{
GameAccountSessionNotification request = new GameAccountSessionNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnGameSessionUpdated(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AccountListener.OnGameSessionUpdated(GameAccountSessionNotification: {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;
}
}
BattlenetRpcErrorCode HandleOnAccountStateUpdated(AccountStateNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnAccountStateUpdated: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameAccountStateUpdated(GameAccountStateNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameAccountStateUpdated: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameAccountsUpdated(GameAccountNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameAccountsUpdated: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameSessionUpdated(GameAccountSessionNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AccountListener.OnGameSessionUpdated: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}
@@ -0,0 +1,442 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Authentication.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class AuthenticationService : ServiceBase
{
public AuthenticationService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
LogonRequest request = new LogonRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleLogon(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.Logon(bgs.protocol.authentication.v1.LogonRequest: {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 2:
{
ModuleNotification request = new ModuleNotification();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleModuleNotify(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.ModuleNotify(bgs.protocol.authentication.v1.ModuleNotification: {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 3:
{
ModuleMessageRequest request = new ModuleMessageRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleModuleMessage(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.ModuleMessage(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:
{
EntityId request = new EntityId();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSelectGameAccount_DEPRECATED(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.SelectGameAccount_DEPRECATED(bgs.protocol.EntityId: {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 5:
{
GenerateSSOTokenRequest request = new GenerateSSOTokenRequest();
request.MergeFrom(stream);
GenerateSSOTokenResponse response = new GenerateSSOTokenResponse();
BattlenetRpcErrorCode status = HandleGenerateSSOToken(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.GenerateSSOToken(bgs.protocol.authentication.v1.GenerateSSOTokenRequest: {1}) returned bgs.protocol.authentication.v1.GenerateSSOTokenResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 6:
{
SelectGameAccountRequest request = new SelectGameAccountRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSelectGameAccount(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.SelectGameAccount(bgs.protocol.authentication.v1.SelectGameAccountRequest: {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 7:
{
VerifyWebCredentialsRequest request = new VerifyWebCredentialsRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleVerifyWebCredentials(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.VerifyWebCredentials(bgs.protocol.authentication.v1.VerifyWebCredentialsRequest: {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 8:
{
GenerateWebCredentialsRequest request = new GenerateWebCredentialsRequest();
request.MergeFrom(stream);
GenerateWebCredentialsResponse response = new GenerateWebCredentialsResponse();
BattlenetRpcErrorCode status = HandleGenerateWebCredentials(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method AuthenticationService.GenerateWebCredentials(bgs.protocol.authentication.v1.GenerateWebCredentialsRequest: {1}) returned bgs.protocol.authentication.v1.GenerateWebCredentialsResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleLogon(LogonRequest request, NoData response)
{
return _session.HandleLogon(request);
}
BattlenetRpcErrorCode HandleModuleNotify(ModuleNotification request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.ModuleNotify: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleModuleMessage(ModuleMessageRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.ModuleMessage: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSelectGameAccount_DEPRECATED(EntityId request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.SelectGameAccount_DEPRECATED: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGenerateSSOToken(GenerateSSOTokenRequest request, GenerateSSOTokenResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.GenerateSSOToken: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSelectGameAccount(SelectGameAccountRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.SelectGameAccount: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleVerifyWebCredentials(VerifyWebCredentialsRequest request, NoData response)
{
return _session.HandleVerifyWebCredentials(request);
}
BattlenetRpcErrorCode HandleGenerateWebCredentials(GenerateWebCredentialsRequest request, GenerateWebCredentialsResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationService.GenerateWebCredentials: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
class AuthenticationListener : ServiceBase
{
public AuthenticationListener(Session session, uint serviceHash) : base(session, serviceHash) { }
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;
}
}
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;
}
BattlenetRpcErrorCode HandleOnModuleMessage(ModuleMessageRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnModuleMessage: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnServerStateChange(ServerStateChangeRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnServerStateChange: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnLogonComplete(LogonResult request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonComplete: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnMemModuleLoad(MemModuleLoadRequest request, MemModuleLoadResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnMemModuleLoad: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnLogonUpdate(LogonUpdateRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonUpdate: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnVersionInfoUpdated(VersionInfoNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnVersionInfoUpdated: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnLogonQueueUpdate(LogonQueueUpdateRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonQueueUpdate: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnLogonQueueEnd(NoData request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnLogonQueueEnd: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameAccountSelected(GameAccountSelectedRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method AuthenticationListener.OnGameAccountSelected: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}
@@ -0,0 +1,228 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Challenge.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class ChallengeService : ServiceBase
{
public ChallengeService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
ChallengePickedRequest request = new ChallengePickedRequest();
request.MergeFrom(stream);
ChallengePickedResponse response = new ChallengePickedResponse();
BattlenetRpcErrorCode status = HandleChallengePicked(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeService.ChallengePicked(bgs.protocol.challenge.v1.ChallengePickedRequest: {1}) returned bgs.protocol.challenge.v1.ChallengePickedResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 2:
{
ChallengeAnsweredRequest request = new ChallengeAnsweredRequest();
request.MergeFrom(stream);
ChallengeAnsweredResponse response = new ChallengeAnsweredResponse();
BattlenetRpcErrorCode status = HandleChallengeAnswered(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeService.ChallengeAnswered(bgs.protocol.challenge.v1.ChallengeAnsweredRequest: {1}) returned bgs.protocol.challenge.v1.ChallengeAnsweredResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 3:
{
ChallengeCancelledRequest request = new ChallengeCancelledRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleChallengeCancelled(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeService.ChallengeCancelled(bgs.protocol.challenge.v1.ChallengeCancelledRequest: {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:
{
SendChallengeToUserRequest request = new SendChallengeToUserRequest();
request.MergeFrom(stream);
SendChallengeToUserResponse response = new SendChallengeToUserResponse();
BattlenetRpcErrorCode status = HandleSendChallengeToUser(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeService.SendChallengeToUser(bgs.protocol.challenge.v1.SendChallengeToUserRequest: {1}) returned bgs.protocol.challenge.v1.SendChallengeToUserResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleChallengePicked(ChallengePickedRequest request, ChallengePickedResponse response) {
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeService.ChallengePicked: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleChallengeAnswered(ChallengeAnsweredRequest request, ChallengeAnsweredResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeService.ChallengeAnswered: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleChallengeCancelled(ChallengeCancelledRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeService.ChallengeCancelled: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSendChallengeToUser(SendChallengeToUserRequest request, SendChallengeToUserResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeService.SendChallengeToUser: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
class ChallengeListener : ServiceBase
{
public ChallengeListener(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
ChallengeUserRequest request = new ChallengeUserRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnChallengeUser(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnChallengeUser(bgs.protocol.challenge.v1.ChallengeUserRequest: {1} status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 2:
{
ChallengeResultRequest request = new ChallengeResultRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnChallengeResult(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnChallengeResult(bgs.protocol.challenge.v1.ChallengeResultRequest: {1} status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 3:
{
ChallengeExternalRequest request = new ChallengeExternalRequest();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnExternalChallenge(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallenge(bgs.protocol.challenge.v1.ChallengeExternalRequest: {1} status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 4:
{
ChallengeExternalResult request = new ChallengeExternalResult();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnExternalChallengeResult(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChallengeListener.OnExternalChallengeResult(bgs.protocol.challenge.v1.ChallengeExternalResult: {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;
}
}
BattlenetRpcErrorCode HandleOnChallengeUser(ChallengeUserRequest request) {
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnChallengeUser: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnChallengeResult(ChallengeResultRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnChallengeResult: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnExternalChallenge(ChallengeExternalRequest request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnExternalChallenge: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnExternalChallengeResult(ChallengeExternalResult request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChallengeListener.OnExternalChallengeResult: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}
@@ -0,0 +1,312 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Channel.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class ChannelService : ServiceBase
{
public ChannelService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 2:
{
RemoveMemberRequest request = new RemoveMemberRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleRemoveMember(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelService.RemoveMember(bgs.protocol.channel.v1.RemoveMemberRequest: {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 3:
{
SendMessageRequest request = new SendMessageRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSendMessage(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelService.SendMessage(bgs.protocol.channel.v1.SendMessageRequest: {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:
{
UpdateChannelStateRequest request = new UpdateChannelStateRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUpdateChannelState(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelService.UpdateChannelState(bgs.protocol.channel.v1.UpdateChannelStateRequest: {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 5:
{
UpdateMemberStateRequest request = new UpdateMemberStateRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUpdateMemberState(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelService.UpdateMemberState(bgs.protocol.channel.v1.UpdateMemberStateRequest: {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 6:
{
DissolveRequest request = new DissolveRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleDissolve(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelService.Dissolve(bgs.protocol.channel.v1.DissolveRequest: {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;
}
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleRemoveMember(RemoveMemberRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelService.RemoveMember: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSendMessage(SendMessageRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelService.SendMessage: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUpdateChannelState(UpdateChannelStateRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelService.UpdateChannelState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUpdateMemberState(UpdateMemberStateRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelService.UpdateMemberState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleDissolve(DissolveRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelService.Dissolve: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
class ChannelListener : ServiceBase
{
public ChannelListener(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
JoinNotification request = new JoinNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnJoin(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnJoin(bgs.protocol.channel.v1.JoinNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 2:
{
MemberAddedNotification request = new MemberAddedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnMemberAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnMemberAdded(bgs.protocol.channel.v1.MemberAddedNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 3:
{
LeaveNotification request = new LeaveNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnLeave(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnLeave(bgs.protocol.channel.v1.LeaveNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 4:
{
MemberRemovedNotification request = new MemberRemovedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnMemberRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnMemberRemoved(bgs.protocol.channel.v1.MemberRemovedNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 5:
{
SendMessageNotification request = new SendMessageNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnSendMessage(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnSendMessage(bgs.protocol.channel.v1.SendMessageNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 6:
{
UpdateChannelStateNotification request = new UpdateChannelStateNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnUpdateChannelState(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnUpdateChannelState(bgs.protocol.channel.v1.UpdateChannelStateNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 7:
{
UpdateMemberStateNotification request = new UpdateMemberStateNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnUpdateMemberState(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnUpdateMemberState(bgs.protocol.channel.v1.UpdateMemberStateNotification: {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;
}
}
BattlenetRpcErrorCode HandleOnJoin(JoinNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnJoin: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnMemberAdded(MemberAddedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnMemberAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnLeave(LeaveNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnLeave: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnMemberRemoved(MemberRemovedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnMemberRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnSendMessage(SendMessageNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnSendMessage: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnUpdateChannelState(UpdateChannelStateNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnUpdateChannelState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnUpdateMemberState(UpdateMemberStateNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnUpdateMemberState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}
@@ -0,0 +1,187 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Connection.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
using System.Diagnostics;
namespace BNetServer.Networking
{
class ConnectionService : ServiceBase
{
public ConnectionService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
ConnectRequest request = ConnectRequest.Parser.ParseFrom(stream);
ConnectResponse response = new ConnectResponse();
BattlenetRpcErrorCode status = HandleConnect(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Connect(bgs.protocol.connection.v1.ConnectRequest: {1}) returned bgs.protocol.connection.v1.ConnectResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 2:
{
BindRequest request = new BindRequest();
request.MergeFrom(stream);
BindResponse response = new BindResponse();
BattlenetRpcErrorCode status = HandleBind(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Bind(bgs.protocol.connection.v1.BindRequest: {1}) returned bgs.protocol.connection.v1.BindResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 3:
{
EchoRequest request = new EchoRequest();
request.MergeFrom(stream);
EchoResponse response = new EchoResponse();
BattlenetRpcErrorCode status = HandleEcho(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Echo(bgs.protocol.connection.v1.EchoRequest: {1}) returned bgs.protocol.connection.v1.EchoResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 4:
{
DisconnectNotification request = DisconnectNotification.Parser.ParseFrom(stream);
BattlenetRpcErrorCode status = HandleForceDisconnect(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.ForceDisconnect(bgs.protocol.connection.v1.DisconnectNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 5:
{
NoData request = NoData.Parser.ParseFrom(stream);
BattlenetRpcErrorCode status = HandleKeepAlive(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.KeepAlive(bgs.protocol.NoData: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 6:
{
EncryptRequest request = EncryptRequest.Parser.ParseFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleEncrypt(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Encrypt(bgs.protocol.connection.v1.EncryptRequest: {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 7:
{
DisconnectRequest request = DisconnectRequest.Parser.ParseFrom(stream);
BattlenetRpcErrorCode status = HandleRequestDisconnect(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.RequestDisconnect(bgs.protocol.connection.v1.DisconnectRequest: {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;
}
}
BattlenetRpcErrorCode HandleConnect(ConnectRequest request, ConnectResponse response)
{
if (request.ClientId != null)
response.ClientId.MergeFrom(request.ClientId);
response.ServerId = new ProcessId();
response.ServerId.Label = (uint)Process.GetCurrentProcess().Id;
response.ServerId.Epoch = (uint)Time.UnixTime;
response.ServerTime = (ulong)Time.UnixTimeMilliseconds;
response.UseBindlessRpc = request.UseBindlessRpc;
return BattlenetRpcErrorCode.Ok;
}
BattlenetRpcErrorCode HandleBind(BindRequest request, BindResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Bind: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleEcho(EchoRequest request, EchoResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Echo: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleForceDisconnect(DisconnectNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.ForceDisconnect: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleKeepAlive(NoData request)
{
return BattlenetRpcErrorCode.Ok;
}
BattlenetRpcErrorCode HandleEncrypt(EncryptRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ConnectionService.Encrypt: {1}", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleRequestDisconnect(DisconnectRequest request)
{
var disconnectNotification = new DisconnectNotification();
disconnectNotification.ErrorCode = request.ErrorCode;
SendRequest(4, disconnectNotification);
_session.CloseSocket();
return BattlenetRpcErrorCode.Ok;
}
}
}
+520
View File
@@ -0,0 +1,520 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Friends.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class FriendsService : ServiceBase
{
public FriendsService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
SubscribeRequest request = new SubscribeRequest();
request.MergeFrom(stream);
SubscribeResponse response = new SubscribeResponse();
BattlenetRpcErrorCode status = HandleSubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Subscribe(bgs.protocol.friends.v1.SubscribeRequest: {1}) returned bgs.protocol.friends.v1.SubscribeResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 2:
{
SendInvitationRequest request = new SendInvitationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSendInvitation(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.SendInvitation(bgs.protocol.SendInvitationRequest: {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 3:
{
GenericInvitationRequest request = new GenericInvitationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleAcceptInvitation(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.AcceptInvitation(bgs.protocol.GenericInvitationRequest: {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:
{
GenericInvitationRequest request = new GenericInvitationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleRevokeInvitation(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeInvitation(bgs.protocol.GenericInvitationRequest: {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 5:
{
GenericInvitationRequest request = new GenericInvitationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleDeclineInvitation(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.DeclineInvitation(bgs.protocol.GenericInvitationRequest: {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 6:
{
GenericInvitationRequest request = new GenericInvitationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleIgnoreInvitation(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.IgnoreInvitation(bgs.protocol.GenericInvitationRequest: {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 7:
{
AssignRoleRequest request = new AssignRoleRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleAssignRole(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.AssignRole(bgs.protocol.friends.v1.AssignRoleRequest: {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 8:
{
GenericFriendRequest request = new GenericFriendRequest();
request.MergeFrom(stream);
GenericFriendResponse response = new GenericFriendResponse();
BattlenetRpcErrorCode status = HandleRemoveFriend(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RemoveFriend(bgs.protocol.friends.v1.GenericFriendRequest: {1}) returned bgs.protocol.friends.v1.GenericFriendResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 9:
{
ViewFriendsRequest request = new ViewFriendsRequest();
request.MergeFrom(stream);
ViewFriendsResponse response = new ViewFriendsResponse();
BattlenetRpcErrorCode status = HandleViewFriends(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.ViewFriends(bgs.protocol.friends.v1.ViewFriendsRequest: {1}) returned bgs.protocol.friends.v1.ViewFriendsResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 10:
{
UpdateFriendStateRequest request = new UpdateFriendStateRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUpdateFriendState(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.UpdateFriendState(bgs.protocol.friends.v1.UpdateFriendStateRequest: {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 11:
{
UnsubscribeRequest request = new UnsubscribeRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUnsubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Unsubscribe(bgs.protocol.friends.v1.UnsubscribeRequest: {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 12:
{
GenericFriendRequest request = new GenericFriendRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleRevokeAllInvitations(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeAllInvitations(bgs.protocol.friends.v1.GenericFriendRequest: {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 13:
{
GetFriendListRequest request = new GetFriendListRequest();
request.MergeFrom(stream);
GetFriendListResponse response = new GetFriendListResponse();
BattlenetRpcErrorCode status = HandleGetFriendList(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.GetFriendList(bgs.protocol.friends.v1.GetFriendListRequest: {1}) returned bgs.protocol.friends.v1.GetFriendListResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 14:
{
CreateFriendshipRequest request = new CreateFriendshipRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleCreateFriendship(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.CreateFriendship(bgs.protocol.friends.v1.CreateFriendshipRequest: {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;
}*/
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, SubscribeResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.Subscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSendInvitation(SendInvitationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.SendInvitation: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleAcceptInvitation(GenericInvitationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.AcceptInvitation: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleRevokeInvitation(GenericInvitationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RevokeInvitation: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleDeclineInvitation(GenericInvitationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.DeclineInvitation: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleIgnoreInvitation(GenericInvitationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.IgnoreInvitation: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleAssignRole(AssignRoleRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.AssignRole: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleRemoveFriend(GenericFriendRequest request, GenericFriendResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RemoveFriend: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleViewFriends(ViewFriendsRequest request, ViewFriendsResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.ViewFriends: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUpdateFriendState(UpdateFriendStateRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.UpdateFriendState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.Unsubscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleRevokeAllInvitations(GenericFriendRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RevokeAllInvitations: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
/*BattlenetRpcErrorCode HandleGetFriendList(GetFriendListRequest request, GetFriendListResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.GetFriendList: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleCreateFriendship(CreateFriendshipRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.CreateFriendship: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
*/
}
class FriendsListener : ServiceBase
{
public FriendsListener(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
FriendNotification request = new FriendNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnFriendAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnFriendAdded(bgs.protocol.friends.v1.FriendNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 2:
{
FriendNotification request = new FriendNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnFriendRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnFriendRemoved(bgs.protocol.friends.v1.FriendNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 3:
{
InvitationNotification request = new InvitationNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnReceivedInvitationAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnReceivedInvitationAdded(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 4:
{
InvitationNotification request = new InvitationNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnReceivedInvitationRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnReceivedInvitationRemoved(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 5:
{
InvitationNotification request = new InvitationNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnSentInvitationAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnSentInvitationAdded(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 6:
{
InvitationNotification request = new InvitationNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnSentInvitationRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnSentInvitationRemoved(bgs.protocol.friends.v1.InvitationNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 7:
{
UpdateFriendStateNotification request = new UpdateFriendStateNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnUpdateFriendState(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsListener.OnUpdateFriendState(bgs.protocol.friends.v1.UpdateFriendStateNotification: {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;
}
}
BattlenetRpcErrorCode HandleOnFriendAdded(FriendNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnFriendAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnFriendRemoved(FriendNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnFriendRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnReceivedInvitationAdded(InvitationNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnReceivedInvitationAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnReceivedInvitationRemoved(InvitationNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnReceivedInvitationRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnSentInvitationAdded(InvitationNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnSentInvitationAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnSentInvitationRemoved(InvitationNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnSentInvitationRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnUpdateFriendState(UpdateFriendStateNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsListener.OnUpdateFriendState: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}
@@ -0,0 +1,215 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.GameUtilities.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class GameUtilitiesService : ServiceBase
{
public GameUtilitiesService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
ClientRequest request = new ClientRequest();
request.MergeFrom(stream);
ClientResponse response = new ClientResponse();
BattlenetRpcErrorCode status = HandleProcessClientRequest(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.ProcessClientRequest(bgs.protocol.game_utilities.v1.ClientRequest: {1}) returned bgs.protocol.game_utilities.v1.ClientResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 2:
{
PresenceChannelCreatedRequest request = new PresenceChannelCreatedRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandlePresenceChannelCreated(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.PresenceChannelCreated(bgs.protocol.game_utilities.v1.PresenceChannelCreatedRequest: {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 3:
{
GetPlayerVariablesRequest request = new GetPlayerVariablesRequest();
request.MergeFrom(stream);
GetPlayerVariablesResponse response = new GetPlayerVariablesResponse();
BattlenetRpcErrorCode status = HandleGetPlayerVariables(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetPlayerVariables(bgs.protocol.game_utilities.v1.GetPlayerVariablesRequest: {1}) returned bgs.protocol.game_utilities.v1.GetPlayerVariablesResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 6:
{
ServerRequest request = new ServerRequest();
request.MergeFrom(stream);
ServerResponse response = new ServerResponse();
BattlenetRpcErrorCode status = HandleProcessServerRequest(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.ProcessServerRequest(bgs.protocol.game_utilities.v1.ServerRequest: {1}) returned bgs.protocol.game_utilities.v1.ServerResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 7:
{
GameAccountOnlineNotification request = new GameAccountOnlineNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnGameAccountOnline(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.OnGameAccountOnline(bgs.protocol.game_utilities.v1.GameAccountOnlineNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 8:
{
GameAccountOfflineNotification request = new GameAccountOfflineNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnGameAccountOffline(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.OnGameAccountOffline(bgs.protocol.game_utilities.v1.GameAccountOfflineNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 9:
{
GetAchievementsFileRequest request = new GetAchievementsFileRequest();
request.MergeFrom(stream);
GetAchievementsFileResponse response = new GetAchievementsFileResponse();
BattlenetRpcErrorCode status = HandleGetAchievementsFile(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetAchievementsFile(bgs.protocol.game_utilities.v1.GetAchievementsFileRequest: {1}) returned bgs.protocol.game_utilities.v1.GetAchievementsFileResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 10:
{
GetAllValuesForAttributeRequest request = new GetAllValuesForAttributeRequest();
request.MergeFrom(stream);
GetAllValuesForAttributeResponse response = new GetAllValuesForAttributeResponse();
BattlenetRpcErrorCode status = HandleGetAllValuesForAttribute(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method GameUtilitiesService.GetAllValuesForAttribute(bgs.protocol.game_utilities.v1.GetAllValuesForAttributeRequest: {1}) returned bgs.protocol.game_utilities.v1.GetAllValuesForAttributeResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleProcessClientRequest(ClientRequest request, ClientResponse response)
{
return _session.HandleProcessClientRequest(request, response);
}
BattlenetRpcErrorCode HandlePresenceChannelCreated(PresenceChannelCreatedRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.PresenceChannelCreated: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetPlayerVariables(GetPlayerVariablesRequest request, GetPlayerVariablesResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.GetPlayerVariables: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleProcessServerRequest(ServerRequest request, ServerResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.ProcessServerRequest: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameAccountOnline(GameAccountOnlineNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.OnGameAccountOnline: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnGameAccountOffline(GameAccountOfflineNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.OnGameAccountOffline: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetAchievementsFile(GetAchievementsFileRequest request, GetAchievementsFileResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method GameUtilitiesService.GetAchievementsFile: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleGetAllValuesForAttribute(GetAllValuesForAttributeRequest request, GetAllValuesForAttributeResponse response)
{
return _session.HandleGetAllValuesForAttribute(request, response);
}
}
}
@@ -0,0 +1,203 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Presence.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class PresenceService : ServiceBase
{
public PresenceService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
SubscribeRequest request = new SubscribeRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Subscribe(bgs.protocol.presence.v1.SubscribeRequest: {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 2:
{
UnsubscribeRequest request = new UnsubscribeRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUnsubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Unsubscribe(bgs.protocol.presence.v1.UnsubscribeRequest: {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 3:
{
UpdateRequest request = new UpdateRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUpdate(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Update(bgs.protocol.presence.v1.UpdateRequest: {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:
{
QueryRequest request = new QueryRequest();
request.MergeFrom(stream);
QueryResponse response = new QueryResponse();
BattlenetRpcErrorCode status = HandleQuery(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Query(bgs.protocol.presence.v1.QueryRequest: {1}) returned bgs.protocol.presence.v1.QueryResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 5:
{
OwnershipRequest request = new OwnershipRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleOwnership(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Ownership(bgs.protocol.presence.v1.OwnershipRequest: {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 7:
{
SubscribeNotificationRequest request = new SubscribeNotificationRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSubscribeNotification(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.SubscribeNotification(bgs.protocol.presence.v1.SubscribeNotificationRequest: {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 8:
{
MigrateOlympusCustomMessageRequest request = new MigrateOlympusCustomMessageRequest();
request.MergeFrom(stream);
MigrateOlympusCustomMessageResponse response = new MigrateOlympusCustomMessageResponse();
BattlenetRpcErrorCode status = HandleMigrateOlympusCustomMessage(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.MigrateOlympusCustomMessage(bgs.protocol.presence.v1.MigrateOlympusCustomMessageRequest: {1}) returned bgs.protocol.presence.v1.MigrateOlympusCustomMessageResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}*/
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Subscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Unsubscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUpdate(UpdateRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Update: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleQuery(QueryRequest request, QueryResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Query: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOwnership(OwnershipRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Ownership: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleSubscribeNotification(SubscribeNotificationRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.SubscribeNotification: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
/*BattlenetRpcErrorCode HandleMigrateOlympusCustomMessage(MigrateOlympusCustomMessageRequest request, MigrateOlympusCustomMessageResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.MigrateOlympusCustomMessage: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
*/
}
}
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.Report.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class ReportService : ServiceBase
{
public ReportService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
SendReportRequest request = new SendReportRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSendReport(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ReportService.SendReport(bgs.protocol.report.v1.SendReportRequest: {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 2:
{
SubmitReportRequest request = new SubmitReportRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleSubmitReport(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ReportService.SubmitReport(bgs.protocol.report.v1.SubmitReportRequest: {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;
}*/
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleSendReport(SendReportRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ReportService.SendReport: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
/* BattlenetRpcErrorCode HandleSubmitReport(SubmitReportRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ReportService.SubmitReport: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}*/
}
}
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class ResourcesService : ServiceBase
{
public ResourcesService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
/*case 1:
{
ContentHandleRequest request = new ContentHandleRequest();
request.MergeFrom(stream);
ContentHandle response = new ContentHandle();
BattlenetRpcErrorCode status = HandleGetContentHandle(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ResourcesService.GetContentHandle(bgs.protocol.resources.v1.ContentHandleRequest: {1}) returned bgs.protocol.ContentHandle: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}*/
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
/*BattlenetRpcErrorCode HandleGetContentHandle(ContentHandleRequest request, ContentHandle response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ResourcesService.GetContentHandle({1})", GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}*/
}
}
@@ -0,0 +1,92 @@
/*
* Copyright (C) 2012-2016 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using BNetServer.Networking;
using Framework.Constants;
using Google.Protobuf;
using System;
using System.Collections.Generic;
namespace BNetServer.Services
{
public class ServiceDispatcher : Singleton<ServiceDispatcher>
{
ServiceDispatcher()
{
AddService<AccountService>(OriginalHash.AccountService);
AddService<AccountListener>(OriginalHash.AccountListener);
AddService<AuthenticationService>(OriginalHash.AuthenticationService);
AddService<ChallengeService>(OriginalHash.ChallengeService);
AddService<ChannelService>(OriginalHash.ChannelService);
AddService<ConnectionService>(OriginalHash.ConnectionService);
AddService<FriendsService>(OriginalHash.FriendsService);
AddService<GameUtilitiesService>(OriginalHash.GameUtilitiesService);
AddService<PresenceService>(OriginalHash.PresenceService);
AddService<ReportService>(OriginalHash.ReportService);
AddService<ResourcesService>(OriginalHash.ResourcesService);
AddService<UserManagerService>(OriginalHash.UserManagerService);
}
public void Dispatch(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream)
{
var action = _dispatchers.LookupByKey(serviceHash);
if (action != null)
action(session, serviceHash, token, methodId, stream);
else
Log.outDebug(LogFilter.SessionRpc, "{0} tried to call invalid service {1}", session.GetClientInfo(), serviceHash);
}
void AddService<Service>(OriginalHash OriginalHash) where Service : ServiceBase
{
_dispatchers[(uint)OriginalHash] = Dispatch<Service>;
}
void Dispatch<Service>(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream) where Service : ServiceBase
{
var obj = (Service)Activator.CreateInstance(typeof(Service), session, serviceHash);
obj.CallServerMethod(token, methodId, stream);
}
Dictionary<uint, DispatcherHandler> _dispatchers = new Dictionary<uint, DispatcherHandler>();
delegate void DispatcherHandler(Session session, uint serviceHash, uint token, uint methodId, CodedInputStream stream);
}
abstract class ServiceBase
{
public ServiceBase(Session session, uint serviceHash)
{
_session = session;
_serviceHash = serviceHash;
}
public abstract void CallServerMethod(uint token, uint methodId, CodedInputStream stream);
public void SendRequest(uint methodId, IMessage request, Action<CodedInputStream> callback) { _session.SendRequest(_serviceHash, methodId, request, callback); }
public void SendRequest(uint methodId, IMessage request) { _session.SendRequest(_serviceHash, methodId, request); }
public void SendResponse(uint token, BattlenetRpcErrorCode status) { _session.SendResponse(token, status); }
public void SendResponse(uint token, IMessage response) { _session.SendResponse(token, response); }
public string GetCallerInfo()
{
return _session.GetClientInfo();
}
protected Session _session;
protected uint _serviceHash;
}
}
@@ -0,0 +1,319 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Bgs.Protocol;
using Bgs.Protocol.UserManager.V1;
using BNetServer.Services;
using Framework.Constants;
using Google.Protobuf;
namespace BNetServer.Networking
{
class UserManagerService : ServiceBase
{
public UserManagerService(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
SubscribeRequest request = new SubscribeRequest();
request.MergeFrom(stream);
SubscribeResponse response = new SubscribeResponse();
BattlenetRpcErrorCode status = HandleSubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.Subscribe(bgs.protocol.user_manager.v1.SubscribeRequest: {1}) returned bgs.protocol.user_manager.v1.SubscribeResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 10:
{
AddRecentPlayersRequest request = new AddRecentPlayersRequest();
request.MergeFrom(stream);
AddRecentPlayersResponse response = new AddRecentPlayersResponse();
BattlenetRpcErrorCode status = HandleAddRecentPlayers(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.AddRecentPlayers(bgs.protocol.user_manager.v1.AddRecentPlayersRequest: {1}) returned bgs.protocol.user_manager.v1.AddRecentPlayersResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 11:
{
ClearRecentPlayersRequest request = new ClearRecentPlayersRequest();
request.MergeFrom(stream);
ClearRecentPlayersResponse response = new ClearRecentPlayersResponse();
BattlenetRpcErrorCode status = HandleClearRecentPlayers(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.ClearRecentPlayers(bgs.protocol.user_manager.v1.ClearRecentPlayersRequest: {1}) returned bgs.protocol.user_manager.v1.ClearRecentPlayersResponse: {2} status: {3}.",
GetCallerInfo(), request.ToString(), response.ToString(), status);
if (status == 0)
SendResponse(token, response);
else
SendResponse(token, status);
break;
}
case 20:
{
BlockPlayerRequest request = new BlockPlayerRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleBlockPlayer(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.BlockPlayer(bgs.protocol.user_manager.v1.BlockPlayerRequest: {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 21:
{
UnblockPlayerRequest request = new UnblockPlayerRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUnblockPlayer(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.UnblockPlayer(bgs.protocol.user_manager.v1.UnblockPlayerRequest: {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 40:
{
BlockPlayerRequest request = new BlockPlayerRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleBlockPlayerForSession(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.BlockPlayerForSession(bgs.protocol.user_manager.v1.BlockPlayerRequest: {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 50:
{
EntityId request = new EntityId();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleLoadBlockList(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.LoadBlockList(bgs.protocol.EntityId: {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 51:
{
UnsubscribeRequest request = new UnsubscribeRequest();
request.MergeFrom(stream);
NoData response = new NoData();
BattlenetRpcErrorCode status = HandleUnsubscribe(request, response);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerService.Unsubscribe(bgs.protocol.user_manager.v1.UnsubscribeRequest: {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;
}
default:
Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
break;
}
}
BattlenetRpcErrorCode HandleSubscribe(SubscribeRequest request, SubscribeResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.Subscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleAddRecentPlayers(AddRecentPlayersRequest request, AddRecentPlayersResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.AddRecentPlayers: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleClearRecentPlayers(ClearRecentPlayersRequest request, ClearRecentPlayersResponse response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.ClearRecentPlayers: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleBlockPlayer(BlockPlayerRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.BlockPlayer: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUnblockPlayer(UnblockPlayerRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.UnblockPlayer: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleBlockPlayerForSession(BlockPlayerRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.BlockPlayerForSession: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleLoadBlockList(EntityId request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.LoadBlockList: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleUnsubscribe(UnsubscribeRequest request, NoData response)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerService.Unsubscribe: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
class UserManagerListener : ServiceBase
{
public UserManagerListener(Session session, uint serviceHash) : base(session, serviceHash) { }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
{
switch (methodId)
{
case 1:
{
BlockedPlayerAddedNotification request = new BlockedPlayerAddedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnBlockedPlayerAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnBlockedPlayerAdded(bgs.protocol.user_manager.v1.BlockedPlayerAddedNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 2:
{
BlockedPlayerRemovedNotification request = new BlockedPlayerRemovedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnBlockedPlayerRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnBlockedPlayerRemoved(bgs.protocol.user_manager.v1.BlockedPlayerRemovedNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 11:
{
RecentPlayersAddedNotification request = new RecentPlayersAddedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnRecentPlayersAdded(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnRecentPlayersAdded(bgs.protocol.user_manager.v1.RecentPlayersAddedNotification: {1}) status: {2}.",
GetCallerInfo(), request.ToString(), status);
if (status != 0)
SendResponse(token, status);
break;
}
case 12:
{
RecentPlayersRemovedNotification request = new RecentPlayersRemovedNotification();
request.MergeFrom(stream);
BattlenetRpcErrorCode status = HandleOnRecentPlayersRemoved(request);
Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method UserManagerListener.OnRecentPlayersRemoved(bgs.protocol.user_manager.v1.RecentPlayersRemovedNotification: {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;
}
}
BattlenetRpcErrorCode HandleOnBlockedPlayerAdded(BlockedPlayerAddedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnBlockedPlayerAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnBlockedPlayerRemoved(BlockedPlayerRemovedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnBlockedPlayerRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnRecentPlayersAdded(RecentPlayersAddedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnRecentPlayersAdded: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
BattlenetRpcErrorCode HandleOnRecentPlayersRemoved(RecentPlayersRemovedNotification request)
{
Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method UserManagerListener.OnRecentPlayersRemoved: {1}",
GetCallerInfo(), request.ToString());
return BattlenetRpcErrorCode.RpcNotImplemented;
}
}
}