?? winsock2.pas
字號:
{ WinSock 2 extension -- new error codes and type definition }
WSA_IO_PENDING = ERROR_IO_PENDING;
WSA_IO_INCOMPLETE = ERROR_IO_INCOMPLETE;
WSA_INVALID_HANDLE = ERROR_INVALID_HANDLE;
WSA_INVALID_PARAMETER = ERROR_INVALID_PARAMETER;
WSA_NOT_ENOUGH_MEMORY = ERROR_NOT_ENOUGH_MEMORY;
WSA_OPERATION_ABORTED = ERROR_OPERATION_ABORTED;
WSA_INVALID_EVENT = WSAEVENT(nil);
WSA_MAXIMUM_WAIT_EVENTS = MAXIMUM_WAIT_OBJECTS;
WSA_WAIT_FAILED = $ffffffff;
WSA_WAIT_EVENT_0 = WAIT_OBJECT_0;
WSA_WAIT_IO_COMPLETION = WAIT_IO_COMPLETION;
WSA_WAIT_TIMEOUT = WAIT_TIMEOUT;
WSA_INFINITE = INFINITE;
{ Windows Sockets errors redefined as regular Berkeley error constants.
These are commented out in Windows NT to avoid conflicts with errno.h.
Use the WSA constants instead. }
EWOULDBLOCK = WSAEWOULDBLOCK;
EINPROGRESS = WSAEINPROGRESS;
EALREADY = WSAEALREADY;
ENOTSOCK = WSAENOTSOCK;
EDESTADDRREQ = WSAEDESTADDRREQ;
EMSGSIZE = WSAEMSGSIZE;
EPROTOTYPE = WSAEPROTOTYPE;
ENOPROTOOPT = WSAENOPROTOOPT;
EPROTONOSUPPORT = WSAEPROTONOSUPPORT;
ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT;
EOPNOTSUPP = WSAEOPNOTSUPP;
EPFNOSUPPORT = WSAEPFNOSUPPORT;
EAFNOSUPPORT = WSAEAFNOSUPPORT;
EADDRINUSE = WSAEADDRINUSE;
EADDRNOTAVAIL = WSAEADDRNOTAVAIL;
ENETDOWN = WSAENETDOWN;
ENETUNREACH = WSAENETUNREACH;
ENETRESET = WSAENETRESET;
ECONNABORTED = WSAECONNABORTED;
ECONNRESET = WSAECONNRESET;
ENOBUFS = WSAENOBUFS;
EISCONN = WSAEISCONN;
ENOTCONN = WSAENOTCONN;
ESHUTDOWN = WSAESHUTDOWN;
ETOOMANYREFS = WSAETOOMANYREFS;
ETIMEDOUT = WSAETIMEDOUT;
ECONNREFUSED = WSAECONNREFUSED;
ELOOP = WSAELOOP;
ENAMETOOLONG = WSAENAMETOOLONG;
EHOSTDOWN = WSAEHOSTDOWN;
EHOSTUNREACH = WSAEHOSTUNREACH;
ENOTEMPTY = WSAENOTEMPTY;
EPROCLIM = WSAEPROCLIM;
EUSERS = WSAEUSERS;
EDQUOT = WSAEDQUOT;
ESTALE = WSAESTALE;
EREMOTE = WSAEREMOTE;
WSADESCRIPTION_LEN = 256;
WSASYS_STATUS_LEN = 128;
type
PWSAData = ^TWSAData;
TWSAData = packed record
wVersion : Word;
wHighVersion : Word;
szDescription : Array[0..WSADESCRIPTION_LEN] of Char;
szSystemStatus : Array[0..WSASYS_STATUS_LEN] of Char;
iMaxSockets : Word;
iMaxUdpDg : Word;
lpVendorInfo : PChar;
end;
{ WSAOVERLAPPED = Record
Internal: LongInt;
InternalHigh: LongInt;
Offset: LongInt;
OffsetHigh: LongInt;
hEvent: WSAEVENT;
end;}
WSAOVERLAPPED = TOverlapped;
TWSAOverlapped = WSAOverlapped;
PWSAOverlapped = ^WSAOverlapped;
LPWSAOVERLAPPED = PWSAOverlapped;
{ WinSock 2 extension -- WSABUF and QOS struct, include qos.h }
{ to pull in FLOWSPEC and related definitions }
WSABUF = packed record
len: U_LONG; { the length of the buffer }
buf: PChar; { the pointer to the buffer }
end {WSABUF};
PWSABUF = ^WSABUF;
LPWSABUF = PWSABUF;
TServiceType = LongInt;
TFlowSpec = packed record
TokenRate, // In Bytes/sec
TokenBucketSize, // In Bytes
PeakBandwidth, // In Bytes/sec
Latency, // In microseconds
DelayVariation : LongInt;// In microseconds
ServiceType : TServiceType;
MaxSduSize, MinimumPolicedSize : LongInt;// In Bytes
end;
PFlowSpec = ^TFLOWSPEC;
QOS = packed record
SendingFlowspec: TFlowSpec; { the flow spec for data sending }
ReceivingFlowspec: TFlowSpec; { the flow spec for data receiving }
ProviderSpecific: WSABUF; { additional provider specific stuff }
end;
TQualityOfService = QOS;
PQOS = ^QOS;
LPQOS = PQOS;
const
SERVICETYPE_NOTRAFFIC = $00000000; // No data in this direction
SERVICETYPE_BESTEFFORT = $00000001; // Best Effort
SERVICETYPE_CONTROLLEDLOAD = $00000002; // Controlled Load
SERVICETYPE_GUARANTEED = $00000003; // Guaranteed
SERVICETYPE_NETWORK_UNAVAILABLE = $00000004; // Used to notify change to user
SERVICETYPE_GENERAL_INFORMATION = $00000005; // corresponds to "General Parameters" defined by IntServ
SERVICETYPE_NOCHANGE = $00000006; // used to indicate that the flow spec contains no change from any previous one
// to turn on immediate traffic control, OR this flag with the ServiceType field in teh FLOWSPEC
SERVICE_IMMEDIATE_TRAFFIC_CONTROL = $80000000;
// WinSock 2 extension -- manifest constants for return values of the condition function
CF_ACCEPT = $0000;
CF_REJECT = $0001;
CF_DEFER = $0002;
// WinSock 2 extension -- manifest constants for shutdown()
SD_RECEIVE = $00;
SD_SEND = $01;
SD_BOTH = $02;
// WinSock 2 extension -- data type and manifest constants for socket groups
SG_UNCONSTRAINED_GROUP = $01;
SG_CONSTRAINED_GROUP = $02;
type
GROUP = DWORD;
// WinSock 2 extension -- data type for WSAEnumNetworkEvents()
TWSANetworkEvents = record
lNetworkEvents: LongInt;
iErrorCode: Array[0..FD_MAX_EVENTS-1] of Integer;
end;
PWSANetworkEvents = ^TWSANetworkEvents;
LPWSANetworkEvents = PWSANetworkEvents;
// WinSock 2 extension -- WSAPROTOCOL_INFO structure
{$ifndef ver130}
TGUID = packed record
D1: LongInt;
D2: Word;
D3: Word;
D4: Array[0..7] of Byte;
end;
PGUID = ^TGUID;
{$endif}
LPGUID = PGUID;
// WinSock 2 extension -- WSAPROTOCOL_INFO manifest constants
const
MAX_PROTOCOL_CHAIN = 7;
BASE_PROTOCOL = 1;
LAYERED_PROTOCOL = 0;
WSAPROTOCOL_LEN = 255;
type
TWSAProtocolChain = record
ChainLen: Integer; // the length of the chain,
// length = 0 means layered protocol,
// length = 1 means base protocol,
// length > 1 means protocol chain
ChainEntries: Array[0..MAX_PROTOCOL_CHAIN-1] of LongInt; // a list of dwCatalogEntryIds
end;
type
TWSAProtocol_InfoA = record
dwServiceFlags1: LongInt;
dwServiceFlags2: LongInt;
dwServiceFlags3: LongInt;
dwServiceFlags4: LongInt;
dwProviderFlags: LongInt;
ProviderId: TGUID;
dwCatalogEntryId: LongInt;
ProtocolChain: TWSAProtocolChain;
iVersion: Integer;
iAddressFamily: Integer;
iMaxSockAddr: Integer;
iMinSockAddr: Integer;
iSocketType: Integer;
iProtocol: Integer;
iProtocolMaxOffset: Integer;
iNetworkByteOrder: Integer;
iSecurityScheme: Integer;
dwMessageSize: LongInt;
dwProviderReserved: LongInt;
szProtocol: Array[0..WSAPROTOCOL_LEN+1-1] of Char;
end {TWSAProtocol_InfoA};
PWSAProtocol_InfoA = ^TWSAProtocol_InfoA;
LPWSAProtocol_InfoA = PWSAProtocol_InfoA;
TWSAProtocol_InfoW = record
dwServiceFlags1: LongInt;
dwServiceFlags2: LongInt;
dwServiceFlags3: LongInt;
dwServiceFlags4: LongInt;
dwProviderFlags: LongInt;
ProviderId: TGUID;
dwCatalogEntryId: LongInt;
ProtocolChain: TWSAProtocolChain;
iVersion: Integer;
iAddressFamily: Integer;
iMaxSockAddr: Integer;
iMinSockAddr: Integer;
iSocketType: Integer;
iProtocol: Integer;
iProtocolMaxOffset: Integer;
iNetworkByteOrder: Integer;
iSecurityScheme: Integer;
dwMessageSize: LongInt;
dwProviderReserved: LongInt;
szProtocol: Array[0..WSAPROTOCOL_LEN+1-1] of WideChar;
end {TWSAProtocol_InfoW};
PWSAProtocol_InfoW = ^TWSAProtocol_InfoW;
LPWSAProtocol_InfoW = PWSAProtocol_InfoW;
{$IFDEF UNICODE}
WSAProtocol_Info = TWSAProtocol_InfoW;
TWSAProtocol_Info = TWSAProtocol_InfoW;
PWSAProtocol_Info = PWSAProtocol_InfoW;
LPWSAProtocol_Info = PWSAProtocol_InfoW;
{$ELSE}
WSAProtocol_Info = TWSAProtocol_InfoA;
TWSAProtocol_Info = TWSAProtocol_InfoA;
PWSAProtocol_Info = PWSAProtocol_InfoA;
LPWSAProtocol_Info = PWSAProtocol_InfoA;
{$ENDIF}
const
// Flag bit definitions for dwProviderFlags
PFL_MULTIPLE_PROTO_ENTRIES = $00000001;
PFL_RECOMMENDED_PROTO_ENTRY = $00000002;
PFL_HIDDEN = $00000004;
PFL_MATCHES_PROTOCOL_ZERO = $00000008;
// Flag bit definitions for dwServiceFlags1
XP1_CONNECTIONLESS = $00000001;
XP1_GUARANTEED_DELIVERY = $00000002;
XP1_GUARANTEED_ORDER = $00000004;
XP1_MESSAGE_ORIENTED = $00000008;
XP1_PSEUDO_STREAM = $00000010;
XP1_GRACEFUL_CLOSE = $00000020;
XP1_EXPEDITED_DATA = $00000040;
XP1_CONNECT_DATA = $00000080;
XP1_DISCONNECT_DATA = $00000100;
XP1_SUPPORT_BROADCAST = $00000200;
XP1_SUPPORT_MULTIPOINT = $00000400;
XP1_MULTIPOINT_CONTROL_PLANE = $00000800;
XP1_MULTIPOINT_DATA_PLANE = $00001000;
XP1_QOS_SUPPORTED = $00002000;
XP1_INTERRUPT = $00004000;
XP1_UNI_SEND = $00008000;
XP1_UNI_RECV = $00010000;
XP1_IFS_HANDLES = $00020000;
XP1_PARTIAL_MESSAGE = $00040000;
BIGENDIAN = $0000;
LITTLEENDIAN = $0001;
SECURITY_PROTOCOL_NONE = $0000;
// WinSock 2 extension -- manifest constants for WSAJoinLeaf()
JL_SENDER_ONLY = $01;
JL_RECEIVER_ONLY = $02;
JL_BOTH = $04;
// WinSock 2 extension -- manifest constants for WSASocket()
WSA_FLAG_OVERLAPPED = $01;
WSA_FLAG_MULTIPOINT_C_ROOT = $02;
WSA_FLAG_MULTIPOINT_C_LEAF = $04;
WSA_FLAG_MULTIPOINT_D_ROOT = $08;
WSA_FLAG_MULTIPOINT_D_LEAF = $10;
// WinSock 2 extension -- manifest constants for WSAIoctl()
IOC_UNIX = $00000000;
IOC_WS2 = $08000000;
IOC_PROTOCOL = $10000000;
IOC_VENDOR = $18000000;
SIO_ASSOCIATE_HANDLE = 1 or IOC_WS2 or IOC_IN;
SIO_ENABLE_CIRCULAR_QUEUEING = 2 or IOC_WS2;
SIO_FIND_ROUTE = 3 or IOC_WS2 or IOC_OUT;
SIO_FLUSH = 4 or IOC_WS2;
SIO_GET_BROADCAST_ADDRESS = 5 or IOC_WS2 or IOC_OUT;
SIO_GET_EXTENSION_FUNCTION_POINTER = 6 or IOC_WS2 or IOC_INOUT;
SIO_GET_QOS = 7 or IOC_WS2 or IOC_INOUT;
SIO_GET_GROUP_QOS = 8 or IOC_WS2 or IOC_INOUT;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -