1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "discovery/dnssd/testing/fake_dns_record_factory.h"
6
7 #include <utility>
8
9 namespace openscreen {
10 namespace discovery {
11
12 // static
CreateFullyPopulatedSrvRecord(uint16_t port)13 MdnsRecord FakeDnsRecordFactory::CreateFullyPopulatedSrvRecord(uint16_t port) {
14 const DomainName kTarget{kInstanceName, "_srv-name", "_udp", kDomainName};
15 constexpr auto kType = DnsType::kSRV;
16 constexpr auto kClazz = DnsClass::kIN;
17 constexpr auto kRecordType = RecordType::kUnique;
18 constexpr auto kTtl = std::chrono::seconds(0);
19 SrvRecordRdata srv(0, 0, port, kTarget);
20 return MdnsRecord(kTarget, kType, kClazz, kRecordType, kTtl, std::move(srv));
21 }
22
23 // static
24 constexpr uint16_t FakeDnsRecordFactory::kPortNum;
25
26 // static
27 const uint8_t FakeDnsRecordFactory::kV4AddressOctets[4] = {192, 168, 0, 0};
28
29 // static
30 const uint16_t FakeDnsRecordFactory::kV6AddressHextets[8] = {
31 0x0102, 0x0304, 0x0506, 0x0708, 0x090a, 0x0b0c, 0x0d0e, 0x0f10};
32
33 // static
34 const char FakeDnsRecordFactory::kInstanceName[] = "instance";
35
36 // static
37 const char FakeDnsRecordFactory::kServiceName[] = "_srv-name._udp";
38
39 // static
40 const char FakeDnsRecordFactory::kServiceNameProtocolPart[] = "_udp";
41
42 // static
43 const char FakeDnsRecordFactory::kServiceNameServicePart[] = "_srv-name";
44
45 // static
46 const char FakeDnsRecordFactory::kDomainName[] = "local";
47
48 } // namespace discovery
49 } // namespace openscreen
50