summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-07-15 18:03:53 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-07-15 18:05:05 +0200
commit84ee468b1d27d2b8d49447a5fbfc95d8f6e2e7b1 (patch)
treec10f6c94134b0be878dc67707635ac6dafe042da
parentf598646623655dac80ee5bfafeeb50b406002a85 (diff)
sq: Dump header length if available.
-rw-r--r--tool/src/commands/dump.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs
index c6327f1c..3f7e744b 100644
--- a/tool/src/commands/dump.rs
+++ b/tool/src/commands/dump.rs
@@ -272,8 +272,19 @@ impl PacketDumper {
}
if let Some(h) = header {
- write!(output, ", {} CTB, {}",
+ write!(output, ", {} CTB, {}{}",
if let CTB::Old(_) = h.ctb() { "old" } else { "new" },
+ if let Some(map) = map {
+ format!("{} header bytes + ",
+ map.iter().take(2).map(|f| f.as_bytes().len())
+ .sum::<usize>())
+ } else {
+ // XXX: Mapping is disabled. No can do for
+ // now. Once we save the header in
+ // packet::Common, we can use this instead of
+ // relying on the map.
+ "".into()
+ },
match h.length() {
BodyLength::Full(n) =>
format!("{} bytes", n),