mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 11:23:25 +00:00
Refactor current net codes
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
f6b327dbda
commit
ddb7be9296
@ -6,6 +6,7 @@ pub use self::util::sock_options::{SockOptionLevel, SockOptionName};
|
||||
pub use self::util::sockaddr::SocketAddr;
|
||||
|
||||
pub mod ip;
|
||||
pub mod unix;
|
||||
mod util;
|
||||
|
||||
/// Operations defined on a socket.
|
||||
|
@ -13,3 +13,13 @@ pub enum SockShutdownCmd {
|
||||
/// Shutdown receptions and transmissions
|
||||
SHUT_RDWR = 2,
|
||||
}
|
||||
|
||||
impl SockShutdownCmd {
|
||||
pub fn shut_read(&self) -> bool {
|
||||
*self == Self::SHUT_RD || *self == Self::SHUT_RDWR
|
||||
}
|
||||
|
||||
pub fn shut_write(&self) -> bool {
|
||||
*self == Self::SHUT_WR || *self == Self::SHUT_RDWR
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ type PortNum = u16;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum SocketAddr {
|
||||
Unix,
|
||||
Unix(String),
|
||||
IPv4(Ipv4Address, PortNum),
|
||||
IPv6,
|
||||
}
|
||||
|
Reference in New Issue
Block a user