[−][src]Struct protosocks::RepPacket
Implementations
impl<T: AsRef<[u8]>> Packet<T>
[src]
pub fn new_unchecked(buffer: T) -> Packet<T>
[src]
Imbue a raw octet buffer with RFC1928 request packet structure.
pub fn new_checked(buffer: T) -> Result<Packet<T>, Error>
[src]
Shorthand for a combination of new_unchecked and check_len.
pub fn check_len(&self) -> Result<(), Error>
[src]
Ensure that no accessor method will panic if called.
Returns Err(Error::Truncated)
if the buffer is too short.
The result of this check is invalidated by calling [set_socks_addr]
pub fn total_len(&self) -> usize
[src]
Return the length (unchecked).
pub fn version(&self) -> u8
[src]
Return the version field.
pub fn cmd_or_rep(&self) -> u8
[src]
Return the cmd of request or rep of reply.
pub fn atyp(&self) -> u8
[src]
Return the atyp.
pub fn port(&self) -> u16
[src]
Return the dst port of request or bnd port of reply (unchecked).
pub fn take_buffer(self) -> T
[src]
impl<'a, T: AsRef<[u8]> + ?Sized> Packet<&'a T>
[src]
pub fn addr(&self) -> &'a [u8]
[src]
Return a pointer to the addr (unchecked).
pub fn socks_addr(&self) -> &'a [u8]
[src]
Return a pointer to the socks addr (atyp, addr, and port) (unchecked).
impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T>
[src]
pub fn set_version(&mut self, value: u8)
[src]
Set the version field.
pub fn set_cmd_or_rep(&mut self, value: u8)
[src]
Set the cmd or rep.
pub fn set_atyp(&mut self, value: u8)
[src]
Set the atyp.
pub fn set_addr(&mut self, value: &[u8])
[src]
Set the addr (unchecked).
pub fn set_port(&mut self, value: u16)
[src]
Set the port (unchecked).
pub fn set_socks_addr(&mut self, value: &[u8])
[src]
Set the socks addr (atyp, addr, and port) (unchecked).
pub fn addr_mut(&mut self) -> &mut [u8]
[src]
Return a mutable pointer to the addr (unchecked).
pub fn socks_addr_mut(&mut self) -> &mut [u8]
[src]
Return a mutable pointer to the socks addr (atyp, addr, and port) (unchecked).
Trait Implementations
impl<T: AsRef<[u8]>> AsRef<[u8]> for Packet<T>
[src]
impl<T: Clone + AsRef<[u8]>> Clone for Packet<T>
[src]
impl<T: Debug + AsRef<[u8]>> Debug for Packet<T>
[src]
impl<T: PartialEq + AsRef<[u8]>> PartialEq<Packet<T>> for Packet<T>
[src]
impl<T: AsRef<[u8]>> StructuralPartialEq for Packet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Packet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Packet<T> where
T: Send,
T: Send,
impl<T> Sync for Packet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Packet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Packet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,