Skip to content

Commit c40cc5c

Browse files
committed
refactor(core): move syscall_ip_helper and syscall_threading macros to windows.rs
1 parent e05fd91 commit c40cc5c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

crates/trippy-core/src/net/platform/windows.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,6 @@ macro_rules! syscall {
3737
}};
3838
}
3939

40-
/// Execute a `Win32::NetworkManagement::IpHelper` syscall.
41-
///
42-
/// The raw result of the syscall is returned.
43-
macro_rules! syscall_ip_helper {
44-
($fn: ident ( $($arg: expr),* $(,)* )) => {{
45-
#[allow(unsafe_code)]
46-
unsafe { windows_sys::Win32::NetworkManagement::IpHelper::$fn($($arg, )*) }
47-
}};
48-
}
49-
50-
/// Execute a `Win32::System::Threading` syscall.
51-
///
52-
/// The raw result of the syscall is returned.
53-
macro_rules! syscall_threading {
54-
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
55-
#[allow(unsafe_code)]
56-
unsafe { windows_sys::Win32::System::Threading::$fn($($arg, )*) }
57-
}};
58-
}
59-
6040
mod address {
6141
use crate::error::{IoError, IoOperation};
6242
use crate::net::socket::Socket;
@@ -73,6 +53,16 @@ mod address {
7353
SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKADDR_STORAGE, SOCKET_ERROR,
7454
};
7555

56+
/// Execute a `Win32::NetworkManagement::IpHelper` syscall.
57+
///
58+
/// The raw result of the syscall is returned.
59+
macro_rules! syscall_ip_helper {
60+
($fn: ident ( $($arg: expr),* $(,)* )) => {{
61+
#[allow(unsafe_code)]
62+
unsafe { windows_sys::Win32::NetworkManagement::IpHelper::$fn($($arg, )*) }
63+
}};
64+
}
65+
7666
/// NOTE under Windows, we cannot use a bind connect/getsockname as "If the socket
7767
/// is using a connectionless protocol, the address may not be available until I/O
7868
/// occurs on the socket." We use `SIO_ROUTING_INTERFACE_QUERY` instead.
@@ -381,6 +371,16 @@ mod socket {
381371
};
382372
use windows_sys::Win32::System::IO::OVERLAPPED;
383373

374+
/// Execute a `Win32::System::Threading` syscall.
375+
///
376+
/// The raw result of the syscall is returned.
377+
macro_rules! syscall_threading {
378+
($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
379+
#[allow(unsafe_code)]
380+
unsafe { windows_sys::Win32::System::Threading::$fn($($arg, )*) }
381+
}};
382+
}
383+
384384
#[instrument(level = "trace")]
385385
pub fn startup() -> crate::error::Result<()> {
386386
SocketImpl::startup().map_err(Error::IoError)

0 commit comments

Comments
 (0)