| 1 |
// Licensed under the Apache License, Version 2.0 |
| 2 |
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. |
| 4 |
// All files in the project carrying such notice may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
//! Core definitions for the Winsock2 specification |
| 7 |
use ctypes::{__int64, c_char, c_int, c_long, c_short, c_void}; |
| 8 |
use shared::basetsd::SIZE_T; |
| 9 |
use shared::guiddef::LPGUID; |
| 10 |
use shared::inaddr::IN_ADDR; |
| 11 |
use shared::minwindef::{DWORD, INT, UCHAR, ULONG, USHORT}; |
| 12 |
use um::winnt::{CHAR, HANDLE, LONG, PROCESSOR_NUMBER, PWSTR}; |
| 13 |
use vc::vcruntime::size_t; |
| 14 |
pub type ADDRESS_FAMILY = USHORT; |
| 15 |
pub const AF_UNSPEC: c_int = 0; |
| 16 |
pub const AF_UNIX: c_int = 1; |
| 17 |
pub const AF_INET: c_int = 2; |
| 18 |
pub const AF_IMPLINK: c_int = 3; |
| 19 |
pub const AF_PUP: c_int = 4; |
| 20 |
pub const AF_CHAOS: c_int = 5; |
| 21 |
pub const AF_NS: c_int = 6; |
| 22 |
pub const AF_IPX: c_int = AF_NS; |
| 23 |
pub const AF_ISO: c_int = 7; |
| 24 |
pub const AF_OSI: c_int = AF_ISO; |
| 25 |
pub const AF_ECMA: c_int = 8; |
| 26 |
pub const AF_DATAKIT: c_int = 9; |
| 27 |
pub const AF_CCITT: c_int = 10; |
| 28 |
pub const AF_SNA: c_int = 11; |
| 29 |
pub const AF_DECnet: c_int = 12; |
| 30 |
pub const AF_DLI: c_int = 13; |
| 31 |
pub const AF_LAT: c_int = 14; |
| 32 |
pub const AF_HYLINK: c_int = 15; |
| 33 |
pub const AF_APPLETALK: c_int = 16; |
| 34 |
pub const AF_NETBIOS: c_int = 17; |
| 35 |
pub const AF_VOICEVIEW: c_int = 18; |
| 36 |
pub const AF_FIREFOX: c_int = 19; |
| 37 |
pub const AF_UNKNOWN1: c_int = 20; |
| 38 |
pub const AF_BAN: c_int = 21; |
| 39 |
pub const AF_ATM: c_int = 22; |
| 40 |
pub const AF_INET6: c_int = 23; |
| 41 |
pub const AF_CLUSTER: c_int = 24; |
| 42 |
pub const AF_12844: c_int = 25; |
| 43 |
pub const AF_IRDA: c_int = 26; |
| 44 |
pub const AF_NETDES: c_int = 28; |
| 45 |
pub const AF_TCNPROCESS: c_int = 29; |
| 46 |
pub const AF_TCNMESSAGE: c_int = 30; |
| 47 |
pub const AF_ICLFXBM: c_int = 31; |
| 48 |
pub const AF_BTH: c_int = 32; |
| 49 |
pub const AF_LINK: c_int = 33; |
| 50 |
pub const AF_HYPERV: c_int = 34; |
| 51 |
pub const AF_MAX: c_int = 35; |
| 52 |
pub const SOCK_STREAM: c_int = 1; |
| 53 |
pub const SOCK_DGRAM: c_int = 2; |
| 54 |
pub const SOCK_RAW: c_int = 3; |
| 55 |
pub const SOCK_RDM: c_int = 4; |
| 56 |
pub const SOCK_SEQPACKET: c_int = 5; |
| 57 |
pub const SOL_SOCKET: c_int = 0xffff; |
| 58 |
pub const SO_DEBUG: c_int = 0x0001; |
| 59 |
pub const SO_ACCEPTCONN: c_int = 0x0002; |
| 60 |
pub const SO_REUSEADDR: c_int = 0x0004; |
| 61 |
pub const SO_KEEPALIVE: c_int = 0x0008; |
| 62 |
pub const SO_DONTROUTE: c_int = 0x0010; |
| 63 |
pub const SO_BROADCAST: c_int = 0x0020; |
| 64 |
pub const SO_USELOOPBACK: c_int = 0x0040; |
| 65 |
pub const SO_LINGER: c_int = 0x0080; |
| 66 |
pub const SO_OOBINLINE: c_int = 0x0100; |
| 67 |
pub const SO_DONTLINGER: c_int = !SO_LINGER; |
| 68 |
pub const SO_EXCLUSIVEADDRUSE: c_int = !SO_REUSEADDR; |
| 69 |
pub const SO_SNDBUF: c_int = 0x1001; |
| 70 |
pub const SO_RCVBUF: c_int = 0x1002; |
| 71 |
pub const SO_SNDLOWAT: c_int = 0x1003; |
| 72 |
pub const SO_RCVLOWAT: c_int = 0x1004; |
| 73 |
pub const SO_SNDTIMEO: c_int = 0x1005; |
| 74 |
pub const SO_RCVTIMEO: c_int = 0x1006; |
| 75 |
pub const SO_ERROR: c_int = 0x1007; |
| 76 |
pub const SO_TYPE: c_int = 0x1008; |
| 77 |
pub const SO_BSP_STATE: c_int = 0x1009; |
| 78 |
pub const SO_GROUP_ID: c_int = 0x2001; |
| 79 |
pub const SO_GROUP_PRIORITY: c_int = 0x2002; |
| 80 |
pub const SO_MAX_MSG_SIZE: c_int = 0x2003; |
| 81 |
pub const SO_CONDITIONAL_ACCEPT: c_int = 0x3002; |
| 82 |
pub const SO_PAUSE_ACCEPT: c_int = 0x3003; |
| 83 |
pub const SO_COMPARTMENT_ID: c_int = 0x3004; |
| 84 |
pub const SO_RANDOMIZE_PORT: c_int = 0x3005; |
| 85 |
pub const SO_PORT_SCALABILITY: c_int = 0x3006; |
| 86 |
pub const SO_REUSE_UNICASTPORT: c_int = 0x3007; |
| 87 |
pub const SO_REUSE_MULTICASTPORT: c_int = 0x3008; |
| 88 |
pub const WSK_SO_BASE: c_int = 0x4000; |
| 89 |
pub const TCP_NODELAY: c_int = 0x0001; |
| 90 |
STRUCT!{struct SOCKADDR { |
| 91 |
sa_family: ADDRESS_FAMILY, |
| 92 |
sa_data: [CHAR; 14], |
| 93 |
}} |
| 94 |
pub type PSOCKADDR = *mut SOCKADDR; |
| 95 |
pub type LPSOCKADDR = *mut SOCKADDR; |
| 96 |
STRUCT!{struct SOCKET_ADDRESS { |
| 97 |
lpSockaddr: LPSOCKADDR, |
| 98 |
iSockaddrLength: INT, |
| 99 |
}} |
| 100 |
pub type PSOCKET_ADDRESS = *mut SOCKET_ADDRESS; |
| 101 |
pub type LPSOCKET_ADDRESS = *mut SOCKET_ADDRESS; |
| 102 |
STRUCT!{struct SOCKET_ADDRESS_LIST { |
| 103 |
iAddressCount: INT, |
| 104 |
Address: [SOCKET_ADDRESS; 1], |
| 105 |
}} |
| 106 |
pub type PSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; |
| 107 |
pub type LPSOCKET_ADDRESS_LIST = *mut SOCKET_ADDRESS_LIST; |
| 108 |
STRUCT!{struct CSADDR_INFO { |
| 109 |
LocalAddr: SOCKET_ADDRESS, |
| 110 |
RemoteAddr: SOCKET_ADDRESS, |
| 111 |
iSocketType: INT, |
| 112 |
iProtocol: INT, |
| 113 |
}} |
| 114 |
pub type PCSADDR_INFO = *mut CSADDR_INFO; |
| 115 |
pub type LPCSADDR_INFO = *mut CSADDR_INFO; |
| 116 |
STRUCT!{struct SOCKADDR_STORAGE_LH { |
| 117 |
ss_family: ADDRESS_FAMILY, |
| 118 |
__ss_pad1: [CHAR; 6], |
| 119 |
__ss_align: __int64, |
| 120 |
__ss_pad2: [CHAR; 112], |
| 121 |
}} |
| 122 |
pub type PSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; |
| 123 |
pub type LPSOCKADDR_STORAGE_LH = *mut SOCKADDR_STORAGE_LH; |
| 124 |
STRUCT!{struct SOCKADDR_STORAGE_XP { |
| 125 |
ss_family: c_short, |
| 126 |
__ss_pad1: [CHAR; 6], |
| 127 |
__ss_align: __int64, |
| 128 |
__ss_pad2: [CHAR; 112], |
| 129 |
}} |
| 130 |
pub type PSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; |
| 131 |
pub type LPSOCKADDR_STORAGE_XP = *mut SOCKADDR_STORAGE_XP; |
| 132 |
pub type SOCKADDR_STORAGE = SOCKADDR_STORAGE_LH; |
| 133 |
pub type PSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; |
| 134 |
pub type LPSOCKADDR_STORAGE = *mut SOCKADDR_STORAGE; |
| 135 |
STRUCT!{struct SOCKET_PROCESSOR_AFFINITY { |
| 136 |
Processor: PROCESSOR_NUMBER, |
| 137 |
NumaNodeId: USHORT, |
| 138 |
Reserved: USHORT, |
| 139 |
}} |
| 140 |
pub type PSOCKET_PROCESSOR_AFFINITY = *mut SOCKET_PROCESSOR_AFFINITY; |
| 141 |
pub const IOC_UNIX: DWORD = 0x00000000; |
| 142 |
pub const IOC_WS2: DWORD = 0x08000000; |
| 143 |
pub const IOC_PROTOCOL: DWORD = 0x10000000; |
| 144 |
pub const IOC_VENDOR: DWORD = 0x18000000; |
| 145 |
pub const IOC_WSK: DWORD = IOC_WS2 | 0x07000000; |
| 146 |
pub const SIO_ASSOCIATE_HANDLE: DWORD = _WSAIOW!(IOC_WS2, 1); |
| 147 |
pub const SIO_ENABLE_CIRCULAR_QUEUEING: DWORD = _WSAIO!(IOC_WS2, 2); |
| 148 |
pub const SIO_FIND_ROUTE: DWORD = _WSAIOR!(IOC_WS2, 3); |
| 149 |
pub const SIO_FLUSH: DWORD = _WSAIO!(IOC_WS2, 4); |
| 150 |
pub const SIO_GET_BROADCAST_ADDRESS: DWORD = _WSAIOR!(IOC_WS2, 5); |
| 151 |
pub const SIO_GET_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 6); |
| 152 |
pub const SIO_GET_QOS: DWORD = _WSAIORW!(IOC_WS2, 7); |
| 153 |
pub const SIO_GET_GROUP_QOS: DWORD = _WSAIORW!(IOC_WS2, 8); |
| 154 |
pub const SIO_MULTIPOINT_LOOPBACK: DWORD = _WSAIOW!(IOC_WS2, 9); |
| 155 |
pub const SIO_MULTICAST_SCOPE: DWORD = _WSAIOW!(IOC_WS2, 10); |
| 156 |
pub const SIO_SET_QOS: DWORD = _WSAIOW!(IOC_WS2, 11); |
| 157 |
pub const SIO_SET_GROUP_QOS: DWORD = _WSAIOW!(IOC_WS2, 12); |
| 158 |
pub const SIO_TRANSLATE_HANDLE: DWORD = _WSAIORW!(IOC_WS2, 13); |
| 159 |
pub const SIO_ROUTING_INTERFACE_QUERY: DWORD = _WSAIORW!(IOC_WS2, 20); |
| 160 |
pub const SIO_ROUTING_INTERFACE_CHANGE: DWORD = _WSAIOW!(IOC_WS2, 21); |
| 161 |
pub const SIO_ADDRESS_LIST_QUERY: DWORD = _WSAIOR!(IOC_WS2, 22); |
| 162 |
pub const SIO_ADDRESS_LIST_CHANGE: DWORD = _WSAIO!(IOC_WS2, 23); |
| 163 |
pub const SIO_QUERY_TARGET_PNP_HANDLE: DWORD = _WSAIOR!(IOC_WS2, 24); |
| 164 |
pub const SIO_QUERY_RSS_PROCESSOR_INFO: DWORD = _WSAIOR!(IOC_WS2, 37); |
| 165 |
pub const SIO_ADDRESS_LIST_SORT: DWORD = _WSAIORW!(IOC_WS2, 25); |
| 166 |
pub const SIO_RESERVED_1: DWORD = _WSAIOW!(IOC_WS2, 26); |
| 167 |
pub const SIO_RESERVED_2: DWORD = _WSAIOW!(IOC_WS2, 33); |
| 168 |
pub const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER: DWORD = _WSAIORW!(IOC_WS2, 36); |
| 169 |
pub const IPPROTO_IP: c_int = 0; |
| 170 |
ENUM!{enum IPPROTO { |
| 171 |
IPPROTO_HOPOPTS = 0, // IPv6 Hop-by-Hop options |
| 172 |
IPPROTO_ICMP = 1, |
| 173 |
IPPROTO_IGMP = 2, |
| 174 |
IPPROTO_GGP = 3, |
| 175 |
IPPROTO_IPV4 = 4, |
| 176 |
IPPROTO_ST = 5, |
| 177 |
IPPROTO_TCP = 6, |
| 178 |
IPPROTO_CBT = 7, |
| 179 |
IPPROTO_EGP = 8, |
| 180 |
IPPROTO_IGP = 9, |
| 181 |
IPPROTO_PUP = 12, |
| 182 |
IPPROTO_UDP = 17, |
| 183 |
IPPROTO_IDP = 22, |
| 184 |
IPPROTO_RDP = 27, |
| 185 |
IPPROTO_IPV6 = 41, // IPv6 header |
| 186 |
IPPROTO_ROUTING = 43, // IPv6 Routing header |
| 187 |
IPPROTO_FRAGMENT = 44, // IPv6 fragmentation header |
| 188 |
IPPROTO_ESP = 50, // encapsulating security payload |
| 189 |
IPPROTO_AH = 51, // authentication header |
| 190 |
IPPROTO_ICMPV6 = 58, // ICMPv6 |
| 191 |
IPPROTO_NONE = 59, // IPv6 no next header |
| 192 |
IPPROTO_DSTOPTS = 60, // IPv6 Destination options |
| 193 |
IPPROTO_ND = 77, |
| 194 |
IPPROTO_ICLFXBM = 78, |
| 195 |
IPPROTO_PIM = 103, |
| 196 |
IPPROTO_PGM = 113, |
| 197 |
IPPROTO_L2TP = 115, |
| 198 |
IPPROTO_SCTP = 132, |
| 199 |
IPPROTO_RAW = 255, |
| 200 |
IPPROTO_MAX = 256, |
| 201 |
IPPROTO_RESERVED_RAW = 257, |
| 202 |
IPPROTO_RESERVED_IPSEC = 258, |
| 203 |
IPPROTO_RESERVED_IPSECOFFLOAD = 259, |
| 204 |
IPPROTO_RESERVED_WNV = 260, |
| 205 |
IPPROTO_RESERVED_MAX = 261, |
| 206 |
}} |
| 207 |
pub type PIPPROTO = *mut IPPROTO; |
| 208 |
pub const IPPORT_TCPMUX: USHORT = 1; |
| 209 |
pub const IPPORT_ECHO: USHORT = 7; |
| 210 |
pub const IPPORT_DISCARD: USHORT = 9; |
| 211 |
pub const IPPORT_SYSTAT: USHORT = 11; |
| 212 |
pub const IPPORT_DAYTIME: USHORT = 13; |
| 213 |
pub const IPPORT_NETSTAT: USHORT = 15; |
| 214 |
pub const IPPORT_QOTD: USHORT = 17; |
| 215 |
pub const IPPORT_MSP: USHORT = 18; |
| 216 |
pub const IPPORT_CHARGEN: USHORT = 19; |
| 217 |
pub const IPPORT_FTP_DATA: USHORT = 20; |
| 218 |
pub const IPPORT_FTP: USHORT = 21; |
| 219 |
pub const IPPORT_TELNET: USHORT = 23; |
| 220 |
pub const IPPORT_SMTP: USHORT = 25; |
| 221 |
pub const IPPORT_TIMESERVER: USHORT = 37; |
| 222 |
pub const IPPORT_NAMESERVER: USHORT = 42; |
| 223 |
pub const IPPORT_WHOIS: USHORT = 43; |
| 224 |
pub const IPPORT_MTP: USHORT = 57; |
| 225 |
pub const IPPORT_TFTP: USHORT = 69; |
| 226 |
pub const IPPORT_RJE: USHORT = 77; |
| 227 |
pub const IPPORT_FINGER: USHORT = 79; |
| 228 |
pub const IPPORT_TTYLINK: USHORT = 87; |
| 229 |
pub const IPPORT_SUPDUP: USHORT = 95; |
| 230 |
pub const IPPORT_POP3: USHORT = 110; |
| 231 |
pub const IPPORT_NTP: USHORT = 123; |
| 232 |
pub const IPPORT_EPMAP: USHORT = 135; |
| 233 |
pub const IPPORT_NETBIOS_NS: USHORT = 137; |
| 234 |
pub const IPPORT_NETBIOS_DGM: USHORT = 138; |
| 235 |
pub const IPPORT_NETBIOS_SSN: USHORT = 139; |
| 236 |
pub const IPPORT_IMAP: USHORT = 143; |
| 237 |
pub const IPPORT_SNMP: USHORT = 161; |
| 238 |
pub const IPPORT_SNMP_TRAP: USHORT = 162; |
| 239 |
pub const IPPORT_IMAP3: USHORT = 220; |
| 240 |
pub const IPPORT_LDAP: USHORT = 389; |
| 241 |
pub const IPPORT_HTTPS: USHORT = 443; |
| 242 |
pub const IPPORT_MICROSOFT_DS: USHORT = 445; |
| 243 |
pub const IPPORT_EXECSERVER: USHORT = 512; |
| 244 |
pub const IPPORT_LOGINSERVER: USHORT = 513; |
| 245 |
pub const IPPORT_CMDSERVER: USHORT = 514; |
| 246 |
pub const IPPORT_EFSSERVER: USHORT = 520; |
| 247 |
pub const IPPORT_BIFFUDP: USHORT = 512; |
| 248 |
pub const IPPORT_WHOSERVER: USHORT = 513; |
| 249 |
pub const IPPORT_ROUTESERVER: USHORT = 520; |
| 250 |
pub const IPPORT_RESERVED: USHORT = 1024; |
| 251 |
pub const IPPORT_REGISTERED_MIN: USHORT = IPPORT_RESERVED; |
| 252 |
pub const IPPORT_REGISTERED_MAX: USHORT = 0xbfff; |
| 253 |
pub const IPPORT_DYNAMIC_MIN: USHORT = 0xc000; |
| 254 |
pub const IPPORT_DYNAMIC_MAX: USHORT = 0xffff; |
| 255 |
#[inline] |
| 256 |
pub fn IN_CLASSA(i: LONG) -> bool { |
| 257 |
(i & 0x80000000) == 0 |
| 258 |
} |
| 259 |
pub const IN_CLASSA_NET: LONG = 0xff000000; |
| 260 |
pub const IN_CLASSA_NSHIFT: LONG = 24; |
| 261 |
pub const IN_CLASSA_HOST: LONG = 0x00ffffff; |
| 262 |
pub const IN_CLASSA_MAX: LONG = 128; |
| 263 |
#[inline] |
| 264 |
pub fn IN_CLASSB(i: LONG) -> bool { |
| 265 |
(i as u32 & 0xc0000000) == 0x80000000 |
| 266 |
} |
| 267 |
pub const IN_CLASSB_NET: LONG = 0xffff0000; |
| 268 |
pub const IN_CLASSB_NSHIFT: LONG = 16; |
| 269 |
pub const IN_CLASSB_HOST: LONG = 0x0000ffff; |
| 270 |
pub const IN_CLASSB_MAX: LONG = 65536; |
| 271 |
#[inline] |
| 272 |
pub fn IN_CLASSC(i: LONG) -> bool { |
| 273 |
(i as u32 & 0xe0000000) == 0xc0000000 |
| 274 |
} |
| 275 |
pub const IN_CLASSC_NET: LONG = 0xffffff00; |
| 276 |
pub const IN_CLASSC_NSHIFT: LONG = 8; |
| 277 |
pub const IN_CLASSC_HOST: LONG = 0x000000ff; |
| 278 |
#[inline] |
| 279 |
pub fn IN_CLASSD(i: c_long) -> bool { |
| 280 |
(i as u32 & 0xf0000000) == 0xe0000000 |
| 281 |
} |
| 282 |
pub const IN_CLASSD_NET: LONG = 0xf0000000; |
| 283 |
pub const IN_CLASSD_NSHIFT: LONG = 28; |
| 284 |
pub const IN_CLASSD_HOST: LONG = 0x0fffffff; |
| 285 |
#[inline] |
| 286 |
pub fn IN_MULTICAST(i: c_long) -> bool { |
| 287 |
IN_CLASSD(i) |
| 288 |
} |
| 289 |
pub const INADDR_ANY: ULONG = 0x00000000; |
| 290 |
pub const INADDR_LOOPBACK: ULONG = 0x7f000001; |
| 291 |
pub const INADDR_BROADCAST: ULONG = 0xffffffff; |
| 292 |
pub const INADDR_NONE: ULONG = 0xffffffff; |
| 293 |
ENUM!{enum SCOPE_LEVEL { |
| 294 |
ScopeLevelInterface = 1, |
| 295 |
ScopeLevelLink = 2, |
| 296 |
ScopeLevelSubnet = 3, |
| 297 |
ScopeLevelAdmin = 4, |
| 298 |
ScopeLevelSite = 5, |
| 299 |
ScopeLevelOrganization = 8, |
| 300 |
ScopeLevelGlobal = 14, |
| 301 |
ScopeLevelCount = 16, |
| 302 |
}} |
| 303 |
STRUCT!{struct SCOPE_ID_u_s { |
| 304 |
bitfield: ULONG, |
| 305 |
}} |
| 306 |
BITFIELD!{SCOPE_ID_u_s bitfield: ULONG [ |
| 307 |
Zone set_Zone[0..28], |
| 308 |
Level set_Level[28..32], |
| 309 |
]} |
| 310 |
UNION!{union SCOPE_ID_u { |
| 311 |
[u32; 1], |
| 312 |
s s_mut: SCOPE_ID_u_s, |
| 313 |
Value Value_mut: ULONG, |
| 314 |
}} |
| 315 |
STRUCT!{struct SCOPE_ID { |
| 316 |
u: SCOPE_ID_u, |
| 317 |
}} |
| 318 |
pub type PSCOPE_ID = *mut SCOPE_ID; |
| 319 |
STRUCT!{struct SOCKADDR_IN { |
| 320 |
sin_family: ADDRESS_FAMILY, |
| 321 |
sin_port: USHORT, |
| 322 |
sin_addr: IN_ADDR, |
| 323 |
sin_zero: [CHAR; 8], |
| 324 |
}} |
| 325 |
pub type PSOCKADDR_IN = *mut SOCKADDR_IN; |
| 326 |
STRUCT!{struct SOCKADDR_DL { |
| 327 |
sdl_family: ADDRESS_FAMILY, |
| 328 |
sdl_data: [UCHAR; 8], |
| 329 |
sdl_zero: [UCHAR; 4], |
| 330 |
}} |
| 331 |
pub type PSOCKADDR_DL = *mut SOCKADDR_DL; |
| 332 |
pub const IOCPARM_MASK: DWORD = 0x7f; |
| 333 |
pub const IOC_VOID: DWORD = 0x20000000; |
| 334 |
pub const IOC_OUT: DWORD = 0x40000000; |
| 335 |
pub const IOC_IN: DWORD = 0x80000000; |
| 336 |
pub const IOC_INOUT: DWORD = IOC_IN | IOC_OUT; |
| 337 |
STRUCT!{struct WSABUF { |
| 338 |
len: ULONG, |
| 339 |
buf: *mut CHAR, |
| 340 |
}} |
| 341 |
pub type LPWSABUF = *mut WSABUF; |
| 342 |
STRUCT!{struct WSAMSG { |
| 343 |
name: LPSOCKADDR, |
| 344 |
namelen: INT, |
| 345 |
lpBuffers: LPWSABUF, |
| 346 |
dwBufferCount: ULONG, |
| 347 |
Control: WSABUF, |
| 348 |
dwFlags: ULONG, |
| 349 |
}} |
| 350 |
pub type PWSAMSG = *mut WSAMSG; |
| 351 |
pub type LPWSAMSG = *mut WSAMSG; |
| 352 |
STRUCT!{struct WSACMSGHDR { |
| 353 |
cmsg_len: SIZE_T, |
| 354 |
cmsg_level: INT, |
| 355 |
cmsg_type: INT, |
| 356 |
}} |
| 357 |
pub type PWSACMSGHDR = *mut WSACMSGHDR; |
| 358 |
pub type LPWSACMSGHDR = *mut WSACMSGHDR; |
| 359 |
pub type CMSGHDR = WSACMSGHDR; |
| 360 |
pub type PCMSGHDR = *mut WSACMSGHDR; |
| 361 |
pub const MSG_TRUNC: ULONG = 0x0100; |
| 362 |
pub const MSG_CTRUNC: ULONG = 0x0200; |
| 363 |
pub const MSG_BCAST: ULONG = 0x0400; |
| 364 |
pub const MSG_MCAST: ULONG = 0x0800; |
| 365 |
pub const AI_PASSIVE: c_int = 0x00000001; |
| 366 |
pub const AI_CANONNAME: c_int = 0x00000002; |
| 367 |
pub const AI_NUMERICHOST: c_int = 0x00000004; |
| 368 |
pub const AI_NUMERICSERV: c_int = 0x00000008; |
| 369 |
pub const AI_DNS_ONLY: c_int = 0x00000010; |
| 370 |
pub const AI_ALL: c_int = 0x00000100; |
| 371 |
pub const AI_ADDRCONFIG: c_int = 0x00000400; |
| 372 |
pub const AI_V4MAPPED: c_int = 0x00000800; |
| 373 |
pub const AI_NON_AUTHORITATIVE: c_int = 0x00004000; |
| 374 |
pub const AI_SECURE: c_int = 0x00008000; |
| 375 |
pub const AI_RETURN_PREFERRED_NAMES: c_int = 0x00010000; |
| 376 |
pub const AI_FQDN: c_int = 0x00020000; |
| 377 |
pub const AI_FILESERVER: c_int = 0x00040000; |
| 378 |
pub const AI_DISABLE_IDN_ENCODING: c_int = 0x00080000; |
| 379 |
pub const AI_EXTENDED: c_int = 0x80000000; |
| 380 |
pub const AI_RESOLUTION_HANDLE: c_int = 0x40000000; |
| 381 |
STRUCT!{struct ADDRINFOA { |
| 382 |
ai_flags: c_int, |
| 383 |
ai_family: c_int, |
| 384 |
ai_socktype: c_int, |
| 385 |
ai_protocol: c_int, |
| 386 |
ai_addrlen: size_t, |
| 387 |
ai_canonname: *mut c_char, |
| 388 |
ai_addr: *mut SOCKADDR, |
| 389 |
ai_next: *mut ADDRINFOA, |
| 390 |
}} |
| 391 |
pub type PADDRINFOA = *mut ADDRINFOA; |
| 392 |
STRUCT!{struct ADDRINFOW { |
| 393 |
ai_flags: c_int, |
| 394 |
ai_family: c_int, |
| 395 |
ai_socktype: c_int, |
| 396 |
ai_protocol: c_int, |
| 397 |
ai_addrlen: size_t, |
| 398 |
ai_canonname: PWSTR, |
| 399 |
ai_addr: *mut SOCKADDR, |
| 400 |
ai_next: *mut ADDRINFOW, |
| 401 |
}} |
| 402 |
pub type PADDRINFOW = *mut ADDRINFOW; |
| 403 |
STRUCT!{struct ADDRINFOEXA { |
| 404 |
ai_flags: c_int, |
| 405 |
ai_family: c_int, |
| 406 |
ai_socktype: c_int, |
| 407 |
ai_protocol: c_int, |
| 408 |
ai_addrlen: size_t, |
| 409 |
ai_canonname: *mut c_char, |
| 410 |
ai_addr: *mut SOCKADDR, |
| 411 |
ai_blob: *mut c_void, |
| 412 |
ai_bloblen: size_t, |
| 413 |
ai_provider: LPGUID, |
| 414 |
ai_next: *mut ADDRINFOEXA, |
| 415 |
}} |
| 416 |
pub type PADDRINFOEXA = *mut ADDRINFOEXA; |
| 417 |
pub type LPADDRINFOEXA = *mut ADDRINFOEXA; |
| 418 |
STRUCT!{struct ADDRINFOEXW { |
| 419 |
ai_flags: c_int, |
| 420 |
ai_family: c_int, |
| 421 |
ai_socktype: c_int, |
| 422 |
ai_protocol: c_int, |
| 423 |
ai_addrlen: size_t, |
| 424 |
ai_canonname: PWSTR, |
| 425 |
ai_addr: *mut SOCKADDR, |
| 426 |
ai_blob: *mut c_void, |
| 427 |
ai_bloblen: size_t, |
| 428 |
ai_provider: LPGUID, |
| 429 |
ai_next: *mut ADDRINFOEXW, |
| 430 |
}} |
| 431 |
pub type PADDRINFOEXW = *mut ADDRINFOEXW; |
| 432 |
pub type LPADDRINFOEXW = *mut ADDRINFOEXW; |
| 433 |
pub const ADDRINFOEX_VERSION_2: c_int = 2; |
| 434 |
pub const ADDRINFOEX_VERSION_3: c_int = 3; |
| 435 |
pub const ADDRINFOEX_VERSION_4: c_int = 4; |
| 436 |
STRUCT!{struct ADDRINFOEX2A { |
| 437 |
ai_flags: c_int, |
| 438 |
ai_family: c_int, |
| 439 |
ai_socktype: c_int, |
| 440 |
ai_protocol: c_int, |
| 441 |
ai_addrlen: size_t, |
| 442 |
ai_canonname: *mut c_char, |
| 443 |
ai_addr: *mut SOCKADDR, |
| 444 |
ai_blob: *mut c_void, |
| 445 |
ai_bloblen: size_t, |
| 446 |
ai_provider: LPGUID, |
| 447 |
ai_next: *mut ADDRINFOEX2W, |
| 448 |
ai_version: c_int, |
| 449 |
ai_fqdn: *mut c_char, |
| 450 |
}} |
| 451 |
pub type PADDRINFOEX2A = *mut ADDRINFOEX2A; |
| 452 |
pub type LPADDRINFOEX2A = *mut ADDRINFOEX2A; |
| 453 |
STRUCT!{struct ADDRINFOEX2W { |
| 454 |
ai_flags: c_int, |
| 455 |
ai_family: c_int, |
| 456 |
ai_socktype: c_int, |
| 457 |
ai_protocol: c_int, |
| 458 |
ai_addrlen: size_t, |
| 459 |
ai_canonname: PWSTR, |
| 460 |
ai_addr: *mut SOCKADDR, |
| 461 |
ai_blob: *mut c_void, |
| 462 |
ai_bloblen: size_t, |
| 463 |
ai_provider: LPGUID, |
| 464 |
ai_next: *mut ADDRINFOEX2W, |
| 465 |
ai_version: c_int, |
| 466 |
ai_fqdn: PWSTR, |
| 467 |
}} |
| 468 |
pub type PADDRINFOEX2W = *mut ADDRINFOEX2W; |
| 469 |
pub type LPADDRINFOEX2W = *mut ADDRINFOEX2W; |
| 470 |
STRUCT!{struct ADDRINFOEX3A { |
| 471 |
ai_flags: c_int, |
| 472 |
ai_family: c_int, |
| 473 |
ai_socktype: c_int, |
| 474 |
ai_protocol: c_int, |
| 475 |
ai_addrlen: size_t, |
| 476 |
ai_canonname: *mut c_char, |
| 477 |
ai_addr: *mut SOCKADDR, |
| 478 |
ai_blob: *mut c_void, |
| 479 |
ai_bloblen: size_t, |
| 480 |
ai_provider: LPGUID, |
| 481 |
ai_next: *mut ADDRINFOEX3W, |
| 482 |
ai_version: c_int, |
| 483 |
ai_fqdn: *mut c_char, |
| 484 |
ai_interfaceindex: c_int, |
| 485 |
}} |
| 486 |
pub type PADDRINFOEX3A = *mut ADDRINFOEX3A; |
| 487 |
pub type LPADDRINFOEX3A = *mut ADDRINFOEX3A; |
| 488 |
STRUCT!{struct ADDRINFOEX3W { |
| 489 |
ai_flags: c_int, |
| 490 |
ai_family: c_int, |
| 491 |
ai_socktype: c_int, |
| 492 |
ai_protocol: c_int, |
| 493 |
ai_addrlen: size_t, |
| 494 |
ai_canonname: PWSTR, |
| 495 |
ai_addr: *mut SOCKADDR, |
| 496 |
ai_blob: *mut c_void, |
| 497 |
ai_bloblen: size_t, |
| 498 |
ai_provider: LPGUID, |
| 499 |
ai_next: *mut ADDRINFOEX3W, |
| 500 |
ai_version: c_int, |
| 501 |
ai_fqdn: PWSTR, |
| 502 |
ai_interfaceindex: c_int, |
| 503 |
}} |
| 504 |
pub type PADDRINFOEX3W = *mut ADDRINFOEX3W; |
| 505 |
pub type LPADDRINFOEX3W = *mut ADDRINFOEX3W; |
| 506 |
STRUCT!{struct ADDRINFOEX4 { |
| 507 |
ai_flags: c_int, |
| 508 |
ai_family: c_int, |
| 509 |
ai_socktype: c_int, |
| 510 |
ai_protocol: c_int, |
| 511 |
ai_addrlen: size_t, |
| 512 |
ai_canonname: PWSTR, |
| 513 |
ai_addr: *mut SOCKADDR, |
| 514 |
ai_blob: *mut c_void, |
| 515 |
ai_bloblen: size_t, |
| 516 |
ai_provider: LPGUID, |
| 517 |
ai_next: *mut ADDRINFOEX4, |
| 518 |
ai_version: c_int, |
| 519 |
ai_fqdn: PWSTR, |
| 520 |
ai_interfaceindex: c_int, |
| 521 |
ai_resolutionhandle: HANDLE, |
| 522 |
}} |
| 523 |
pub type PADDRINFOEX4 = *mut ADDRINFOEX4; |
| 524 |
pub type LPADDRINFOEX4 = *mut ADDRINFOEX4; |
| 525 |
pub const NS_ALL: DWORD = 0; |
| 526 |
pub const NS_SAP: DWORD = 1; |
| 527 |
pub const NS_NDS: DWORD = 2; |
| 528 |
pub const NS_PEER_BROWSE: DWORD = 3; |
| 529 |
pub const NS_SLP: DWORD = 5; |
| 530 |
pub const NS_DHCP: DWORD = 6; |
| 531 |
pub const NS_TCPIP_LOCAL: DWORD = 10; |
| 532 |
pub const NS_TCPIP_HOSTS: DWORD = 11; |
| 533 |
pub const NS_DNS: DWORD = 12; |
| 534 |
pub const NS_NETBT: DWORD = 13; |
| 535 |
pub const NS_WINS: DWORD = 14; |
| 536 |
pub const NS_NLA: DWORD = 15; |
| 537 |
pub const NS_BTH: DWORD = 16; |
| 538 |
pub const NS_NBP: DWORD = 20; |
| 539 |
pub const NS_MS: DWORD = 30; |
| 540 |
pub const NS_STDA: DWORD = 31; |
| 541 |
pub const NS_NTDS: DWORD = 32; |
| 542 |
pub const NS_EMAIL: DWORD = 37; |
| 543 |
pub const NS_PNRPNAME: DWORD = 38; |
| 544 |
pub const NS_PNRPCLOUD: DWORD = 39; |
| 545 |
pub const NS_X500: DWORD = 40; |
| 546 |
pub const NS_NIS: DWORD = 41; |
| 547 |
pub const NS_NISPLUS: DWORD = 42; |
| 548 |
pub const NS_WRQ: DWORD = 50; |
| 549 |
pub const NS_NETDES: DWORD = 60; |
| 550 |
pub const NI_NOFQDN: c_int = 0x01; |
| 551 |
pub const NI_NUMERICHOST: c_int = 0x02; |
| 552 |
pub const NI_NAMEREQD: c_int = 0x04; |
| 553 |
pub const NI_NUMERICSERV: c_int = 0x08; |
| 554 |
pub const NI_DGRAM: c_int = 0x10; |
| 555 |
pub const NI_MAXHOST: c_int = 1025; |
| 556 |
pub const NI_MAXSERV: c_int = 32; |