use alloc::vec::Vec;
use pnet_macros::packet;
use pnet_macros_support::types::*;
#[packet]
pub struct Vxlan {
pub flags: u8,
pub reserved1: u24be,
pub vni: u24be,
pub reserved2: u8,
#[payload]
pub payload: Vec<u8>,
}
#[test]
fn vxlan_packet_test() {
let mut packet = [0u8;8];
{
let mut vxlan_header = MutableVxlanPacket::new(&mut packet[..]).unwrap();
vxlan_header.set_flags(0x08);
assert_eq!(vxlan_header.get_flags(), 0x08);
vxlan_header.set_vni(0x123456);
assert_eq!(vxlan_header.get_vni(), 0x123456);
}
let ref_packet = [
0x08, 0x00, 0x00, 0x00, 0x12, 0x34, 0x56, 0x00 ];
assert_eq!(&ref_packet[..], &packet[..]);
}