neli/
parse.rs

1use std::mem;
2
3use byteorder::{ByteOrder, NativeEndian};
4
5/// Get the length of a netlink message from a buffer
6pub fn packet_length_u32(buffer: &[u8], position: usize) -> usize {
7    let len_buffer = &buffer[position..position + mem::size_of::<u32>()];
8    <NativeEndian as ByteOrder>::read_u32(len_buffer) as usize
9}