chromium/net/third_party/quiche/src/quiche/quic/core/qpack/qpack_header_table.h

// Copyright (c) 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_QPACK_QPACK_HEADER_TABLE_H_
#define QUICHE_QUIC_CORE_QPACK_QPACK_HEADER_TABLE_H_

#include <cstdint>
#include <deque>

#include "absl/strings/string_view.h"
#include "quiche/http2/hpack/hpack_entry.h"
#include "quiche/http2/hpack/hpack_header_table.h"
#include "quiche/quic/platform/api/quic_export.h"
#include "quiche/common/quiche_circular_deque.h"

namespace quic {

QpackEntry;
QpackLookupEntry;
constexpr size_t kQpackEntrySizeOverhead =;

// Encoder needs pointer stability for |dynamic_index_| and
// |dynamic_name_index_|.  However, it does not need random access.
QpackEncoderDynamicTable;

// Decoder needs random access for LookupEntry().
// However, it does not need pointer stability.
QpackDecoderDynamicTable;

// This is a base class for encoder and decoder classes that manage the QPACK
// static and dynamic tables.  For dynamic entries, it only has a concept of
// absolute indices.  The caller needs to perform the necessary transformations
// to and from relative indices and post-base indices.
template <typename DynamicEntryTable>
class QUICHE_EXPORT QpackHeaderTableBase {};

template <typename DynamicEntryTable>
QpackHeaderTableBase<DynamicEntryTable>::QpackHeaderTableBase()
    :{}

template <typename DynamicEntryTable>
bool QpackHeaderTableBase<DynamicEntryTable>::EntryFitsDynamicTableCapacity(
    absl::string_view name, absl::string_view value) const {}

namespace internal {

QUICHE_EXPORT inline size_t GetSize(const QpackEntry& entry) {}

QUICHE_EXPORT inline size_t GetSize(const std::unique_ptr<QpackEntry>& entry) {}

QUICHE_EXPORT inline std::unique_ptr<QpackEntry> NewEntry(
    std::string name, std::string value, QpackEncoderDynamicTable& /*t*/) {}

QUICHE_EXPORT inline QpackEntry NewEntry(std::string name, std::string value,
                                         QpackDecoderDynamicTable& /*t*/) {}

}  // namespace internal

template <typename DynamicEntryTable>
uint64_t QpackHeaderTableBase<DynamicEntryTable>::InsertEntry(
    absl::string_view name, absl::string_view value) {}

template <typename DynamicEntryTable>
bool QpackHeaderTableBase<DynamicEntryTable>::SetDynamicTableCapacity(
    uint64_t capacity) {}

template <typename DynamicEntryTable>
bool QpackHeaderTableBase<DynamicEntryTable>::SetMaximumDynamicTableCapacity(
    uint64_t maximum_dynamic_table_capacity) {}

template <typename DynamicEntryTable>
void QpackHeaderTableBase<DynamicEntryTable>::RemoveEntryFromEnd() {}

template <typename DynamicEntryTable>
void QpackHeaderTableBase<DynamicEntryTable>::EvictDownToCapacity(
    uint64_t capacity) {}

class QUICHE_EXPORT QpackEncoderHeaderTable
    : public QpackHeaderTableBase<QpackEncoderDynamicTable> {};

class QUICHE_EXPORT QpackDecoderHeaderTable
    : public QpackHeaderTableBase<QpackDecoderDynamicTable> {};

}  // namespace quic

#endif  // QUICHE_QUIC_CORE_QPACK_QPACK_HEADER_TABLE_H_