--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+internal static partial class Interop
+{
+ internal static partial class Libraries
+ {
+ public const string Dnssd = "libnsd-dns-sd.so.0";
+ public const string Ssdp = "libnsd-ssdp.so.0";
+ public const string Glib = "libglib-2.0.so.0";
+ public const string Libc = "libc.so.6";
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Network.Nsd;
+
+/// <summary>
+/// Interop class for Nsd
+/// </summary>
+internal static partial class Interop
+{
+ /// <summary>
+ /// Nsd Native Apis
+ /// </summary>
+ internal static partial class Nsd
+ {
+ internal static class Dnssd
+ {
+ //Callback for event
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ServiceRegisteredCallback(DnssdError result, uint service, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ServiceFoundCallback(DnssdServiceState state, uint service, IntPtr userData);
+
+ //Dns-sd
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_initialize")]
+ internal static extern int Initialize();
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_deinitialize")]
+ internal static extern int Deinitialize();
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_create_local_service")]
+ internal static extern int CreateService(string type, out uint service);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_destroy_local_service")]
+ internal static extern int DestroyService(uint service);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_name")]
+ internal static extern int SetName(uint service, string name);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_port")]
+ internal static extern int SetPort(uint service, int port);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_add_txt_record")]
+ internal static extern int AddTxtRecord(uint service, string key, ushort length, byte[] value);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_remove_txt_record")]
+ internal static extern int RemoveTxtRecord(uint service, string key);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_record")]
+ internal static extern int SetRecord(uint service, ushort type, ushort length, byte[] data);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_unset_record")]
+ internal static extern int UnsetRecord(uint service, ushort type);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_register_local_service")]
+ internal static extern int RegisterService(uint service, ServiceRegisteredCallback callback, IntPtr userData);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_deregister_local_service")]
+ internal static extern int DeregisterService(uint service);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_start_browsing_service")]
+ internal static extern int StartBrowsing(string type, out uint browser, ServiceFoundCallback callback, IntPtr userData);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_stop_browsing_service")]
+ internal static extern int StopBrowsing(uint browser);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_type")]
+ internal static extern int GetType(uint service, out string type);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_name")]
+ internal static extern int GetName(uint service, out string name);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_ip")]
+ internal static extern int GetIp(uint service, out string ipV4, out string ipV6);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_port")]
+ internal static extern int GetPort(uint service, out int port);
+ [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_all_txt_record")]
+ internal static extern int GetAllTxtRecord(uint service, out ushort length, out byte[] value);
+ }
+
+ internal static class Ssdp
+ {
+ //Callback for event
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ServiceRegisteredCallback(SsdpError result, uint service, IntPtr userData);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ServiceFoundCallback(SsdpServiceState state, uint service, IntPtr userData);
+
+ //Ssdp
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_initialize")]
+ internal static extern int Initialize();
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_deinitialize")]
+ internal static extern int Deinitialize();
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_create_local_service")]
+ internal static extern int CreateService(string target, out uint service);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_destroy_local_service")]
+ internal static extern int DestroyService(uint service);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_set_usn")]
+ internal static extern int SetUsn(uint service, string usn);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_set_url")]
+ internal static extern int SetUrl(uint service, string url);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_target")]
+ internal static extern int GetTarget(uint service, out string target);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_usn")]
+ internal static extern int GetUsn(uint service, out string usn);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_url")]
+ internal static extern int GetUrl(uint service, out string url);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_register_local_service")]
+ internal static extern int RegisterService(uint service, ServiceRegisteredCallback callback, IntPtr userData);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_deregister_local_service")]
+ internal static extern int DeregisterService(uint service);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_start_browsing_service")]
+ internal static extern int StartBrowsing(string target, out uint browser, ServiceFoundCallback callback, IntPtr userData);
+ [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_stop_browsing_service")]
+ internal static extern int StopBrowsing(uint browser);
+ }
+ }
+}
--- /dev/null
+using System.Reflection;\r
+using System.Runtime.CompilerServices;\r
+using System.Runtime.InteropServices;\r
+\r
+// General Information about an assembly is controlled through the following\r
+// set of attributes. Change these attribute values to modify the information\r
+// associated with an assembly.\r
+[assembly: AssemblyTitle("Tizen.Network.Nsd")]\r
+[assembly: AssemblyDescription("")]\r
+[assembly: AssemblyConfiguration("")]\r
+[assembly: AssemblyCompany("Samsung Electronics")]\r
+[assembly: AssemblyProduct("Tizen.Network.Nsd")]\r
+[assembly: AssemblyCopyright("Copyright © Samsung Electronics 2016")]\r
+[assembly: AssemblyTrademark("")]\r
+[assembly: AssemblyCulture("")]\r
+\r
+// Setting ComVisible to false makes the types in this assembly not visible\r
+// to COM components. If you need to access a type in this assembly from\r
+// COM, set the ComVisible attribute to true on that type.\r
+[assembly: ComVisible(false)]\r
+\r
+// The following GUID is for the ID of the typelib if this project is exposed to COM\r
+[assembly: Guid("08c34d73-7986-4e6e-8c21-5343c7feec86")]\r
+\r
+// Version information for an assembly consists of the following four values:\r
+//\r
+// Major Version\r
+// Minor Version\r
+// Build Number\r
+// Revision\r
+//\r
+// You can specify all the values or you can default the Build and Revision Numbers\r
+// by using the '*' as shown below:\r
+// [assembly: AssemblyVersion("1.0.*")]\r
+[assembly: AssemblyVersion("1.0.0.0")]\r
+[assembly: AssemblyFileVersion("1.0.0.0")]\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup>\r
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+ <ProjectGuid>{08C34D73-7986-4E6E-8C21-5343C7FEEC86}</ProjectGuid>\r
+ <OutputType>Library</OutputType>\r
+ <AppDesignerFolder>Properties</AppDesignerFolder>\r
+ <RootNamespace>Tizen.Network.Nsd</RootNamespace>\r
+ <AssemblyName>Tizen.Network.Nsd</AssemblyName>\r
+ <FileAlignment>512</FileAlignment>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>\r
+ <TargetFrameworkVersion>v1.3</TargetFrameworkVersion>\r
+ <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>\r
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+ <NoStdLib>true</NoStdLib>\r
+ <NoWarn>$(NoWarn);1701;1702</NoWarn>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugSymbols>true</DebugSymbols>\r
+ <DebugType>full</DebugType>\r
+ <Optimize>false</Optimize>\r
+ <OutputPath>bin\Debug\</OutputPath>\r
+ <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>pdbonly</DebugType>\r
+ <Optimize>true</Optimize>\r
+ <OutputPath>bin\Release\</OutputPath>\r
+ <DefineConstants>TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <SignAssembly>true</SignAssembly>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <AssemblyOriginatorKeyFile>Tizen.Network.Nsd.snk</AssemblyOriginatorKeyFile>\r
+ </PropertyGroup>\r
+ <ItemGroup>\r
+ <Compile Include="Interop\Interop.Libraries.cs" />\r
+ <Compile Include="Interop\Interop.Nsd.cs" />\r
+ <Compile Include="Properties\AssemblyInfo.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\NsdEnumerations.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\INsdService.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\INsdBrowser.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\DnssdService.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\NsdError.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\SsdpService.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\DnssdBrowser.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\SsdpBrowser.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\NsdEventArgs.cs" />\r
+ <Compile Include="Tizen.Network.Nsd\NsdManager.cs" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="Tizen.Network.Nsd.nuspec" />\r
+ <None Include="Tizen.Network.Nsd.project.json" />\r
+ <None Include="Tizen.Network.Nsd.snk" />\r
+ </ItemGroup>\r
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->\r
+ <PropertyGroup>\r
+ <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and
+ https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild
+ -->\r
+ <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
+ properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
+ to prevent it from outputting a warning (MSB3644).
+ -->\r
+ <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>\r
+ <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
+ <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
+ </PropertyGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Network.Nsd</id>
+ <version>$version$</version>
+ <authors>Samsung Electronics</authors>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>https://www.tizen.org/</projectUrl>
+ <iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
+ <copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
+ <description>Provides the DNSSD and SSDP APIs for Tizen.Network.Nsd</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.2" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="bin/$Configuration$/Tizen.Network.Nsd.dll" target="lib/netstandard1.3" />
+ </files>
+</package>
--- /dev/null
+{\r
+ "dependencies": {\r
+ "NETStandard.Library": "1.6.0",\r
+ "System.Threading.Thread": "4.3.0",\r
+ "Tizen": "1.0.2"\r
+ },\r
+ "frameworks": {\r
+ "netstandard1.3": {}\r
+ }\r
+}\r
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 14\r
+VisualStudioVersion = 14.0.25420.1\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Nsd", "Tizen.Network.Nsd.csproj", "{08C34D73-7986-4E6E-8C21-5343C7FEEC86}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Release|Any CPU = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {08C34D73-7986-4E6E-8C21-5343C7FEEC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {08C34D73-7986-4E6E-8C21-5343C7FEEC86}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {08C34D73-7986-4E6E-8C21-5343C7FEEC86}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {08C34D73-7986-4E6E-8C21-5343C7FEEC86}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This class is used for managing network service discovery using DNSSD.
+ /// </summary>
+ public class DnssdBrowser : INsdBrowser
+ {
+ private string _serviceType;
+ private event EventHandler<DnssdServiceFoundEventArgs> _serviceFound;
+
+ /// <summary>
+ /// This event is raised when service state changes during service discovery using DNSSD.
+ /// </summary>
+ public event EventHandler<DnssdServiceFoundEventArgs> ServiceFound
+ {
+ add
+ {
+ _serviceFound += value;
+ }
+
+ remove
+ {
+ _serviceFound -= value;
+ }
+ }
+
+ /// <summary>
+ /// A public constructor for DnssdBrowser class to create a DnssdBrowser instance for the given service type.
+ /// </summary>
+ /// <param name="serviceType">The DNSSD service type</param>
+ public DnssdBrowser(string serviceType)
+ {
+ _serviceType = serviceType;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This class is used for managing local service discovery using DNSSD.
+ /// </summary>
+ public class DnssdService : INsdService
+ {
+ private uint _service;
+
+ /// <summary>
+ /// Name of DNSSD local service.
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ string name;
+ int ret = Interop.Nsd.Dnssd.GetName(_service, out name);
+ if (ret != (int)DnssdError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get name of service, Error: " + (DnssdError)ret);
+ return null;
+ }
+
+ return name;
+ }
+
+ set
+ {
+ int ret = Interop.Nsd.Dnssd.SetName(_service, value.ToString());
+ if (ret != (int)DnssdError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set name of service, Error: " + (DnssdError)ret);
+ NsdErrorFactory.ThrowDnssdException(ret);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Type of DNSSD local/remote service.
+ /// </summary>
+ public string Type
+ {
+ get
+ {
+ string type;
+ int ret = Interop.Nsd.Dnssd.GetType(_service, out type);
+ if (ret != (int)DnssdError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get type of service, Error: " + (DnssdError)ret);
+ return null;
+ }
+
+ return type;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This interface is used for managing network service discovery using DNSSD/SSDP.
+ /// </summary>
+ public interface INsdBrowser
+ {
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This interface provides properties for managing local service discovery using DNSSD/SSDP.
+ /// </summary>
+ public interface INsdService
+ {
+ /// <summary>
+ /// Name of local service.
+ /// </summary>
+ string Name { get; set; }
+
+ /// <summary>
+ /// Type of local/remote service.
+ /// </summary>
+ string Type { get; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using Tizen.Internals.Errors;
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// Enumeration for DNS-SD service state.
+ /// </summary>
+ public enum DnssdServiceState
+ {
+ /// <summary>
+ /// Available DNS-SD service found.
+ /// </summary>
+ Available,
+ /// <summary>
+ /// DNS-SD service not available.
+ /// </summary>
+ Unavailable,
+ /// <summary>
+ /// Lookup failure for service name.
+ /// </summary>
+ ServiceNameLookupFailed,
+ /// <summary>
+ /// Lookup failure for host name and port number.
+ /// </summary>
+ HostNameLookupFailed,
+ /// <summary>
+ /// Lookup failure for IP address.
+ /// </summary>
+ AddressLookupFailed
+ }
+
+ /// <summary>
+ /// Enumeration for SSDP service state.
+ /// </summary>
+ public enum SsdpServiceState
+ {
+ /// <summary>
+ /// Available SSDP service found.
+ /// </summary>
+ Available,
+ /// <summary>
+ /// SSDP service not available.
+ /// </summary>
+ Unavailable
+ }
+
+ internal enum DnssdError
+ {
+ None = ErrorCode.None,
+ OutOfMemory = ErrorCode.OutOfMemory,
+ InvalidOperation = ErrorCode.InvalidOperation,
+ InvalidParameter = ErrorCode.InvalidParameter,
+ NotSupported = ErrorCode.NotSupported,
+ NotInitialized = -0x01CA0000 | 0x01,
+ AlreadyRegistered = -0x01CA0000 | 0x02,
+ NameConflict = -0x01CA0000 | 0x03,
+ ServiceNotRunning = -0x01CA0000 | 0x04,
+ ServiceNotFound = -0x01CA0000 | 0x05,
+ OperationFailed = -0x01CA0000 | 0x06
+ }
+
+ internal enum SsdpError
+ {
+ None = ErrorCode.None,
+ OutOfMemory = ErrorCode.OutOfMemory,
+ InvalidParameter = ErrorCode.InvalidParameter,
+ NotSupported = ErrorCode.NotSupported,
+ NotInitialized = -0x01C90000 | 0x01,
+ OperationFailed = -0x01C90000 | 0x04,
+ ServiceNotFound = -0x01C90000 | 0x05,
+ ServiceAlreadyRegistered = -0x01C90000 | 0x06
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Network.Nsd
+{
+ internal static class NsdErrorFactory
+ {
+ internal static void ThrowDnssdException(int exception)
+ {
+ DnssdError _error = (DnssdError)exception;
+ switch (_error)
+ {
+ case DnssdError.OutOfMemory:
+ throw new InvalidOperationException("Out of memory");
+ case DnssdError.InvalidOperation:
+ throw new InvalidOperationException("Invalid operation");
+ case DnssdError.InvalidParameter:
+ throw new InvalidOperationException("Invalid parameter");
+ case DnssdError.NotSupported:
+ throw new InvalidOperationException("Not supported");
+ case DnssdError.NotInitialized:
+ throw new InvalidOperationException("Not initialized");
+ case DnssdError.AlreadyRegistered:
+ throw new InvalidOperationException("Already registered");
+ case DnssdError.NameConflict:
+ throw new InvalidOperationException("Name conflict");
+ case DnssdError.ServiceNotRunning:
+ throw new InvalidOperationException("Service not running");
+ case DnssdError.ServiceNotFound:
+ throw new InvalidOperationException("Service not found");
+ case DnssdError.OperationFailed:
+ throw new InvalidOperationException("Operation failed");
+ }
+ }
+
+ internal static void ThrowSsdpException(int exception)
+ {
+ SsdpError _error = (SsdpError)exception;
+ switch (_error)
+ {
+ case SsdpError.OutOfMemory:
+ throw new InvalidOperationException("Out of memory");
+ case SsdpError.InvalidParameter:
+ throw new InvalidOperationException("Invalid parameter");
+ case SsdpError.NotSupported:
+ throw new InvalidOperationException("Not supported");
+ case SsdpError.NotInitialized:
+ throw new InvalidOperationException("Not initialized");
+ case SsdpError.OperationFailed:
+ throw new InvalidOperationException("Operation failed");
+ case SsdpError.ServiceNotFound:
+ throw new InvalidOperationException("Service not found");
+ case SsdpError.ServiceAlreadyRegistered:
+ throw new InvalidOperationException("Service already registered");
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// An extended EventArgs class which contains changed service state during service discovery using DNSSD.
+ /// </summary>
+ public class DnssdServiceFoundEventArgs : EventArgs
+ {
+ private DnssdServiceState _state;
+ private DnssdService _service;
+
+ internal DnssdServiceFoundEventArgs(DnssdServiceState state, DnssdService service)
+ {
+ _state = state;
+ _service = service;
+ }
+
+ /// <summary>
+ /// DNSSD service state.
+ /// </summary>
+ public DnssdServiceState State
+ {
+ get
+ {
+ return _state;
+ }
+ }
+
+ /// <summary>
+ /// DNSSD service instance.
+ /// </summary>
+ public DnssdService Service
+ {
+ get
+ {
+ return _service;
+ }
+ }
+ }
+
+ /// <summary>
+ /// An extended EventArgs class which contains changed service state during service discovery using SSDP.
+ /// </summary>
+ public class SsdpServiceFoundEventArgs : EventArgs
+ {
+ private SsdpServiceState _state;
+ private SsdpService _service;
+
+ internal SsdpServiceFoundEventArgs(SsdpServiceState state, SsdpService service)
+ {
+ _state = state;
+ _service = service;
+ }
+
+ /// <summary>
+ /// SSDP service state.
+ /// </summary>
+ public SsdpServiceState State
+ {
+ get
+ {
+ return _state;
+ }
+ }
+
+ /// <summary>
+ /// SSDP service instance.
+ /// </summary>
+ public SsdpService Service
+ {
+ get
+ {
+ return _service;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Network.Nsd
+{
+ internal static class Globals
+ {
+ internal const string LogTag = "Tizen.Network.Nsd";
+ }
+
+ /// <summary>
+ /// This class is used for managing local/network service discovery using DNSSD/SSDP.
+ /// </summary>
+ public static class NsdManager
+ {
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This class is used for managing network service discovery using SSDP.
+ /// </summary>
+ public class SsdpBrowser : INsdBrowser
+ {
+ private string _target;
+ private event EventHandler<SsdpServiceFoundEventArgs> _serviceFound;
+
+ /// <summary>
+ /// This event is raised when service state changes during service discovery using SSDP.
+ /// </summary>
+ public event EventHandler<SsdpServiceFoundEventArgs> ServiceFound
+ {
+ add
+ {
+ _serviceFound += value;
+ }
+
+ remove
+ {
+ _serviceFound -= value;
+ }
+ }
+
+ /// <summary>
+ /// A public constructor for SsdpBrowser class to create a SsdpBrowser instance for the given target.
+ /// </summary>
+ /// <param name="target">The target to browse for the service.</param>
+ public SsdpBrowser(string target)
+ {
+ _target = target;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Network.Nsd
+{
+ /// <summary>
+ /// This class is used for managing local service discovery using SSDP.
+ /// </summary>
+ public class SsdpService : INsdService
+ {
+ private uint _service;
+
+ /// <summary>
+ /// Name of SSDP local service.
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ string name;
+ int ret = Interop.Nsd.Ssdp.GetUsn(_service, out name);
+ if (ret != (int)SsdpError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get name of service, Error: " + (SsdpError)ret);
+ return null;
+ }
+
+ return name;
+ }
+
+ set
+ {
+ int ret = Interop.Nsd.Ssdp.SetUsn(_service, value.ToString());
+ if (ret != (int)SsdpError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to set name of service, Error: " + (SsdpError)ret);
+ NsdErrorFactory.ThrowSsdpException(ret);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Type of SSDP local/remote service.
+ /// </summary>
+ public string Type
+ {
+ get
+ {
+ string type;
+ int ret = Interop.Nsd.Ssdp.GetTarget(_service, out type);
+ if (ret != (int)SsdpError.None)
+ {
+ Log.Error(Globals.LogTag, "Failed to get type of service, Error: " + (SsdpError)ret);
+ return null;
+ }
+
+ return type;
+ }
+ }
+ }
+}
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+Name: csapi-network-nsd
+Summary: Tizen NSD API for C#
+Version: 1.0.1
+Release: 1
+Group: Development/Libraries
+License: Apache-2.0
+URL: https://www.tizen.org
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+
+AutoReqProv: no
+ExcludeArch: aarch64
+
+BuildRequires: dotnet-build-tools
+
+# C# API Requires
+BuildRequires: csapi-tizen-nuget
+
+%define Assemblies Tizen.Network.Nsd
+
+%description
+%{summary}
+
+%dotnet_import_sub_packages
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%build
+for ASM in %{Assemblies}; do
+%dotnet_build $ASM
+%dotnet_pack $ASM/$ASM.nuspec %{version}
+done
+
+%install
+for ASM in %{Assemblies}; do
+%dotnet_install $ASM
+done
+
+%files
+%manifest %{name}.manifest
+%license LICENSE
+%attr(644,root,root) %{dotnet_assembly_files}