xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/qbone/qbone_constants.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 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 "quiche/quic/qbone/qbone_constants.h"
6 
7 #include "quiche/quic/core/quic_utils.h"
8 
9 namespace quic {
10 
11 constexpr char QboneConstants::kQboneAlpn[];
12 const QuicByteCount QboneConstants::kMaxQbonePacketBytes;
13 const uint32_t QboneConstants::kQboneRouteTableId;
14 
GetControlStreamId(QuicTransportVersion version)15 QuicStreamId QboneConstants::GetControlStreamId(QuicTransportVersion version) {
16   return QuicUtils::GetFirstBidirectionalStreamId(version,
17                                                   Perspective::IS_CLIENT);
18 }
19 
TerminatorLocalAddress()20 const QuicIpAddress* QboneConstants::TerminatorLocalAddress() {
21   static auto* terminator_address = []() {
22     auto* address = new QuicIpAddress;
23     // 0x71 0x62 0x6f 0x6e 0x65 is 'qbone' in ascii.
24     address->FromString("fe80::71:626f:6e65");
25     return address;
26   }();
27   return terminator_address;
28 }
29 
TerminatorLocalAddressRange()30 const IpRange* QboneConstants::TerminatorLocalAddressRange() {
31   static auto* range =
32       new quic::IpRange(*quic::QboneConstants::TerminatorLocalAddress(), 128);
33   return range;
34 }
35 
GatewayAddress()36 const QuicIpAddress* QboneConstants::GatewayAddress() {
37   static auto* gateway_address = []() {
38     auto* address = new QuicIpAddress;
39     address->FromString("fe80::1");
40     return address;
41   }();
42   return gateway_address;
43 }
44 
45 }  // namespace quic
46