sfdnsres: Implement NSD resolution (#2962)

This fix a missing implementation usage of NSD on IResolver when
requested on GetAddrInfoRequest* and GetHostByNameRequest*.
This commit is contained in:
Mary 2022-01-03 22:12:50 +01:00 committed by GitHub
parent e24be5edfc
commit 60f03cb78a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 32 deletions

View file

@ -13,12 +13,19 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
[Service("nsd:u")] // Max sessions: 20
class IManager : IpcService
{
private readonly NsdSettings _nsdSettings;
public static readonly NsdSettings NsdSettings;
private readonly FqdnResolver _fqdnResolver;
private bool _isInitialized = false;
public IManager(ServiceCtx context)
{
_fqdnResolver = new FqdnResolver();
_isInitialized = true;
}
static IManager()
{
// TODO: Load nsd settings through the savedata 0x80000000000000B0 (nsdsave:/).
@ -32,16 +39,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
// return ResultCode.InvalidSettingsValue;
}
_nsdSettings = new NsdSettings
NsdSettings = new NsdSettings
{
Initialized = true,
TestMode = (bool)testMode,
TestMode = (bool)testMode,
Environment = (string)environmentIdentifier
};
_fqdnResolver = new FqdnResolver(_nsdSettings);
_isInitialized = true;
}
[CommandHipc(5)] // 11.0.0+
@ -107,7 +110,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
{
NxSettings.Settings.TryGetValue("nsd!environment_identifier", out object environmentIdentifier);
if ((string)environmentIdentifier == _nsdSettings.Environment)
if ((string)environmentIdentifier == NsdSettings.Environment)
{
// TODO: Call nn::fs::DeleteSystemFile() to delete the savedata file and return ResultCode.
}
@ -298,7 +301,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
}
*/
if (!_nsdSettings.TestMode)
if (!NsdSettings.TestMode)
{
return ResultCode.InvalidSettingsValue;
}
@ -327,7 +330,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd
}
*/
if (!_nsdSettings.TestMode)
if (!NsdSettings.TestMode)
{
return ResultCode.InvalidSettingsValue;
}