1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use std::fmt;
use rusticata_macros::debug::HexSlice;
use ikev2::*;
use ikev2_transforms::*;
impl<'a> fmt::Debug for IkeV2RawTransform<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let (tf_type, tf_id) = match self.transform_type {
IkeTransformType::EncryptionAlgorithm => {
("EncryptionAlgorithm".to_string(),format!("{:?}", self.transform_id))
},
IkeTransformType::PseudoRandomFunction => {
("PseudoRandomFunction".to_string(),format!("{:?}", self.transform_id))
},
IkeTransformType::IntegrityAlgorithm => {
("IntegrityAlgorithm".to_string(),format!("{:?}", self.transform_id))
},
IkeTransformType::DiffieHellmanGroup => {
("DiffieHellmanGroup".to_string(),format!("{:?}", self.transform_id))
},
IkeTransformType::ExtendedSequenceNumbers => {
("ExtendedSequenceNumbers".to_string(),format!("{:?}", self.transform_id))
},
_ => (format!("<Unknown transform type {}>", self.transform_type.0),"".to_string()),
};
fmt.debug_struct("IkeV2RawTransform")
.field("last", &self.last)
.field("reserved1", &self.reserved1)
.field("transform_length", &self.transform_length)
.field("transform_type", &tf_type)
.field("reserved2", &self.reserved2)
.field("transform_id", &tf_id)
.field("attributes", &self.attributes)
.finish()
}
}
impl<'a> fmt::Debug for NoncePayload<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("NoncePayload")
.field("nonce_data", &HexSlice{d:self.nonce_data})
.finish()
}
}
impl<'a> fmt::Debug for NotifyPayload<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("NotifyPayload")
.field("protocol_id", &self.protocol_id)
.field("spi_size", &self.spi_size)
.field("notify_type", &self.notify_type)
.field("spi", &self.spi)
.field("notify_data", &self.notify_data.map(|o|{HexSlice{d:o}}))
.finish()
}
}