23 lines
442 B
Rust
Raw Normal View History

2019-06-23 15:52:54 -07:00
pub mod crypto;
pub mod packet;
2019-08-22 20:37:22 -07:00
pub mod character;
2019-06-06 16:46:23 -07:00
#[derive(Debug, PartialEq)]
pub enum PacketParseError {
NotEnoughBytes,
WrongPacketCommand,
2019-06-23 15:52:54 -07:00
WrongPacketForServerType,
WrongPacketSize(u16, usize),
DataStructNotLargeEnough(u64, usize),
2019-08-22 20:37:22 -07:00
InvalidValue,
2019-05-29 22:34:00 -07:00
}
2019-06-06 16:46:23 -07:00
2019-06-23 15:52:54 -07:00
pub trait PSOPacket: std::fmt::Debug {
fn from_bytes(data: &[u8]) -> Result<Self, PacketParseError> where Self: Sized;
2019-06-06 16:46:23 -07:00
fn as_bytes(&self) -> Vec<u8>;
}