// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cast/common/public/receiver_info.h" #include <algorithm> #include <cctype> #include <cinttypes> #include <string> #include <vector> #include "discovery/mdns/public/mdns_constants.h" #include "util/osp_logging.h" #include "util/span_util.h" #include "util/string_parse.h" namespace openscreen::cast { namespace { // Maximum size for the receiver model prefix at start of MDNS service instance // names. Any model names that are larger than this size will be truncated. const size_t kMaxReceiverModelSize = …; // Build the MDNS instance name for service. This will be the receiver model (up // to 20 bytes) appended with the virtual receiver ID (receiver UUID) and // optionally appended with extension at the end to resolve name conflicts. The // total MDNS service instance name is kept below 64 bytes so it can easily fit // into a single domain name label. // // NOTE: This value is based on what is currently done by Eureka, not what is // called out in the CastV2 spec. Eureka uses |model|-|uuid|, so the same // convention will be followed here. That being said, the Eureka receiver does // not use the instance ID in any way, so the specific calculation used should // not be important. std::string CalculateInstanceId(const ReceiverInfo& info) { … } } // namespace const std::string& ReceiverInfo::GetInstanceId() const { … } bool ReceiverInfo::IsValid() const { … } discovery::DnsSdInstance ReceiverInfoToDnsSdInstance(const ReceiverInfo& info) { … } ErrorOr<ReceiverInfo> DnsSdInstanceEndpointToReceiverInfo( const discovery::DnsSdInstanceEndpoint& endpoint) { … } } // namespace openscreen::cast