Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / OpenThread / MdnsImpl.cpp
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *
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
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #include "lib/mdns/platform/Mdns.h"
19
20 #include <platform/CHIPDeviceLayer.h>
21
22 using namespace ::chip::DeviceLayer;
23
24 namespace chip {
25 namespace Mdns {
26
27 CHIP_ERROR ChipMdnsInit(MdnsAsyncReturnCallback initCallback, MdnsAsyncReturnCallback errorCallback, void * context)
28 {
29     // Intentionally empty
30     return CHIP_NO_ERROR;
31 }
32
33 CHIP_ERROR ChipMdnsSetHostname(const char * hostname)
34 {
35     return ThreadStackMgr().SetupSrpHost(hostname);
36 }
37
38 const char * GetProtocolString(MdnsServiceProtocol protocol)
39 {
40     return protocol == MdnsServiceProtocol::kMdnsProtocolUdp ? "_udp" : "_tcp";
41 }
42
43 CHIP_ERROR ChipMdnsPublishService(const MdnsService * service)
44 {
45     char serviceType[kMdnsTypeMaxSize + kMdnsProtocolTextMaxSize + 1];
46     snprintf(serviceType, sizeof(serviceType), "%s.%s", service->mType, GetProtocolString(service->mProtocol));
47
48     return ThreadStackMgr().AddSrpService(service->mName, serviceType, service->mPort, service->mTextEntries,
49                                           service->mTextEntrySize);
50 }
51
52 CHIP_ERROR ChipMdnsStopPublish()
53 {
54     return CHIP_ERROR_NOT_IMPLEMENTED;
55 }
56
57 CHIP_ERROR ChipMdnsBrowse(const char * type, MdnsServiceProtocol protocol, Inet::IPAddressType addressType,
58                           Inet::InterfaceId interface, MdnsBrowseCallback callback, void * context)
59 {
60     return CHIP_ERROR_NOT_IMPLEMENTED;
61 }
62
63 CHIP_ERROR ChipMdnsResolve(MdnsService * browseResult, Inet::InterfaceId interface, MdnsResolveCallback callback, void * context)
64 {
65     return CHIP_ERROR_NOT_IMPLEMENTED;
66 }
67
68 } // namespace Mdns
69 } // namespace chip