mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-10-20 22:21:41 +00:00
e5741fae2d
* sfdnsres: Cleanup service and implements some calls This PR is a big cleanup to our current implementation of `sfdnsres` service. Additionnaly to that, some calls and fix have been done by @Thog (PRd with approval, thanks to her). - Implementation of `GetAddrInfoRequest` (Fixes #637). - Partial implementation of `GetHostByNameRequestWithOptions`, `GetHostByAddrRequestWithOptions` and `GetAddrInfoRequestWithOptions` (Fixes #642, Fixes #1233). A DNS Blacklist have been done by @riperiperi (which is currently used in LDN build, then that reduces code differences between the LDN build and master. Now a lot of games are playable or are blocked to the menu because it needs online service: Co-Authored-By: Mary <1760003+Thog@users.noreply.github.com> Co-Authored-By: riperiperi <6294155+riperiperi@users.noreply.github.com> * Addressed gdkchan's comments * IPAddress[] to IEnumerable * Nits Co-authored-by: Mary <1760003+Thog@users.noreply.github.com> Co-authored-by: riperiperi <6294155+riperiperi@users.noreply.github.com>
37 lines
No EOL
1.2 KiB
C#
37 lines
No EOL
1.2 KiB
C#
using System.Buffers.Binary;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types
|
|
{
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 6 * sizeof(int))]
|
|
struct AddrInfoSerializedHeader
|
|
{
|
|
public uint Magic;
|
|
public int Flags;
|
|
public int Family;
|
|
public int SocketType;
|
|
public int Protocol;
|
|
public uint AddressLength;
|
|
|
|
public AddrInfoSerializedHeader(IPAddress address, SocketType socketType)
|
|
{
|
|
Magic = (uint)BinaryPrimitives.ReverseEndianness(unchecked((int)SfdnsresContants.AddrInfoMagic));
|
|
Flags = 0; // Big Endian
|
|
Family = BinaryPrimitives.ReverseEndianness((int)address.AddressFamily);
|
|
SocketType = BinaryPrimitives.ReverseEndianness((int)socketType);
|
|
Protocol = 0; // Big Endian
|
|
|
|
if (address.AddressFamily == AddressFamily.InterNetwork)
|
|
{
|
|
AddressLength = (uint)Unsafe.SizeOf<AddrInfo4>();
|
|
}
|
|
else
|
|
{
|
|
AddressLength = 4;
|
|
}
|
|
}
|
|
}
|
|
} |