mod.rs 994 B

12345678910111213141516171819202122232425262728293031323334
  1. use smoltcp;
  2. // pub mod raw;
  3. // pub mod icmp;
  4. pub mod common;
  5. pub mod datagram;
  6. pub mod stream;
  7. pub mod syscall;
  8. pub use common::BoundInner;
  9. pub use common::Types;
  10. // pub use raw::RawSocket;
  11. pub use datagram::UdpSocket;
  12. pub use stream::TcpSocket;
  13. pub use syscall::Inet;
  14. use super::Socket;
  15. use smoltcp::wire::*;
  16. /// A local endpoint, which indicates that the local endpoint is unspecified.
  17. ///
  18. /// According to the Linux man pages and the Linux implementation, `getsockname()` will _not_ fail
  19. /// even if the socket is unbound. Instead, it will return an unspecified socket address. This
  20. /// unspecified endpoint helps with that.
  21. const UNSPECIFIED_LOCAL_ENDPOINT_V4: IpEndpoint =
  22. IpEndpoint::new(IpAddress::Ipv4(Ipv4Address::UNSPECIFIED), 0);
  23. const UNSPECIFIED_LOCAL_ENDPOINT_V6: IpEndpoint =
  24. IpEndpoint::new(IpAddress::Ipv6(Ipv6Address::UNSPECIFIED), 0);
  25. pub trait InetSocket: Socket {
  26. /// `on_iface_events`
  27. /// 通知socket发生的事件
  28. fn on_iface_events(&self);
  29. }