Skip to content

Commit 15c6a98

Browse files
committed
A few more things
Signed-off-by: Peter Atashian <[email protected]>
1 parent 20e8817 commit 15c6a98

File tree

3 files changed

+77
-12
lines changed

3 files changed

+77
-12
lines changed

src/inaddr.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License <LICENSE.md>
33
//! IPv4 Internet address
44
#[repr(C)] #[derive(Clone, Copy, Debug)]
5-
pub struct in_addr(pub ::ULONG);
6-
pub type IN_ADDR = in_addr;
7-
pub type PIN_ADDR = *mut in_addr;
8-
pub type LPIN_ADDR = *mut in_addr;
5+
pub struct IN_ADDR(pub ::ULONG);
6+
pub type PIN_ADDR = *mut IN_ADDR;
7+
pub type LPIN_ADDR = *mut IN_ADDR;

src/winsock2.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ pub struct fd_set {
1616
pub fd_count: u_int,
1717
pub fd_array: [SOCKET; FD_SETSIZE],
1818
}
19-
impl Clone for fd_set {
20-
fn clone(&self) -> fd_set { *self }
21-
}
19+
impl Clone for fd_set { fn clone(&self) -> fd_set { *self } }
2220
#[repr(C)] #[derive(Clone, Copy, Debug)]
2321
pub struct timeval {
2422
pub tv_sec: ::c_long,

src/ws2def.rs

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,12 @@ pub const SO_PORT_SCALABILITY: ::c_int = 0x3006;
7676
pub const WSK_SO_BASE: ::c_int = 0x4000;
7777
pub const TCP_NODELAY: ::c_int = 0x0001;
7878
#[repr(C)] #[derive(Clone, Copy, Debug)]
79-
pub struct sockaddr {
79+
pub struct SOCKADDR {
8080
pub sa_family: ADDRESS_FAMILY,
8181
pub sa_data: [::CHAR; 14],
8282
}
83-
pub type SOCKADDR = sockaddr;
84-
pub type PSOCKADDR = *mut sockaddr;
85-
pub type LPSOCKADDR = *mut sockaddr;
83+
pub type PSOCKADDR = *mut SOCKADDR;
84+
pub type LPSOCKADDR = *mut SOCKADDR;
8685
#[repr(C)] #[derive(Clone, Copy, Debug)]
8786
pub struct SOCKET_ADDRESS {
8887
pub lpSockaddr: LPSOCKADDR,
@@ -105,4 +104,73 @@ pub struct CSADDR_INFO {
105104
pub iProtocol: ::INT,
106105
}
107106
pub type PCSADDR_INFO = *mut CSADDR_INFO;
108-
pub type LPCSADDR_INFO = *mut CSADDR_INFO;
107+
pub type LPCSADDR_INFO = *mut CSADDR_INFO;
108+
#[repr(C)] #[derive(Copy)]
109+
pub struct SOCKADDR_STORAGE_LH {
110+
ss_family: ADDRESS_FAMILY,
111+
__ss_pad1: [::CHAR; 6],
112+
__ss_align: ::__int64,
113+
__ss_pad2: [::CHAR; 112],
114+
}
115+
impl Clone for SOCKADDR_STORAGE_LH { fn clone(&self) -> SOCKADDR_STORAGE_LH { *self } }
116+
pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH;
117+
pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH;
118+
#[repr(C)] #[derive(Copy)]
119+
pub struct SOCKADDR_STORAGE_XP {
120+
ss_family: ::c_short,
121+
__ss_pad1: [::CHAR; 6],
122+
__ss_align: ::__int64,
123+
__ss_pad2: [::CHAR; 112],
124+
}
125+
impl Clone for SOCKADDR_STORAGE_XP { fn clone(&self) -> SOCKADDR_STORAGE_XP { *self } }
126+
pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP;
127+
pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP;
128+
pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH;
129+
pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE;
130+
pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE;
131+
#[repr(C)] #[derive(Clone, Copy, Debug)]
132+
pub struct SOCKET_PROCESSOR_AFFINITY {
133+
Processor: ::PROCESSOR_NUMBER,
134+
NumaNodeId: ::USHORT,
135+
Reserved: ::USHORT,
136+
}
137+
pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY;
138+
pub const IOC_UNIX: ::DWORD = 0x00000000;
139+
pub const IOC_WS2: ::DWORD = 0x08000000;
140+
pub const IOC_PROTOCOL: ::DWORD = 0x10000000;
141+
pub const IOC_VENDOR: ::DWORD = 0x18000000;
142+
pub const IOC_WSK: ::DWORD = IOC_WS2 | 0x07000000;
143+
macro_rules! _WSAIO { ($x:expr, $y:expr) => { IOC_VOID | $x | $y } }
144+
macro_rules! _WSAIOR { ($x:expr, $y:expr) => { IOC_OUT | $x | $y } }
145+
macro_rules! _WSAIOW { ($x:expr, $y:expr) => { IOC_IN | $x | $y } }
146+
macro_rules! _WSAIORW { ($x:expr, $y:expr) => { IOC_INOUT | $x | $y } }
147+
pub const SIO_ASSOCIATE_HANDLE: ::DWORD = _WSAIOW!(IOC_WS2, 1);
148+
pub const SIO_ENABLE_CIRCULAR_QUEUEING: ::DWORD = _WSAIO!(IOC_WS2, 2);
149+
pub const SIO_FIND_ROUTE: ::DWORD = _WSAIOR!(IOC_WS2, 3);
150+
pub const SIO_FLUSH: ::DWORD = _WSAIO!(IOC_WS2, 4);
151+
pub const SIO_GET_BROADCAST_ADDRESS: ::DWORD = _WSAIOR!(IOC_WS2, 5);
152+
pub const SIO_GET_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 6);
153+
pub const SIO_GET_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 7);
154+
pub const SIO_GET_GROUP_QOS: ::DWORD = _WSAIORW!(IOC_WS2, 8);
155+
pub const SIO_MULTIPOINT_LOOPBACK: ::DWORD = _WSAIOW!(IOC_WS2, 9);
156+
pub const SIO_MULTICAST_SCOPE: ::DWORD = _WSAIOW!(IOC_WS2, 10);
157+
pub const SIO_SET_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 11);
158+
pub const SIO_SET_GROUP_QOS: ::DWORD = _WSAIOW!(IOC_WS2, 12);
159+
pub const SIO_TRANSLATE_HANDLE: ::DWORD = _WSAIORW!(IOC_WS2, 13);
160+
pub const SIO_ROUTING_INTERFACE_QUERY: ::DWORD = _WSAIORW!(IOC_WS2, 20);
161+
pub const SIO_ROUTING_INTERFACE_CHANGE: ::DWORD = _WSAIOW!(IOC_WS2, 21);
162+
pub const SIO_ADDRESS_LIST_QUERY: ::DWORD = _WSAIOR!(IOC_WS2, 22);
163+
pub const SIO_ADDRESS_LIST_CHANGE: ::DWORD = _WSAIO!(IOC_WS2, 23);
164+
pub const SIO_QUERY_TARGET_PNP_HANDLE: ::DWORD = _WSAIOR!(IOC_WS2, 24);
165+
pub const SIO_QUERY_RSS_PROCESSOR_INFO: ::DWORD = _WSAIOR!(IOC_WS2, 37);
166+
pub const SIO_ADDRESS_LIST_SORT: ::DWORD = _WSAIORW!(IOC_WS2, 25);
167+
pub const SIO_RESERVED_1: ::DWORD = _WSAIOW!(IOC_WS2, 26);
168+
pub const SIO_RESERVED_2: ::DWORD = _WSAIOW!(IOC_WS2, 33);
169+
pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: ::DWORD = _WSAIORW!(IOC_WS2, 36);
170+
171+
//645
172+
pub const IOCPARM_MASK: ::DWORD = 0x7f;
173+
pub const IOC_VOID: ::DWORD = 0x20000000;
174+
pub const IOC_OUT: ::DWORD = 0x40000000;
175+
pub const IOC_IN: ::DWORD = 0x80000000;
176+
pub const IOC_INOUT: ::DWORD = IOC_IN | IOC_OUT;

0 commit comments

Comments
 (0)