From a9f5db10c9916e2fccb2582ed65299335a5ce469 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Wed, 7 Dec 2022 13:35:25 +0530 Subject: Module to parse(unimplemented) VRRPv2 packet. Define a struct and its related enums. --- src/lib.rs | 1 + src/vrrpv2.rs | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/lib.rs create mode 100644 src/vrrpv2.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..ae2ba80 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +pub mod vrrpv2; diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs new file mode 100644 index 0000000..559b913 --- /dev/null +++ b/src/vrrpv2.rs @@ -0,0 +1,33 @@ +use std::net::Ipv4Addr; + +pub enum VRRPv2Error {} + +pub enum VRRPVersion { + V2(u8), +} + +pub enum VRRPv2Type { + VRRPv2Advertisement, +} + +pub enum VRRPv2AuthType { + VRRPv2AuthNoAuth = 0x00, + VRRPv2AuthReserved1 = 0x01, + VRRPv2AuthReserved2 = 0x02, +} + +pub struct VRRPv2 { + pub version: VRRPVersion, + pub type_: VRRPv2Type, + pub virtual_router_id: u8, + pub priority: u8, + pub count_ip_addrs: u8, + pub auth_type: VRRPv2AuthType, + pub advertisement_interval: u8, + pub checksum: u16, + pub ip_addrs: Vec, +} + +pub fn from_bytes(_bytes: &[u8]) -> Result<&VRRPv2, VRRPv2Error> { + unimplemented!() +} -- cgit v1.2.3