2019-06-23 15:52:54 -07:00
|
|
|
pub mod crypto;
|
2019-07-14 00:48:45 -07:00
|
|
|
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 {
|
2019-09-04 09:09:01 -07:00
|
|
|
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>;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|