调整项目结构、尝试支持安卓

This commit is contained in:
lubeilin
2023-01-08 15:38:45 +08:00
parent d956e493af
commit 292893e9dd
76 changed files with 1132 additions and 588 deletions
+18
View File
@@ -0,0 +1,18 @@
use ipv4::packet::IpV4Packet;
use crate::error::*;
pub mod ipv4;
pub enum IpPacket<B> {
V4(IpV4Packet<B>),
}
impl<B: AsRef<[u8]>> IpPacket<B> {
pub fn new(buffer: B) -> Result<Self> {
match buffer.as_ref()[0] >> 4 {
4 => Ok(IpPacket::V4(IpV4Packet::new(buffer)?)),
_ => Err(Error::InvalidPacket),
}
}
}