From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/winapi/src/shared/udpmib.rs | 130 +++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 vendor/winapi/src/shared/udpmib.rs (limited to 'vendor/winapi/src/shared/udpmib.rs') diff --git a/vendor/winapi/src/shared/udpmib.rs b/vendor/winapi/src/shared/udpmib.rs new file mode 100644 index 0000000..e5a73a2 --- /dev/null +++ b/vendor/winapi/src/shared/udpmib.rs @@ -0,0 +1,130 @@ +// Licensed under the Apache License, Version 2.0 +// or the MIT license +// , at your option. +// All files in the project carrying such notice may not be copied, modified, or distributed +// except according to those terms. +//! Contains the public definitions and structures for the UDP-specific parts of MIB-II +// #include +use shared::basetsd::DWORD64; +use shared::in6addr::IN6_ADDR; +use shared::minwindef::DWORD; +use shared::ntdef::{INT, LARGE_INTEGER, UCHAR, ULONGLONG}; +const ANY_SIZE: usize = 1; +pub const TCPIP_OWNING_MODULE_SIZE: usize = 16; +STRUCT!{struct MIB_UDPROW { + dwLocalAddr: DWORD, + dwLocalPort: DWORD, +}} +pub type PMIB_UDPROW = *mut MIB_UDPROW; +STRUCT!{struct MIB_UDPTABLE { + dwNumEntries: DWORD, + table: [MIB_UDPROW; ANY_SIZE], +}} +pub type PMIB_UDPTABLE = *mut MIB_UDPTABLE; +// FIXME: SIZEOF_UDPTABLE(x) +STRUCT!{struct MIB_UDPROW_OWNER_PID { + dwLocalAddr: DWORD, + dwLocalPort: DWORD, + dwOwningPid: DWORD, +}} +pub type PMIB_UDPROW_OWNER_PID = *mut MIB_UDPROW_OWNER_PID; +STRUCT!{struct MIB_UDPTABLE_OWNER_PID { + dwNumEntries: DWORD, + table: [MIB_UDPROW_OWNER_PID; ANY_SIZE], +}} +pub type PMIB_UDPTABLE_OWNER_PID = *mut MIB_UDPTABLE_OWNER_PID; +// FIXME: SIZEOF_UDPTABLE_OWNER_PID(x) +STRUCT!{struct MIB_UDPROW_OWNER_MODULE_u_s { + bitfield: INT, +}} +BITFIELD!{MIB_UDPROW_OWNER_MODULE_u_s bitfield: INT [ + SpecificPortBind set_SpecificPortBind[0..1], +]} +UNION!{union MIB_UDPROW_OWNER_MODULE_u { + [i32; 1], + s s_mut: MIB_UDPROW_OWNER_MODULE_u_s, + dwFlags dwFlags_mut: INT, +}} +STRUCT!{struct MIB_UDPROW_OWNER_MODULE { + dwLocalAddr: DWORD, + dwLocalPort: DWORD, + dwOwningPid: DWORD, + liCreateTimestamp: LARGE_INTEGER, + u: MIB_UDPROW_OWNER_MODULE_u, + OwningModuleInfo: [ULONGLONG; TCPIP_OWNING_MODULE_SIZE], +}} +pub type PMIB_UDPROW_OWNER_MODULE = *mut MIB_UDPROW_OWNER_MODULE; +STRUCT!{struct MIB_UDPTABLE_OWNER_MODULE { + dwNumEntries: DWORD, + table: [MIB_UDPROW_OWNER_MODULE; ANY_SIZE], +}} +pub type PMIB_UDPTABLE_OWNER_MODULE = *mut MIB_UDPTABLE_OWNER_MODULE; +// FIXME: SIZEOF_UDPTABLE_OWNER_MODULE(x) +STRUCT!{struct MIB_UDP6ROW { + dwLocalAddr: IN6_ADDR, + dwLocalScopeId: DWORD, + dwLocalPort: DWORD, +}} +pub type PMIB_UDP6ROW = *mut MIB_UDP6ROW; +STRUCT!{struct MIB_UDP6TABLE { + dwNumEntries: DWORD, + table: [MIB_UDP6ROW; ANY_SIZE], +}} +pub type PMIB_UDP6TABLE = *mut MIB_UDP6TABLE; +// FIXME: SIZEOF_UDP6TABLE(x) +STRUCT!{struct MIB_UDP6ROW_OWNER_PID { + ucLocalAddr: [UCHAR; 16], + dwLocalScopeId: DWORD, + dwLocalPort: DWORD, + dwOwningPid: DWORD, +}} +pub type PMIB_UDP6ROW_OWNER_PID = *mut MIB_UDP6ROW_OWNER_PID; +STRUCT!{struct MIB_UDP6TABLE_OWNER_PID { + dwNumEntries: DWORD, + table: [MIB_UDP6ROW_OWNER_PID; ANY_SIZE], +}} +pub type PMIB_UDP6TABLE_OWNER_PID = *mut MIB_UDP6TABLE_OWNER_PID; +// FIXME: SIZEOF_UDP6TABLE_OWNER_PID(x) +STRUCT!{struct MIB_UDP6ROW_OWNER_MODULE_u_s { + bitfield: INT, +}} +BITFIELD!{MIB_UDP6ROW_OWNER_MODULE_u_s bitfield: INT [ + SpecificPortBind set_SpecificPortBind[0..1], +]} +UNION!{union MIB_UDP6ROW_OWNER_MODULE_u { + [i32; 1], + s s_mut: INT, + dwFlags dwFlags_mut: INT, +}} +STRUCT!{struct MIB_UDP6ROW_OWNER_MODULE { + ucLocalAddr: [UCHAR; 16], + dwLocalScopeId: DWORD, + dwLocalPort: DWORD, + dwOwningPid: DWORD, + liCreateTimestamp: LARGE_INTEGER, + u: MIB_UDP6ROW_OWNER_MODULE_u, + OwningModuleInfo: [ULONGLONG; TCPIP_OWNING_MODULE_SIZE], +}} +pub type PMIB_UDP6ROW_OWNER_MODULE = *mut MIB_UDP6ROW_OWNER_MODULE; +STRUCT!{struct MIB_UDP6TABLE_OWNER_MODULE { + dwNumEntries: DWORD, + table: [MIB_UDP6ROW_OWNER_MODULE; ANY_SIZE], +}} +pub type PMIB_UDP6TABLE_OWNER_MODULE = *mut MIB_UDP6TABLE_OWNER_MODULE; +// FIXME: SIZEOF_UDP6TABLE_OWNER_MODULE(x) +STRUCT!{struct MIB_UDPSTATS { + dwInDatagrams: DWORD, + dwNoPorts: DWORD, + dwInErrors: DWORD, + dwOutDatagrams: DWORD, + dwNumAddrs: DWORD, +}} +pub type PMIB_UDPSTATS = *mut MIB_UDPSTATS; +STRUCT!{struct MIB_UDPSTATS2 { + dw64InDatagrams: DWORD64, + dwNoPorts: DWORD, + dwInErrors: DWORD, + dw64OutDatagrams: DWORD64, + dwNumAddrs: DWORD, +}} +pub type PMIB_UDPSTATS2 = *mut MIB_UDPSTATS2; -- cgit v1.2.3