summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2022-12-07 13:35:25 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2022-12-07 13:35:25 +0530
commita9f5db10c9916e2fccb2582ed65299335a5ce469 (patch)
tree4ff1f18766469a4796e4b3c45251e887d14f72f8
parentb6bd0067c14ca0bbac2cf430a8030ee9480e6a66 (diff)
Module to parse(unimplemented) VRRPv2 packet.
Define a struct and its related enums.
-rw-r--r--src/lib.rs1
-rw-r--r--src/vrrpv2.rs33
2 files changed, 34 insertions, 0 deletions
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<Ipv4Addr>,
+}
+
+pub fn from_bytes(_bytes: &[u8]) -> Result<&VRRPv2, VRRPv2Error> {
+ unimplemented!()
+}