@@ -75,6 +75,8 @@ pub(crate) use libc::{
7575#[ cfg( not( target_os = "redox" ) ) ]
7676pub ( crate ) use libc:: { MSG_TRUNC , SO_OOBINLINE } ;
7777// Used in `Socket`.
78+ #[ cfg( not( target_os = "nto" ) ) ]
79+ pub ( crate ) use libc:: ipv6_mreq as Ipv6Mreq ;
7880#[ cfg( all( feature = "all" , not( target_os = "redox" ) ) ) ]
7981pub ( crate ) use libc:: IP_HDRINCL ;
8082#[ cfg( not( any(
@@ -85,6 +87,8 @@ pub(crate) use libc::IP_HDRINCL;
8587 target_os = "openbsd" ,
8688 target_os = "redox" ,
8789 target_os = "solaris" ,
90+ target_os = "haiku" ,
91+ target_os = "nto" ,
8892) ) ) ]
8993pub ( crate ) use libc:: IP_RECVTOS ;
9094#[ cfg( not( any(
@@ -99,11 +103,11 @@ pub(crate) use libc::SO_LINGER;
99103#[ cfg( target_vendor = "apple" ) ]
100104pub ( crate ) use libc:: SO_LINGER_SEC as SO_LINGER ;
101105pub ( crate ) use libc:: {
102- ip_mreq as IpMreq , ipv6_mreq as Ipv6Mreq , linger, IPPROTO_IP , IPPROTO_IPV6 ,
103- IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF , IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY ,
104- IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP , IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL ,
105- IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET , SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF ,
106- SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF , SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
106+ ip_mreq as IpMreq , linger, IPPROTO_IP , IPPROTO_IPV6 , IPV6_MULTICAST_HOPS , IPV6_MULTICAST_IF ,
107+ IPV6_MULTICAST_LOOP , IPV6_UNICAST_HOPS , IPV6_V6ONLY , IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP ,
108+ IP_MULTICAST_IF , IP_MULTICAST_LOOP , IP_MULTICAST_TTL , IP_TTL , MSG_OOB , MSG_PEEK , SOL_SOCKET ,
109+ SO_BROADCAST , SO_ERROR , SO_KEEPALIVE , SO_RCVBUF , SO_RCVTIMEO , SO_REUSEADDR , SO_SNDBUF ,
110+ SO_SNDTIMEO , SO_TYPE , TCP_NODELAY ,
107111} ;
108112#[ cfg( not( any(
109113 target_os = "dragonfly" ,
@@ -112,6 +116,7 @@ pub(crate) use libc::{
112116 target_os = "openbsd" ,
113117 target_os = "redox" ,
114118 target_os = "fuchsia" ,
119+ target_os = "nto" ,
115120) ) ) ]
116121pub ( crate ) use libc:: {
117122 ip_mreq_source as IpMreqSource , IP_ADD_SOURCE_MEMBERSHIP , IP_DROP_SOURCE_MEMBERSHIP ,
@@ -124,6 +129,7 @@ pub(crate) use libc::{
124129 target_os = "netbsd" ,
125130 target_os = "openbsd" ,
126131 target_os = "solaris" ,
132+ target_os = "nto" ,
127133 target_vendor = "apple"
128134) ) ) ]
129135pub ( crate ) use libc:: { IPV6_ADD_MEMBERSHIP , IPV6_DROP_MEMBERSHIP } ;
@@ -158,9 +164,14 @@ pub(crate) use libc::{TCP_KEEPCNT, TCP_KEEPINTVL};
158164// See this type in the Windows file.
159165pub ( crate ) type Bool = c_int ;
160166
161- #[ cfg( target_vendor = "apple" ) ]
167+ #[ cfg( any ( target_vendor = "apple" , target_os = "nto" ) ) ]
162168use libc:: TCP_KEEPALIVE as KEEPALIVE_TIME ;
163- #[ cfg( not( any( target_vendor = "apple" , target_os = "haiku" , target_os = "openbsd" ) ) ) ]
169+ #[ cfg( not( any(
170+ target_vendor = "apple" ,
171+ target_os = "haiku" ,
172+ target_os = "openbsd" ,
173+ target_os = "nto" ,
174+ ) ) ) ]
164175use libc:: TCP_KEEPIDLE as KEEPALIVE_TIME ;
165176
166177/// Helper macro to execute a system call that returns an `io::Result`.
@@ -219,6 +230,7 @@ type IovLen = usize;
219230 target_os = "netbsd" ,
220231 target_os = "openbsd" ,
221232 target_os = "solaris" ,
233+ target_os = "nto" ,
222234 target_vendor = "apple" ,
223235) ) ]
224236type IovLen = c_int ;
@@ -903,7 +915,7 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
903915
904916#[ allow( unused_variables) ]
905917pub ( crate ) fn set_tcp_keepalive ( fd : Socket , keepalive : & TcpKeepalive ) -> io:: Result < ( ) > {
906- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
918+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
907919 if let Some ( time) = keepalive. time {
908920 let secs = into_secs ( time) ;
909921 unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
@@ -930,10 +942,16 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
930942 }
931943 }
932944
945+ #[ cfg( target_os = "nto" ) ]
946+ if let Some ( time) = keepalive. time {
947+ let secs = into_timeval ( Some ( time) ) ;
948+ unsafe { setsockopt ( fd, libc:: IPPROTO_TCP , KEEPALIVE_TIME , secs) ? }
949+ }
950+
933951 Ok ( ( ) )
934952}
935953
936- #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" ) ) ) ]
954+ #[ cfg( not( any( target_os = "haiku" , target_os = "openbsd" , target_os = "nto" ) ) ) ]
937955fn into_secs ( duration : Duration ) -> c_int {
938956 min ( duration. as_secs ( ) , c_int:: max_value ( ) as u64 ) as c_int
939957}
@@ -1028,6 +1046,7 @@ pub(crate) fn from_in6_addr(addr: in6_addr) -> Ipv6Addr {
10281046 target_os = "openbsd" ,
10291047 target_os = "redox" ,
10301048 target_os = "solaris" ,
1049+ target_os = "nto" ,
10311050) ) ) ]
10321051pub ( crate ) fn to_mreqn (
10331052 multiaddr : & Ipv4Addr ,
0 commit comments