Skip to content

Commit

Permalink
qlog: add basic DATAGRAM frame logging
Browse files Browse the repository at this point in the history
Previously, we logged DATAGRAM frames as a generic "unknown" frame
event with a hard-coded frame type of 0x30. This change adds a
proper frame definition that results in such frames getting logged
as "datagram" along with the length of the frame payload.
  • Loading branch information
LPardue authored and ghedo committed Dec 9, 2020
1 parent 8863dc7 commit 54806c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,8 @@ impl Frame {

Frame::HandshakeDone => qlog::QuicFrame::handshake_done(),

Frame::Datagram { .. } => qlog::QuicFrame::unknown(0x30),
Frame::Datagram { data } =>
qlog::QuicFrame::datagram(data.len().to_string(), None),
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions tools/qlog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,7 @@ pub enum QuicFrameTypeName {
ConnectionClose,
ApplicationClose,
HandshakeDone,
Datagram,
Unknown,
}

Expand Down Expand Up @@ -1966,6 +1967,13 @@ pub enum QuicFrame {
frame_type: QuicFrameTypeName,
},

Datagram {
frame_type: QuicFrameTypeName,
length: String,

raw: Option<String>,
},

Unknown {
frame_type: QuicFrameTypeName,
raw_frame_type: u64,
Expand Down Expand Up @@ -2149,6 +2157,14 @@ impl QuicFrame {
}
}

pub fn datagram(length: String, raw: Option<String>) -> Self {
QuicFrame::Datagram {
frame_type: QuicFrameTypeName::Datagram,
length,
raw,
}
}

pub fn unknown(raw_frame_type: u64) -> Self {
QuicFrame::Unknown {
frame_type: QuicFrameTypeName::Unknown,
Expand Down

0 comments on commit 54806c8

Please sign in to comment.