chromium/net/third_party/quiche/src/quiche/quic/core/quic_connection_id.h

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef QUICHE_QUIC_CORE_QUIC_CONNECTION_ID_H_
#define QUICHE_QUIC_CORE_QUIC_CONNECTION_ID_H_

#include <cstdint>
#include <string>
#include <vector>

#include "absl/types/span.h"
#include "quiche/quic/platform/api/quic_export.h"

namespace quic {

// This is a property of QUIC headers, it indicates whether the connection ID
// should actually be sent over the wire (or was sent on received packets).
enum QuicConnectionIdIncluded : uint8_t {};

// Maximum connection ID length supported by versions that use the encoding from
// draft-ietf-quic-invariants-06.
inline constexpr uint8_t kQuicMaxConnectionIdWithLengthPrefixLength =;

// Maximum connection ID length supported by versions that use the encoding from
// draft-ietf-quic-invariants-05.
inline constexpr uint8_t kQuicMaxConnectionId4BitLength =;

// kQuicDefaultConnectionIdLength is the only supported length for QUIC
// versions < v99, and is the default picked for all versions.
inline constexpr uint8_t kQuicDefaultConnectionIdLength =;

// According to the IETF spec, the initial server connection ID generated by
// the client must be at least this long.
inline constexpr uint8_t kQuicMinimumInitialConnectionIdLength =;

class QUICHE_EXPORT QuicConnectionId {};

// Creates a connection ID of length zero, unless the restart flag
// quic_connection_ids_network_byte_order is false in which case
// it returns an 8-byte all-zeroes connection ID.
QUICHE_EXPORT QuicConnectionId EmptyQuicConnectionId();

// QuicConnectionIdHash can be passed as hash argument to hash tables.
// During the lifetime of a process, the output of QuicConnectionIdHash is
// guaranteed to be the same for connection IDs that are equal to one another.
// Note however that this property is not guaranteed across process lifetimes.
// This makes QuicConnectionIdHash suitable for data structures such as hash
// tables but not for sending a hash over the network.
class QUICHE_EXPORT QuicConnectionIdHash {};

}  // namespace quic

#endif  // QUICHE_QUIC_CORE_QUIC_CONNECTION_ID_H_