[−][src]Struct tox_packet::ip_port::IpPort
IpAddr
with a port number. IPv4 can be padded with 12 bytes of zeros
so that both IPv4 and IPv6 have the same stored size.
Serialized form:
Length | Content |
---|---|
1 | IpType |
4 or 16 | IPv4 or IPv6 address |
0 or 12 | Padding for IPv4 (if needed) |
2 | Port |
Fields
protocol: ProtocolType
Type of protocol
ip_addr: IpAddr
IP address
port: u16
Port number
Implementations
impl IpPort
[src]
pub fn from_udp_bytes(
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
[src]
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
Parse IpPort
with UDP protocol type with optional padding.
pub fn from_tcp_bytes(
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
[src]
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
Parse IpPort
with TCP protocol type with optional padding.
pub fn from_bytes(
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
[src]
input: &[u8],
padding: IpPortPadding
) -> IResult<&[u8], IpPort>
Parse IpPort
with optional padding.
pub fn to_udp_bytes<'a>(
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
[src]
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
Write IpPort
with UDP protocol type with optional padding.
pub fn to_tcp_bytes<'a>(
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
[src]
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
Write IpPort
with TCP protocol type with optional padding.
pub fn to_bytes<'a>(
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
[src]
&self,
buf: (&'a mut [u8], usize),
padding: IpPortPadding
) -> Result<(&'a mut [u8], usize), GenError>
Write IpPort
with optional padding.
pub fn from_udp_saddr(saddr: SocketAddr) -> IpPort
[src]
Create new IpPort
from SocketAddr
with UDP type.
pub fn from_tcp_saddr(saddr: SocketAddr) -> IpPort
[src]
Create new IpPort
from SocketAddr
with TCP type.
pub fn to_saddr(&self) -> SocketAddr
[src]
Convert IpPort
to SocketAddr
.
Trait Implementations
impl Clone for IpPort
[src]
impl Debug for IpPort
[src]
impl Eq for IpPort
[src]
impl PartialEq<IpPort> for IpPort
[src]
impl StructuralEq for IpPort
[src]
impl StructuralPartialEq for IpPort
[src]
Auto Trait Implementations
impl RefUnwindSafe for IpPort
[src]
impl Send for IpPort
[src]
impl Sync for IpPort
[src]
impl Unpin for IpPort
[src]
impl UnwindSafe for IpPort
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,