equal
deleted
inserted
replaced
|
1 use std::fmt::Display; |
1 use std::io::Read; |
2 use std::io::Read; |
2 use std::io::{self, Cursor}; |
3 use std::io::{self, Cursor}; |
3 use std::net::Ipv4Addr; |
4 use std::net::Ipv4Addr; |
4 |
5 |
5 /// A VRRP version 2 packet. |
6 /// A VRRP version 2 packet. |
40 InvalidAuthType, |
41 InvalidAuthType, |
41 InvalidChecksum, |
42 InvalidChecksum, |
42 InvalidType, |
43 InvalidType, |
43 InvalidVersion, |
44 InvalidVersion, |
44 ParseError, |
45 ParseError, |
|
46 } |
|
47 |
|
48 impl Display for VRRPv2Error { |
|
49 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
|
50 match self { |
|
51 Self::InvalidAuthType => write!(f, "Invalid Auth Type"), |
|
52 Self::InvalidChecksum => write!(f, "Invalid Checksum"), |
|
53 Self::InvalidType => write!(f, "Invalid Type"), |
|
54 Self::InvalidVersion => write!(f, "Invalid Version"), |
|
55 Self::ParseError => write!(f, "Parse Error"), |
|
56 } |
|
57 } |
45 } |
58 } |
46 |
59 |
47 #[derive(Debug, PartialEq)] |
60 #[derive(Debug, PartialEq)] |
48 pub enum VRRPv2AuthType { |
61 pub enum VRRPv2AuthType { |
49 VRRPv2AuthNoAuth = 0x00, |
62 VRRPv2AuthNoAuth = 0x00, |