summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vrrpv2.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs
index c6e7125..fa41696 100644
--- a/src/vrrpv2.rs
+++ b/src/vrrpv2.rs
@@ -29,7 +29,7 @@ use std::net::Ipv4Addr;
pub struct VRRPv2 {
pub virtual_router_id: u8,
pub priority: u8,
- pub auth_type: VRRPv2AuthType,
+ pub auth_type: AuthType,
pub advertisement_interval: u8,
pub checksum: u16,
pub ip_addrs: Vec<Ipv4Addr>,
@@ -67,10 +67,10 @@ impl From<io::Error> for VRRPv2Error {
}
#[derive(Clone, Copy, Debug, PartialEq)]
-pub enum VRRPv2AuthType {
- VRRPv2AuthNoAuth = 0x00,
- VRRPv2AuthReserved1 = 0x01,
- VRRPv2AuthReserved2 = 0x02,
+pub enum AuthType {
+ NoAuth = 0x00,
+ Reserved1 = 0x01,
+ Reserved2 = 0x02,
}
trait BytesReader {
@@ -141,9 +141,9 @@ fn parse(bytes: &[u8]) -> Result<VRRPv2, VRRPv2Error> {
let count_ip_addrs = rdr.read_u8()?;
let auth_type = rdr.read_u8()?;
let auth_type = match auth_type {
- 0 => VRRPv2AuthType::VRRPv2AuthNoAuth,
- 1 => VRRPv2AuthType::VRRPv2AuthReserved1,
- 2 => VRRPv2AuthType::VRRPv2AuthReserved2,
+ 0 => AuthType::NoAuth,
+ 1 => AuthType::Reserved1,
+ 2 => AuthType::Reserved2,
_ => return Err(VRRPv2Error::InvalidAuthType),
};
let advertisement_interval = rdr.read_u8()?;
@@ -169,7 +169,7 @@ fn parse(bytes: &[u8]) -> Result<VRRPv2, VRRPv2Error> {
///
/// ```
/// use vrrpd::vrrpv2::VRRPv2;
-/// use vrrpd::vrrpv2::VRRPv2AuthType;
+/// use vrrpd::vrrpv2::AuthType;
/// use vrrpd::vrrpv2::from_bytes;
/// use std::net::Ipv4Addr;
///
@@ -181,7 +181,7 @@ fn parse(bytes: &[u8]) -> Result<VRRPv2, VRRPv2Error> {
/// let expected = VRRPv2 {
/// virtual_router_id: 1,
/// priority: 100,
-/// auth_type: VRRPv2AuthType::VRRPv2AuthNoAuth,
+/// auth_type: AuthType::NoAuth,
/// checksum: 47698,
/// advertisement_interval: 1,
/// ip_addrs: vec![Ipv4Addr::from([192, 168, 0, 1])],