Debian Codegraph @

third_party/rust/neqo-qpack/src/qlog.rs

raw
1 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4 // option. This file may not be copied, modified, or distributed
5 // except according to those terms.
6
7 // Functions that handle capturing QLOG traces.
8
9 use neqo_common::{hex, qlog::NeqoQlog};
10 use qlog::events::{
11 qpack::{QPackInstruction, QpackInstructionParsed, QpackInstructionTypeName},
12 EventData, RawInfo,
13 };
14
15 /// Uses [`NeqoQlog::add_event_data_now`] instead of
16 /// [`NeqoQlog::add_event_data_with_instant`], given that `now` is not available
17 /// on call-site. See docs on [`NeqoQlog::add_event_data_now`] for details.
18 pub fn qpack_read_insert_count_increment_instruction(qlog: &NeqoQlog, increment: u64, data: &[u8]) {
19 qlog.add_event_data_now(|| {
20 let raw = RawInfo {
21 length: Some(8),
22 payload_length: None,
23 data: Some(hex(data)),
24 };
25 let ev_data = EventData::QpackInstructionParsed(QpackInstructionParsed {
26 instruction: QPackInstruction::InsertCountIncrementInstruction {
27 instruction_type: QpackInstructionTypeName::InsertCountIncrementInstruction,
28 increment,
29 },
30 raw: Some(raw),
31 });
32
33 Some(ev_data)
34 });
35 }