pub const TDI = struct {
pub const STATUS = NTSTATUS;
pub const CONNECTION = struct {
pub const CONTEXT = PVOID;
pub const INFORMATION = extern struct {
/// length of user data buffer
UserDataLength: LONG,
/// pointer to user data buffer
UserData: PVOID,
/// length of following buffer
OptionsLength: LONG,
/// pointer to buffer containing options
Options: PVOID,
/// length of following buffer
RemoteAddressLength: LONG,
/// buffer containing the remote address
RemoteAddress: PVOID,
};
};
pub const ADDRESS = struct {
pub const TYPE = enum(USHORT) {
/// unspecified
UNSPEC = 0,
/// local to host (pipes, portals,
UNIX = 1,
/// internetwork: UDP, TCP, etc.
IP = 2,
/// arpanet imp addresses
IMPLINK = 3,
/// pup protocols: e.g. BSP
PUP = 4,
/// mit CHAOS protocols
CHAOS = 5,
/// XEROX NS protocols
NS = 6,
/// Netware IPX
IPX = 6,
/// nbs protocols
NBS = 7,
/// european computer manufacturers
ECMA = 8,
/// datakit protocols
DATAKIT = 9,
/// CCITT protocols, X.25 etc
CCITT = 10,
/// IBM SNA
SNA = 11,
/// DECnet
DECnet = 12,
/// Direct data link interface
DLI = 13,
/// LAT
LAT = 14,
/// NSC Hyperchannel
HYLINK = 15,
/// AppleTalk
APPLETALK = 16,
/// Netbios Addresses
NETBIOS = 17,
@"8022" = 18,
OSI_TSAP = 19,
/// for WzMail
NETONE = 20,
/// Banyan VINES IP
VNS = 21,
/// NETBIOS address extensions
NETBIOS_EX = 22,
/// IP version 6
IP6 = 23,
/// WCHAR Netbios address
NETBIOS_UNICODE_EX = 24,
_,
};
pub const IP = extern struct {
sin_port: USHORT,
in_addr: ULONG,
sin_zero: [8]UCHAR,
};
pub const IP6 = extern struct {
sin_port: USHORT,
flowinfo: ULONG,
addr: [8]USHORT,
scope_id: ULONG,
};
};
pub const REQUEST = extern struct {
Handle: extern union {
AddressHandle: HANDLE,
ConnectionContext: CONNECTION.CONTEXT,
ControlChannel: HANDLE,
},
RequestNotifyObject: PVOID,
RequestContext: PVOID,
TdiStatus: TDI.STATUS,
pub const STATUS = extern struct {
/// status of request completion
Status: TDI.STATUS,
/// the request context
RequestContext: PVOID,
/// number of bytes transferred in the request
BytesTransferred: ULONG,
};
pub const ASSOCIATE = extern struct {
Request: REQUEST,
AddressHandle: HANDLE,
};
pub const CONNECT = extern struct {
Request: REQUEST,
RequestConnectionInformation: *CONNECTION.INFORMATION,
ReturnConnectionInformation: *CONNECTION.INFORMATION,
Timeout: LARGE_INTEGER,
};
pub const ACCEPT = extern struct {
Request: REQUEST,
RequestConnectionInformation: *CONNECTION.INFORMATION,
ReturnConnectionInformation: *CONNECTION.INFORMATION,
};
pub const LISTEN = extern struct {
Request: REQUEST,
RequestConnectionInformation: *CONNECTION.INFORMATION,
ReturnConnectionInformation: *CONNECTION.INFORMATION,
ListenFlags: USHORT,
};
pub const DISCONNECT = extern struct {
Request: REQUEST,
Timeout: LARGE_INTEGER,
};
pub const SEND = extern struct {
Request: REQUEST,
SendFlags: USHORT,
};
pub const RECEIVE = extern struct {
Request: REQUEST,
ReceiveFlags: USHORT,
};
pub const SEND_DATAGRAM = extern struct {
Request: REQUEST,
SendDatagramInformation: *CONNECTION.INFORMATION,
};
};
pub const RECEIVE = packed struct(ULONG) {
Reserved0: u2 = 0,
BROADCAST: bool = false,
MULTICAST: bool = false,
PARTIAL: bool = false,
NORMAL: bool = false,
EXPEDITED: bool = false,
PEEK: bool = false,
NO_RESPONSE_EXP: bool = false,
COPY_LOOKAHEAD: bool = false,
ENTIRE_MESSAGE: bool = false,
AT_DISPATCH_LEVEL: bool = false,
CONTROL_INFO: bool = false,
FORCE_INDICATION: bool = false,
NO_PUSH: bool = false,
Reserved12: u17 = 0,
};
pub const SEND = packed struct(ULONG) {
Reserved0: u5 = 0,
EXPEDITED: bool = false,
PARTIAL: bool = false,
NO_RESPONSE_EXPECTED: bool = false,
NON_BLOCKING: bool = false,
AND_DISCONNECT: bool = false,
Reserved10: u22 = 0,
};
}