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 #ifndef QUICHE_QUIC_CORE_QPACK_QPACK_REQUIRED_INSERT_COUNT_H_ 6 #define QUICHE_QUIC_CORE_QPACK_QPACK_REQUIRED_INSERT_COUNT_H_ 7 8 #include <cstdint> 9 10 #include "quiche/quic/platform/api/quic_export.h" 11 12 namespace quic { 13 14 // Calculate Encoded Required Insert Count from Required Insert Count and 15 // MaxEntries according to 16 // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#ric. 17 QUICHE_EXPORT uint64_t QpackEncodeRequiredInsertCount( 18 uint64_t required_insert_count, uint64_t max_entries); 19 20 // Calculate Required Insert Count from Encoded Required Insert Count, 21 // MaxEntries, and total number of dynamic table insertions according to 22 // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#ric. Returns true 23 // on success, false on invalid input or overflow/underflow. 24 QUICHE_EXPORT bool QpackDecodeRequiredInsertCount( 25 uint64_t encoded_required_insert_count, uint64_t max_entries, 26 uint64_t total_number_of_inserts, uint64_t* required_insert_count); 27 28 } // namespace quic 29 30 #endif // QUICHE_QUIC_CORE_QPACK_QPACK_REQUIRED_INSERT_COUNT_H_ 31