Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 5881f90

Browse files
author
Rusty Rain
authored
Merge pull request #11 from jelmansouri-legion/update_deps
Update dependencies
2 parents baadd26 + 4bd1486 commit 5881f90

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ thiserror = "1.0.29"
3131
anyhow = "1.0.44"
3232

3333
[target.'cfg(not(windows))'.dependencies]
34-
nix = "0.22"
34+
nix = "0.23"
3535
libc = "0.2.8"
3636

3737
[target.'cfg(windows)'.dependencies]
3838
bitflags = "1.2.1"
39-
winapi = "0.2.8"
39+
winapi = { version = "0.3.9", features = [
40+
"basetsd",
41+
"guiddef",
42+
"ws2def",
43+
"winerror",
44+
"ws2ipdef",
45+
] }
4046

4147
[build-dependencies]
4248
cc = "1.0.70"

src/ifaces/ffi/windows/mod.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#![allow(unused, non_upper_case_globals)]
22

3-
use winapi::basetsd::{UINT32, UINT8, ULONG64};
4-
use winapi::guiddef::GUID;
5-
use winapi::minwindef::{BYTE, DWORD, PULONG, ULONG};
6-
use winapi::winnt::{PCHAR, PVOID, PWCHAR, WCHAR};
7-
use winapi::ws2def::SOCKET_ADDRESS;
3+
use winapi::shared::basetsd::{UINT32, UINT8, ULONG64};
4+
use winapi::shared::guiddef::GUID;
5+
use winapi::shared::minwindef::{BYTE, DWORD, PULONG, ULONG};
6+
use winapi::shared::ws2def::SOCKET_ADDRESS;
7+
use winapi::um::winnt::{PCHAR, PVOID, PWCHAR, WCHAR};
88

99
const MAX_ADAPTER_ADDRESS_LENGTH: usize = 8;
1010
const ZONE_INDICES_LENGTH: usize = 16;
@@ -19,12 +19,12 @@ use std::mem;
1919
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
2020
use std::ptr;
2121

22-
use winapi::winerror::{
22+
use winapi::shared::winerror::{
2323
ERROR_ADDRESS_NOT_ASSOCIATED, ERROR_BUFFER_OVERFLOW, ERROR_INVALID_PARAMETER,
2424
ERROR_NOT_ENOUGH_MEMORY, ERROR_NO_DATA, ERROR_SUCCESS,
2525
};
26-
use winapi::ws2def::{AF_INET, AF_INET6, AF_UNSPEC, SOCKADDR_IN};
27-
use winapi::ws2ipdef::sockaddr_in6;
26+
use winapi::shared::ws2def::{AF_INET, AF_INET6, AF_UNSPEC, SOCKADDR_IN};
27+
use winapi::shared::ws2ipdef::SOCKADDR_IN6;
2828

2929
const PREALLOC_ADAPTERS_LEN: usize = 15 * 1024;
3030

@@ -251,10 +251,10 @@ unsafe fn v4_socket_from_adapter(unicast_addr: &IpAdapterUnicastAddress) -> Sock
251251
let sin_addr = in_addr.sin_addr.S_un;
252252

253253
let v4_addr = Ipv4Addr::new(
254-
sin_addr as u8,
255-
(sin_addr >> 8) as u8,
256-
(sin_addr >> 16) as u8,
257-
(sin_addr >> 24) as u8,
254+
*sin_addr.S_addr() as u8,
255+
(*sin_addr.S_addr() >> 8) as u8,
256+
(*sin_addr.S_addr() >> 16) as u8,
257+
(*sin_addr.S_addr() >> 24) as u8,
258258
);
259259

260260
SocketAddrV4::new(v4_addr, 0)
@@ -263,12 +263,17 @@ unsafe fn v4_socket_from_adapter(unicast_addr: &IpAdapterUnicastAddress) -> Sock
263263
unsafe fn v6_socket_from_adapter(unicast_addr: &IpAdapterUnicastAddress) -> SocketAddrV6 {
264264
let socket_addr = &unicast_addr.address;
265265

266-
let sock_addr6: *const sockaddr_in6 = socket_addr.lpSockaddr as *const winapi::sockaddr_in6;
267-
let in6_addr: sockaddr_in6 = *sock_addr6;
266+
let sock_addr6: *const SOCKADDR_IN6 = socket_addr.lpSockaddr as *const SOCKADDR_IN6;
267+
let in6_addr: SOCKADDR_IN6 = *sock_addr6;
268268

269-
let v6_addr = in6_addr.sin6_addr.s6_addr.into();
269+
let v6_addr = (*in6_addr.sin6_addr.u.Word()).into();
270270

271-
SocketAddrV6::new(v6_addr, 0, in6_addr.sin6_flowinfo, in6_addr.sin6_scope_id)
271+
SocketAddrV6::new(
272+
v6_addr,
273+
0,
274+
in6_addr.sin6_flowinfo,
275+
*in6_addr.u.sin6_scope_id(),
276+
)
272277
}
273278

274279
unsafe fn local_ifaces_with_buffer(buffer: &mut Vec<u8>) -> io::Result<()> {

0 commit comments

Comments
 (0)