Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/libraries/Common/src/Interop/OSX/Interop.Dnssd.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

internal static partial class Interop
{
internal static unsafe partial class Dnssd
{
internal const uint kDNSServiceFlagsMoreComing = 0x1;
internal const uint kDNSServiceFlagsAdd = 0x2;
internal const uint kDNSServiceFlagsReturnIntermediates = 0x1000;
internal const uint kDNSServiceFlagsTimeout = 0x10000;

internal const int kDNSServiceErr_NoError = 0;
internal const int kDNSServiceErr_Unknown = -65537;
internal const int kDNSServiceErr_NoSuchName = -65538;
internal const int kDNSServiceErr_NoMemory = -65539;
internal const int kDNSServiceErr_BadParam = -65540;
internal const int kDNSServiceErr_Unsupported = -65544;
internal const int kDNSServiceErr_Refused = -65553;
internal const int kDNSServiceErr_NoSuchRecord = -65554;
internal const int kDNSServiceErr_ServiceNotRunning = -65563;
internal const int kDNSServiceErr_Timeout = -65568;
internal const int kDNSServiceErr_DefunctConnection = -65569;
internal const int kDNSServiceErr_PolicyDenied = -65570;
internal const int kDNSServiceErr_NotPermitted = -65571;

internal const ushort kDNSServiceClass_IN = 1;

internal const ushort kDNSServiceType_A = 1;
internal const ushort kDNSServiceType_NS = 2;
internal const ushort kDNSServiceType_CNAME = 5;
internal const ushort kDNSServiceType_PTR = 12;
internal const ushort kDNSServiceType_MX = 15;
internal const ushort kDNSServiceType_TXT = 16;
internal const ushort kDNSServiceType_AAAA = 28;
internal const ushort kDNSServiceType_SRV = 33;

[LibraryImport(Libraries.libSystem, StringMarshalling = StringMarshalling.Utf8)]
internal static partial int DNSServiceQueryRecord(
out IntPtr sdRef,
uint flags,
uint interfaceIndex,
string fullname,
ushort rrtype,
ushort rrclass,
delegate* unmanaged[Cdecl]<IntPtr, uint, uint, int, byte*, ushort, ushort, ushort, void*, uint, IntPtr, void> callBack,
IntPtr context);

[LibraryImport(Libraries.libSystem)]
internal static partial int DNSServiceRefSockFD(IntPtr sdRef);

[LibraryImport(Libraries.libSystem)]
internal static partial int DNSServiceProcessResult(IntPtr sdRef);

[LibraryImport(Libraries.libSystem)]
internal static partial void DNSServiceRefDeallocate(IntPtr sdRef);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@
<data name="net_dns_unsupported_address_family" xml:space="preserve">
<value>Only the InterNetwork and InterNetworkV6 address families are supported.</value>
</data>
</root>
<data name="net_invalid_dns_name" xml:space="preserve">
<value>The DNS name '{0}' is not a valid domain name.</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-osx;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
</PropertyGroup>
Expand Down Expand Up @@ -86,9 +86,20 @@
Link="Common\Interop\Windows\WinSock\Interop.GetAddrInfoExW.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix' Or '$(TargetPlatformIdentifier)' == 'osx'">
<Compile Include="System\Net\DnsResolverPal.Managed.cs" />
<Compile Include="System\Net\DnsSocket.cs" />
<Compile Include="System\Net\DnsWireEnums.cs" />
<Compile Include="System\Net\DnsMessageHeader.cs" />
<Compile Include="System\Net\DnsMessageReader.cs" />
<Compile Include="System\Net\DnsMessageWriter.cs" />
<Compile Include="System\Net\DnsEncodedName.cs" />
<Compile Include="System\Net\DnsRecordParsing.cs" />
<Compile Include="System\Net\ResolvConf.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix'">
<Compile Include="System\Net\NameResolutionPal.Unix.cs" />
<Compile Include="System\Net\DnsResolverPal.Unsupported.cs" />
<Compile Include="$(CommonPath)System\Net\InteropIPAddressExtensions.Unix.cs"
Link="Common\System\Net\InteropIPAddressExtensions.Unix.cs" />
<Compile Include="$(CommonPath)System\Net\SocketAddressPal.Unix.cs"
Expand Down Expand Up @@ -117,6 +128,45 @@
Link="Common\Interop\Unix\System.Native\Interop.SocketAddress.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'osx'">
<Compile Include="System\Net\NameResolutionPal.Unix.cs" />
<Compile Include="System\Net\DnsResolverPal.OSX.cs" />
<Compile Include="$(CommonPath)System\Net\InteropIPAddressExtensions.Unix.cs"
Link="Common\System\Net\InteropIPAddressExtensions.Unix.cs" />
<Compile Include="$(CommonPath)System\Net\SocketAddressPal.Unix.cs"
Link="Common\System\Net\Internals\SocketAddressPal.Unix.cs" />
<Compile Include="$(CommonPath)System\Net\SocketProtocolSupportPal.Unix.cs"
Link="Common\System\Net\SocketProtocolSupportPal.Unix" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
Link="Common\Interop\CoreLib\Unix\Interop.Errors.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
Link="Common\Interop\Unix\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Unix\Interop.Poll.Structs.cs"
Link="Common\Interop\Unix\Interop.Poll.Structs.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.ErrNo.cs"
Link="Common\Interop\Unix\System.Native\Interop.ErrNo.cs"/>
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Close.cs"
Link="Common\Interop\Unix\System.Native\Interop.Close.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetHostName.cs"
Link="Common\Interop\Unix\System.Native\Interop.GetHostName.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetNameInfo.cs"
Link="Common\Interop\Unix\System.Native\Interop.GetNameInfo.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.HostEntry.cs"
Link="Common\Interop\Unix\System.Native\Interop.HostEntries.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.IPAddress.cs"
Link="Common\Interop\Unix\System.Native\Interop.IPAddress.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Poll.cs"
Link="Common\Interop\Unix\System.Native\Interop.Poll.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Socket.cs"
Link="Common\Interop\Unix\System.Native\Interop.Socket.cs" />
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.SocketAddress.cs"
Link="Common\Interop\Unix\System.Native\Interop.SocketAddress.cs" />
<Compile Include="$(CommonPath)Interop\OSX\Interop.Dnssd.cs"
Link="Common\Interop\OSX\Interop.Dnssd.cs" />
<Compile Include="$(CommonPath)Interop\OSX\Interop.Libraries.cs"
Link="Common\Interop\OSX\Interop.Libraries.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
<Compile Include="System\Net\Dns.Browser.cs" />
</ItemGroup>
Expand Down Expand Up @@ -169,4 +219,8 @@
<ProjectReference Include="$(LibrariesProjectRoot)System.Threading.ThreadPool\src\System.Threading.ThreadPool.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix' Or '$(TargetPlatformIdentifier)' == 'osx'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography\src\System.Security.Cryptography.csproj" />
</ItemGroup>

</Project>
Loading
Loading