diff options
author | Sunil Nimmagadda <sunil@nimmagadda.net> | 2022-12-07 13:35:25 +0530 |
---|---|---|
committer | Sunil Nimmagadda <sunil@nimmagadda.net> | 2022-12-07 13:35:25 +0530 |
commit | a9f5db10c9916e2fccb2582ed65299335a5ce469 (patch) | |
tree | 4ff1f18766469a4796e4b3c45251e887d14f72f8 /src/vrrpv2.rs | |
parent | b6bd0067c14ca0bbac2cf430a8030ee9480e6a66 (diff) |
Module to parse(unimplemented) VRRPv2 packet.
Define a struct and its related enums.
Diffstat (limited to 'src/vrrpv2.rs')
-rw-r--r-- | src/vrrpv2.rs | 33 |
1 files changed, 33 insertions, 0 deletions
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!() +} |