3 * Copyright (c) 2021 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include "lib/mdns/platform/Mdns.h"
20 #include <platform/CHIPDeviceLayer.h>
22 using namespace ::chip::DeviceLayer;
27 CHIP_ERROR ChipMdnsInit(MdnsAsyncReturnCallback initCallback, MdnsAsyncReturnCallback errorCallback, void * context)
29 // Intentionally empty
33 CHIP_ERROR ChipMdnsSetHostname(const char * hostname)
35 return ThreadStackMgr().SetupSrpHost(hostname);
38 const char * GetProtocolString(MdnsServiceProtocol protocol)
40 return protocol == MdnsServiceProtocol::kMdnsProtocolUdp ? "_udp" : "_tcp";
43 CHIP_ERROR ChipMdnsPublishService(const MdnsService * service)
45 char serviceType[kMdnsTypeMaxSize + kMdnsProtocolTextMaxSize + 1];
46 snprintf(serviceType, sizeof(serviceType), "%s.%s", service->mType, GetProtocolString(service->mProtocol));
48 return ThreadStackMgr().AddSrpService(service->mName, serviceType, service->mPort, service->mTextEntries,
49 service->mTextEntrySize);
52 CHIP_ERROR ChipMdnsStopPublish()
54 return CHIP_ERROR_NOT_IMPLEMENTED;
57 CHIP_ERROR ChipMdnsBrowse(const char * type, MdnsServiceProtocol protocol, Inet::IPAddressType addressType,
58 Inet::InterfaceId interface, MdnsBrowseCallback callback, void * context)
60 return CHIP_ERROR_NOT_IMPLEMENTED;
63 CHIP_ERROR ChipMdnsResolve(MdnsService * browseResult, Inet::InterfaceId interface, MdnsResolveCallback callback, void * context)
65 return CHIP_ERROR_NOT_IMPLEMENTED;