2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Threading;
20 namespace Tizen.Network.Nsd
22 internal static class Globals
24 internal const string LogTag = "Tizen.Network.Nsd";
26 internal static void DnssdInitialize()
28 int ret = Interop.Nsd.Dnssd.Initialize();
29 if(ret!=(int)DnssdError.None)
31 Log.Error(LogTag, "Failed to initialize Dnssd, Error - "+ (DnssdError)ret);
32 NsdErrorFactory.ThrowDnssdException(ret);
36 internal static void SsdpInitialize()
38 int ret = Interop.Nsd.Ssdp.Initialize();
39 if (ret != (int)SsdpError.None)
41 Log.Error(LogTag, "Failed to initialize Ssdp, Error - " + (SsdpError)ret);
42 NsdErrorFactory.ThrowSsdpException(ret);
46 internal static ThreadLocal<DnssdInitializer> s_threadDns = new ThreadLocal<DnssdInitializer>(() =>
48 Log.Info(LogTag, "Inside Dnssd ThreadLocal delegate");
49 return new DnssdInitializer();
52 internal static ThreadLocal<SsdpInitializer> s_threadSsd = new ThreadLocal<SsdpInitializer>(() =>
54 Log.Info(LogTag, "Inside Ssdp ThreadLocal delegate");
55 return new SsdpInitializer();