| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#; |
| 2 | |
| 3 | use craterust-analyzer cargo timestamped-socket 0.2.2 crate/::{cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr()., interfacerust-analyzer cargo timestamped-socket 0.2.2 interface/::InterfaceNamerust-analyzer cargo timestamped-socket 0.2.2 interface/InterfaceName#}; |
| 4 | |
| 5 | use superrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/::RawSocketrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#; |
| 6 | |
| 7 | #[repr(C)] |
| 8 | struct so_timestampingrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping# { |
| 9 | flagsrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping#flags.: libcrust-analyzer cargo libc 0.2.152 crate/::c_intrust-analyzer cargo libc 0.2.152 unix/c_int#, |
| 10 | bind_phcrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping#bind_phc.: libcrust-analyzer cargo libc 0.2.152 crate/::c_intrust-analyzer cargo libc 0.2.152 unix/c_int#, |
| 11 | } |
| 12 | |
| 13 | impl RawSocketrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket# { |
| 14 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn so_timestampingrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]so_timestamping().(&self, options: u32, bind_phc: u32) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 15 | // Documentation on the timestamping calls: |
| 16 | // |
| 17 | // - linux: https://www.kernel.org/doc/Documentation/networking/timestamping.txt |
| 18 | // - freebsd: https://man.freebsd.org/cgi/man.cgi?setsockopt |
| 19 | // |
| 20 | // SAFETY: |
| 21 | // |
| 22 | // - the socket is provided by (safe) rust, and will outlive the call |
| 23 | // - method is guaranteed to be a valid "name" argument |
| 24 | // - the options pointer outlives the call |
| 25 | // - the `option_len` corresponds with the options pointer |
| 26 | // |
| 27 | // Only some bits are valid to set in `options`, but setting invalid bits is |
| 28 | // perfectly safe |
| 29 | // |
| 30 | // > Setting other bit returns EINVAL and does not change the current state. |
| 31 | let tstamp_config = so_timestampingrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping# { |
| 32 | flagsrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping#flags.: options as libcrust-analyzer cargo libc 0.2.152 crate/::c_intrust-analyzer cargo libc 0.2.152 unix/c_int#, |
| 33 | bind_phcrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/so_timestamping#bind_phc.: bind_phc as libcrust-analyzer cargo libc 0.2.152 crate/::c_intrust-analyzer cargo libc 0.2.152 unix/c_int#, |
| 34 | }; |
| 35 | |
| 36 | unsafe { |
| 37 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 38 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 39 | libcrust-analyzer cargo libc 0.2.152 crate/::SOL_SOCKETrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/arch/generic/SOL_SOCKET., |
| 40 | libcrust-analyzer cargo libc 0.2.152 crate/::SO_TIMESTAMPINGrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/arch/generic/SO_TIMESTAMPING., |
| 41 | &tstamp_config as *const _ as *const libcrust-analyzer cargo libc 0.2.152 crate/::c_voidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_void#, |
| 42 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&tstamp_config) as libcrust-analyzer cargo libc 0.2.152 crate/::socklen_trust-analyzer cargo libc 0.2.152 unix/linux_like/linux/socklen_t#, |
| 43 | )) |
| 44 | }?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 45 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 46 | } |
| 47 | |
| 48 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn driver_enable_hardware_timestampingrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]driver_enable_hardware_timestamping().( |
| 49 | &self, |
| 50 | interface: InterfaceNamerust-analyzer cargo timestamped-socket 0.2.2 interface/InterfaceName#, |
| 51 | rx_filter: libcrust-analyzer cargo libc 0.2.152 crate/::c_intrust-analyzer cargo libc 0.2.152 unix/c_int#, |
| 52 | ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 53 | let mut tstamp_config = libcrust-analyzer cargo libc 0.2.152 crate/::hwtstamp_configrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/hwtstamp_config# { |
| 54 | flagsrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/hwtstamp_config#flags.: 0, |
| 55 | tx_typerust-analyzer cargo libc 0.2.152 unix/linux_like/linux/hwtstamp_config#tx_type.: libcrust-analyzer cargo libc 0.2.152 crate/::HWTSTAMP_TX_ONrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/HWTSTAMP_TX_ON. as _, |
| 56 | rx_filterrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/hwtstamp_config#rx_filter., |
| 57 | }; |
| 58 | |
| 59 | let mut ifreq = libcrust-analyzer cargo libc 0.2.152 crate/::ifreqrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/ifreq# { |
| 60 | ifr_namerust-analyzer cargo libc 0.2.152 unix/linux_like/linux/ifreq#ifr_name.: interface.to_ifr_namerust-analyzer cargo timestamped-socket 0.2.2 interface/impl#[InterfaceName]to_ifr_name().(), |
| 61 | ifr_ifrurust-analyzer cargo libc 0.2.152 unix/linux_like/linux/ifreq#ifr_ifru.: libcrust-analyzer cargo libc 0.2.152 crate/::__c_anonymous_ifr_ifrurust-analyzer cargo libc 0.2.152 unix/linux_like/linux/__c_anonymous_ifr_ifru# { |
| 62 | ifru_datarust-analyzer cargo libc 0.2.152 unix/linux_like/linux/__c_anonymous_ifr_ifru#ifru_data.: (&mut tstamp_config as *mut _) as *mut libcrust-analyzer cargo libc 0.2.152 crate/::c_charrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/gnu/b64/x86_64/c_char#, |
| 63 | }, |
| 64 | }; |
| 65 | |
| 66 | // Safety: |
| 67 | // ifreq lives for the duration of the call, ioctl is safe to call otherwise |
| 68 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { libcrust-analyzer cargo libc 0.2.152 crate/::ioctlrust-analyzer cargo libc 0.2.152 ioctl().(self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., libcrust-analyzer cargo libc 0.2.152 crate/::SIOCSHWTSTAMPrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/SIOCSHWTSTAMP. as _, &mut ifreq) })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 69 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 70 | } |
| 71 | |
| 72 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn bind_to_devicerust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]bind_to_device().(&self, interface_name: InterfaceNamerust-analyzer cargo timestamped-socket 0.2.2 interface/InterfaceName#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 73 | let value = interface_name.as_strrust-analyzer cargo timestamped-socket 0.2.2 interface/impl#[InterfaceName]as_str().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); |
| 74 | let len = value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(); |
| 75 | |
| 76 | // Safety: |
| 77 | // value lives for the duration of the call, and is of size len. |
| 78 | // setsockopt is safe to call in all other regards |
| 79 | unsafe { |
| 80 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 81 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 82 | libcrust-analyzer cargo libc 0.2.152 crate/::SOL_SOCKETrust-analyzer cargo libc 0.2.152 unix/linux_like/linux/arch/generic/SOL_SOCKET., |
| 83 | libcrust-analyzer cargo libc 0.2.152 crate/::SO_BINDTODEVICErust-analyzer cargo libc 0.2.152 unix/linux_like/linux/arch/generic/SO_BINDTODEVICE., |
| 84 | value.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().(), |
| 85 | len as libcrust-analyzer cargo libc 0.2.152 crate/::socklen_trust-analyzer cargo libc 0.2.152 unix/linux_like/linux/socklen_t#, |
| 86 | ))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 87 | } |
| 88 | |
| 89 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 90 | } |
| 91 | |
| 92 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn ip_multicast_ifrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]ip_multicast_if().(&self, interface_name: InterfaceNamerust-analyzer cargo timestamped-socket 0.2.2 interface/InterfaceName#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 93 | let request = libcrust-analyzer cargo libc 0.2.152 crate/::ip_mreqnrust-analyzer cargo libc 0.2.152 unix/linux_like/ip_mreqn# { |
| 94 | imr_multiaddrrust-analyzer cargo libc 0.2.152 unix/linux_like/ip_mreqn#imr_multiaddr.: libcrust-analyzer cargo libc 0.2.152 crate/::in_addrrust-analyzer cargo libc 0.2.152 unix/linux_like/in_addr# { |
| 95 | s_addrrust-analyzer cargo libc 0.2.152 unix/linux_like/in_addr#s_addr.: u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::UNSPECIFIEDrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]UNSPECIFIED..octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]octets().()), |
| 96 | }, |
| 97 | imr_addressrust-analyzer cargo libc 0.2.152 unix/linux_like/ip_mreqn#imr_address.: libcrust-analyzer cargo libc 0.2.152 crate/::in_addrrust-analyzer cargo libc 0.2.152 unix/linux_like/in_addr# { |
| 98 | s_addrrust-analyzer cargo libc 0.2.152 unix/linux_like/in_addr#s_addr.: u32::from_ne_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_ne_bytes().(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::UNSPECIFIEDrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]UNSPECIFIED..octetsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]octets().()), |
| 99 | }, |
| 100 | imr_ifindexrust-analyzer cargo libc 0.2.152 unix/linux_like/ip_mreqn#imr_ifindex.: interface_name |
| 101 | .get_indexrust-analyzer cargo timestamped-socket 0.2.2 interface/impl#[InterfaceName]get_index().() |
| 102 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidInputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidInput#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). as _, |
| 103 | }; |
| 104 | |
| 105 | // Safety: |
| 106 | // request lives for the duration of the call, and we pass its size |
| 107 | // as option_len. setsockopt is safe to call in all other regards |
| 108 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { |
| 109 | libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 110 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 111 | libcrust-analyzer cargo libc 0.2.152 crate/::IPPROTO_IPrust-analyzer cargo libc 0.2.152 unix/IPPROTO_IP., |
| 112 | libcrust-analyzer cargo libc 0.2.152 crate/::IP_MULTICAST_IFrust-analyzer cargo libc 0.2.152 unix/linux_like/IP_MULTICAST_IF., |
| 113 | &request as *const _ as *const _, |
| 114 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&request) as _, |
| 115 | ) |
| 116 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 117 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 118 | } |
| 119 | |
| 120 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn ipv6_multicast_ifrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]ipv6_multicast_if().(&self, interface_name: InterfaceNamerust-analyzer cargo timestamped-socket 0.2.2 interface/InterfaceName#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 121 | let index = interface_name |
| 122 | .get_indexrust-analyzer cargo timestamped-socket 0.2.2 interface/impl#[InterfaceName]get_index().() |
| 123 | .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidInputrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidInput#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 124 | |
| 125 | // Safety: |
| 126 | // index lives for the duration of the call, and we pass its size |
| 127 | // as option_len. setsockopt is safe to call in all other regards |
| 128 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { |
| 129 | libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 130 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 131 | libcrust-analyzer cargo libc 0.2.152 crate/::IPPROTO_IPV6rust-analyzer cargo libc 0.2.152 unix/IPPROTO_IPV6., |
| 132 | libcrust-analyzer cargo libc 0.2.152 crate/::IPV6_MULTICAST_IFrust-analyzer cargo libc 0.2.152 unix/linux_like/IPV6_MULTICAST_IF., |
| 133 | &index as *const _ as *const _, |
| 134 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&index) as _, |
| 135 | ) |
| 136 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 137 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 138 | } |
| 139 | |
| 140 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn ip_multicast_looprust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]ip_multicast_loop().(&self, enabled: bool) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 141 | let state: i32 = if enabled { 1 } else { 0 }; |
| 142 | |
| 143 | // Safety: |
| 144 | // state lives for the duration of the call, and we pass its size |
| 145 | // as option_len. setsockopt is safe to call in all other regards. |
| 146 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { |
| 147 | libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 148 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 149 | libcrust-analyzer cargo libc 0.2.152 crate/::IPPROTO_IPrust-analyzer cargo libc 0.2.152 unix/IPPROTO_IP., |
| 150 | libcrust-analyzer cargo libc 0.2.152 crate/::IP_MULTICAST_LOOPrust-analyzer cargo libc 0.2.152 unix/linux_like/IP_MULTICAST_LOOP., |
| 151 | &state as *const _ as *const _, |
| 152 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&state) as _, |
| 153 | ) |
| 154 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 155 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 156 | } |
| 157 | |
| 158 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn ipv6_multicast_looprust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]ipv6_multicast_loop().(&self, enabled: bool) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 159 | let state: i32 = if enabled { 1 } else { 0 }; |
| 160 | |
| 161 | // Safety: |
| 162 | // state lives for the duration of the call, and we pass its size |
| 163 | // as option_len. setsockopt is safe to call in all other regards. |
| 164 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { |
| 165 | libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 166 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 167 | libcrust-analyzer cargo libc 0.2.152 crate/::IPPROTO_IPV6rust-analyzer cargo libc 0.2.152 unix/IPPROTO_IPV6., |
| 168 | libcrust-analyzer cargo libc 0.2.152 crate/::IPV6_MULTICAST_LOOPrust-analyzer cargo libc 0.2.152 unix/linux_like/IPV6_MULTICAST_LOOP., |
| 169 | &state as *const _ as *const _, |
| 170 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&state) as _, |
| 171 | ) |
| 172 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 173 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 174 | } |
| 175 | |
| 176 | pub(craterust-analyzer cargo timestamped-socket 0.2.2 crate/) fn ipv6_v6onlyrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/linux/impl#[RawSocket]ipv6_v6only().(&self, enabled: bool) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 177 | let state: i32 = if enabled { 1 } else { 0 }; |
| 178 | |
| 179 | // Safety: |
| 180 | // state lives for the duration of the call, and we pass its size |
| 181 | // as option_len. setsockopt is safe to call in all other regards. |
| 182 | cerrrust-analyzer cargo timestamped-socket 0.2.2 cerr().(unsafe { |
| 183 | libcrust-analyzer cargo libc 0.2.152 crate/::setsockoptrust-analyzer cargo libc 0.2.152 setsockopt().( |
| 184 | self.fdrust-analyzer cargo timestamped-socket 0.2.2 raw_socket/RawSocket#fd., |
| 185 | libcrust-analyzer cargo libc 0.2.152 crate/::IPPROTO_IPV6rust-analyzer cargo libc 0.2.152 unix/IPPROTO_IPV6., |
| 186 | libcrust-analyzer cargo libc 0.2.152 crate/::IPV6_V6ONLYrust-analyzer cargo libc 0.2.152 unix/linux_like/IPV6_V6ONLY., |
| 187 | &state as *const _ as *const _, |
| 188 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_of_valrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of_val().(&state) as _, |
| 189 | ) |
| 190 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 191 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 192 | } |
| 193 | } |