Enum w5500_ll::SocketCommand [−][src]
#[repr(u8)] pub enum SocketCommand { Accepted, Open, Listen, Connect, Disconnect, Close, Send, SendMac, SendKeep, Recv, }
Socket commands.
This is used to set the command for socket n.
After W5500 accepts the command, the sn_cr
register is automatically
cleared to 0x00
.
Even though sn_cr
is cleared to 0x00
, the command
is still being processed.
To check whether the command is completed or not, check
sn_ir
or sn_sr
.
Variants
The command register clears to this state once a command has been accepted.
The socket is initialized and opened according to the protocol
selected in sn_mr
.
sn_mr | sn_sr |
---|---|
Protocol::Closed | - |
Protocol::Tcp | SocketStatus::Init |
Protocol::Udp | SocketStatus::Udp |
Protocol::Macraw | SocketStatus::Macraw |
Operate the socket as a TCP server.
This will change the socket state from Init
to Listen
,
and the socket will listen for a
connection-request (SYN packet) from any TCP client.
When a TCP client connection request is successfully established,
the socket state changes from Listen
to
Established
and the CON
socket interrupt is raised.
When a TCP client connection request fails the TIMEOUT
socket
interrupt is set and the
socket status changes to Closed
.
Only valid in Tcp
mode.
Connect to a TCP server.
A connect-request (SYN packet) is sent to the TCP server configured by
the IPv4 address and port set with set_sn_dest
.
If the connect-request is successful, the socket state changes to
Established
and the CON
socket interrupt is raised.
The connect-request fails in the following three cases:
- When a ARPTO occurs (
timeout_raised
) because the destination hardware address is not acquired through the ARP-process. - When a SYN/ACK packet is not received within the TCP timeout duration
set by
rcr
andrtr
(timeout_raised
). - When a RST packet is received instead of a SYN/ACK packet.
In these cases the socket state changes to Closed
.
Only valid in Tcp
mode when acting as a TCP client.
Start the disconnect process.
- Active close it transmits disconnect-request(FIN packet) to the connected peer.
- Passive close when FIN packet is received from peer, a FIN packet is replied back to the peer.
When the disconnect-process is successful
(that is, FIN/ACK packet is received successfully),
the socket state changes to Closed
.
Otherwise, TCP timeout occurs
(timeout_raised
) and then
the socket state changes to Closed
.
If the Close
command is used instead of
Disconnect
, the socket state is changes to
Closed
without the disconnect process.
If a RST packet is received from a peer during communication the socket
status is unconditionally changed to Closed
.
Only valid in Tcp
mode.
Close the socket.
The socket status is changed to Closed
.
Transmits all the data in the socket TX buffer.
The basic operation is same as Send
.
Normally Send
transmits data after destination
hardware address is acquired by the automatic ARP-process
(Address Resolution Protocol).
SendMac
transmits data without the automatic
ARP-process.
In this case, the destination hardware address is acquired from
sn_dhar
configured by the host, instead of the ARP
process.
Only valid in Udp
mode.
Sends a 1 byte keep-alive packet.
If the peer cannot respond to the keep-alive packet during timeout
time, the connection is terminated and the timeout interrupt will
occur (timeout_raised
).
Only valid in Tcp
mode.
Completes the processing of the received data in socket RX buffer.
See sn_rx_buf
for an example.
Trait Implementations
impl Clone for SocketCommand
[src]
impl Clone for SocketCommand
[src]fn clone(&self) -> SocketCommand
[src]
fn clone(&self) -> SocketCommand
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for SocketCommand
[src]
impl Debug for SocketCommand
[src]impl Hash for SocketCommand
[src]
impl Hash for SocketCommand
[src]impl Ord for SocketCommand
[src]
impl Ord for SocketCommand
[src]impl PartialEq<SocketCommand> for SocketCommand
[src]
impl PartialEq<SocketCommand> for SocketCommand
[src]impl PartialOrd<SocketCommand> for SocketCommand
[src]
impl PartialOrd<SocketCommand> for SocketCommand
[src]fn partial_cmp(&self, other: &SocketCommand) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &SocketCommand) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for SocketCommand
[src]
impl Eq for SocketCommand
[src]
impl StructuralEq for SocketCommand
[src]
impl StructuralPartialEq for SocketCommand
[src]
Auto Trait Implementations
impl RefUnwindSafe for SocketCommand
impl Send for SocketCommand
impl Sync for SocketCommand
impl Unpin for SocketCommand
impl UnwindSafe for SocketCommand
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more