⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winsock2.pas

📁 iocp远控比较完整的代码.iocp far more complete control of the code
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  SO_Protocol_Info         = SO_Protocol_InfoW;
{$ELSE}
  SO_Protocol_Info         = SO_Protocol_InfoA;
{$ENDIF}
  PVD_CONFIG               = $3001; // configuration info for service provider
  SO_CONDITIONAL_ACCEPT    = $3002; // enable true conditional accept:
                                    // connection is not ack-ed to the
                                    // other side until conditional
                                    // function returns CF_ACCEPT

// Address families.
  AF_UNSPEC       = 0;               // unspecified
  AF_UNIX         = 1;               // local to host (pipes, portals)
  AF_INET         = 2;               // internetwork: UDP, TCP, etc.
  AF_IMPLINK      = 3;               // arpanet imp addresses
  AF_PUP          = 4;               // pup protocols: e.g. BSP
  AF_CHAOS        = 5;               // mit CHAOS protocols
  AF_IPX          = 6;               // IPX and SPX
  AF_NS           = AF_IPX;          // XEROX NS protocols
  AF_ISO          = 7;               // ISO protocols
  AF_OSI          = AF_ISO;          // OSI is ISO
  AF_ECMA         = 8;               // european computer manufacturers
  AF_DATAKIT      = 9;               // datakit protocols
  AF_CCITT        = 10;              // CCITT protocols, X.25 etc
  AF_SNA          = 11;              // IBM SNA
  AF_DECnet       = 12;              // DECnet
  AF_DLI          = 13;              // Direct data link interface
  AF_LAT          = 14;              // LAT
  AF_HYLINK       = 15;              // NSC Hyperchannel
  AF_APPLETALK    = 16;              // AppleTalk
  AF_NETBIOS      = 17;              // NetBios-style addresses
  AF_VOICEVIEW    = 18;              // VoiceView
  AF_FIREFOX      = 19;              // FireFox
  AF_UNKNOWN1     = 20;              // Somebody is using this!
  AF_BAN          = 21;              // Banyan
  AF_ATM          = 22;              // Native ATM Services
  AF_INET6        = 23;              // Internetwork Version 6
  AF_CLUSTER      = 24;              // Microsoft Wolfpack
  AF_12844        = 25;              // IEEE 1284.4 WG AF
  AF_IRDA         = 26;              // IrDA
  AF_NETDES       = 28;              // Network Designers OSI & gateway enabled protocols

  AF_MAX          = 29;


// Protocol families, same as address families for now.

  PF_UNSPEC       = AF_UNSPEC;
  PF_UNIX         = AF_UNIX;
  PF_INET         = AF_INET;
  PF_IMPLINK      = AF_IMPLINK;
  PF_PUP          = AF_PUP;
  PF_CHAOS        = AF_CHAOS;
  PF_NS           = AF_NS;
  PF_IPX          = AF_IPX;
  PF_ISO          = AF_ISO;
  PF_OSI          = AF_OSI;
  PF_ECMA         = AF_ECMA;
  PF_DATAKIT      = AF_DATAKIT;
  PF_CCITT        = AF_CCITT;
  PF_SNA          = AF_SNA;
  PF_DECnet       = AF_DECnet;
  PF_DLI          = AF_DLI;
  PF_LAT          = AF_LAT;
  PF_HYLINK       = AF_HYLINK;
  PF_APPLETALK    = AF_APPLETALK;
  PF_VOICEVIEW    = AF_VOICEVIEW;
  PF_FIREFOX      = AF_FIREFOX;
  PF_UNKNOWN1     = AF_UNKNOWN1;
  PF_BAN          = AF_BAN;
  PF_ATM          = AF_ATM;
  PF_INET6        = AF_INET6;

  PF_MAX          = AF_MAX;

type

  SunB = packed record
    s_b1, s_b2, s_b3, s_b4: u_char;
  end;

  SunW = packed record
    s_w1, s_w2: u_short;
  end;

  TInAddr = packed record
    case integer of
      0: (S_un_b: SunB);
      1: (S_un_w: SunW);
      2: (S_addr: u_long);
  end;
  PInAddr = ^TInAddr;

  // Structure used by kernel to store most addresses.

  TSockAddrIn = packed record
    case Integer of
      0: (sin_family : u_short;
          sin_port   : u_short;
          sin_addr   : TInAddr;
          sin_zero   : array[0..7] of Char);
      1: (sa_family  : u_short;
          sa_data    : array[0..13] of Char)
  end;
  PSockAddrIn = ^TSockAddrIn;
  TSockAddr   = TSockAddrIn;
  PSockAddr   = ^TSockAddr;
  SOCKADDR    = TSockAddr;
  SOCKADDR_IN = TSockAddrIn;

  // Structure used by kernel to pass protocol information in raw sockets.
  PSockProto = ^TSockProto;
  TSockProto = packed record
    sp_family   : u_short;
    sp_protocol : u_short;
  end;

// Structure used for manipulating linger option.
  PLinger = ^TLinger;
  TLinger = packed record
    l_onoff: u_short;
    l_linger: u_short;
  end;

const
  INADDR_ANY       = $00000000;
  INADDR_LOOPBACK  = $7F000001;
  INADDR_BROADCAST = $FFFFFFFF;
  INADDR_NONE      = $FFFFFFFF;

  ADDR_ANY         = INADDR_ANY;

  SOL_SOCKET       = $ffff;          // options for socket level

  MSG_OOB          = $1;             // process out-of-band data
  MSG_PEEK         = $2;             // peek at incoming message
  MSG_DONTROUTE    = $4;             // send without using routing tables

  MSG_PARTIAL      = $8000;          // partial send or recv for message xport

// WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and WSARecvFrom()
  MSG_INTERRUPT    = $10;    // send/recv in the interrupt context
  MSG_MAXIOVLEN    = 16;


// Define constant based on rfc883, used by gethostbyxxxx() calls.

  MAXGETHOSTSTRUCT = 1024;

// Maximum queue length specifiable by listen.
  SOMAXCONN        = $7fffffff;

// WinSock 2 extension -- bit values and indices for FD_XXX network events
  FD_READ_BIT      = 0;
  FD_WRITE_BIT     = 1;
  FD_OOB_BIT       = 2;
  FD_ACCEPT_BIT    = 3;
  FD_CONNECT_BIT   = 4;
  FD_CLOSE_BIT     = 5;
  FD_QOS_BIT       = 6;
  FD_GROUP_QOS_BIT = 7;

  FD_MAX_EVENTS    = 8;

  FD_READ       = (1 shl FD_READ_BIT);
  FD_WRITE      = (1 shl FD_WRITE_BIT);
  FD_OOB        = (1 shl FD_OOB_BIT);
  FD_ACCEPT     = (1 shl FD_ACCEPT_BIT);
  FD_CONNECT    = (1 shl FD_CONNECT_BIT);
  FD_CLOSE      = (1 shl FD_CLOSE_BIT);
  FD_QOS        = (1 shl FD_QOS_BIT);
  FD_GROUP_QOS  = (1 shl FD_GROUP_QOS_BIT);

  FD_ALL_EVENTS = (1 shl FD_MAX_EVENTS) - 1;

// All Windows Sockets error constants are biased by WSABASEERR from the "normal"

  WSABASEERR              = 10000;

// Windows Sockets definitions of regular Microsoft C error constants

  WSAEINTR                = WSABASEERR+  4;
  WSAEBADF                = WSABASEERR+  9;
  WSAEACCES               = WSABASEERR+ 13;
  WSAEFAULT               = WSABASEERR+ 14;
  WSAEINVAL               = WSABASEERR+ 22;
  WSAEMFILE               = WSABASEERR+ 24;

// Windows Sockets definitions of regular Berkeley error constants

  WSAEWOULDBLOCK          = WSABASEERR+ 35;
  WSAEINPROGRESS          = WSABASEERR+ 36;
  WSAEALREADY             = WSABASEERR+ 37;
  WSAENOTSOCK             = WSABASEERR+ 38;
  WSAEDESTADDRREQ         = WSABASEERR+ 39;
  WSAEMSGSIZE             = WSABASEERR+ 40;
  WSAEPROTOTYPE           = WSABASEERR+ 41;
  WSAENOPROTOOPT          = WSABASEERR+ 42;
  WSAEPROTONOSUPPORT      = WSABASEERR+ 43;
  WSAESOCKTNOSUPPORT      = WSABASEERR+ 44;
  WSAEOPNOTSUPP           = WSABASEERR+ 45;
  WSAEPFNOSUPPORT         = WSABASEERR+ 46;
  WSAEAFNOSUPPORT         = WSABASEERR+ 47;
  WSAEADDRINUSE           = WSABASEERR+ 48;
  WSAEADDRNOTAVAIL        = WSABASEERR+ 49;
  WSAENETDOWN             = WSABASEERR+ 50;
  WSAENETUNREACH          = WSABASEERR+ 51;
  WSAENETRESET            = WSABASEERR+ 52;
  WSAECONNABORTED         = WSABASEERR+ 53;
  WSAECONNRESET           = WSABASEERR+ 54;
  WSAENOBUFS              = WSABASEERR+ 55;
  WSAEISCONN              = WSABASEERR+ 56;
  WSAENOTCONN             = WSABASEERR+ 57;
  WSAESHUTDOWN            = WSABASEERR+ 58;
  WSAETOOMANYREFS         = WSABASEERR+ 59;
  WSAETIMEDOUT            = WSABASEERR+ 60;
  WSAECONNREFUSED         = WSABASEERR+ 61;
  WSAELOOP                = WSABASEERR+ 62;
  WSAENAMETOOLONG         = WSABASEERR+ 63;
  WSAEHOSTDOWN            = WSABASEERR+ 64;
  WSAEHOSTUNREACH         = WSABASEERR+ 65;
  WSAENOTEMPTY            = WSABASEERR+ 66;
  WSAEPROCLIM             = WSABASEERR+ 67;
  WSAEUSERS               = WSABASEERR+ 68;
  WSAEDQUOT               = WSABASEERR+ 69;
  WSAESTALE               = WSABASEERR+ 70;
  WSAEREMOTE              = WSABASEERR+ 71;

// Extended Windows Sockets error constant definitions

  WSASYSNOTREADY          = WSABASEERR+ 91;
  WSAVERNOTSUPPORTED      = WSABASEERR+ 92;
  WSANOTINITIALISED       = WSABASEERR+ 93;
  WSAEDISCON              = WSABASEERR+101;
  WSAENOMORE              = WSABASEERR+102;
  WSAECANCELLED           = WSABASEERR+103;
  WSAEINVALIDPROCTABLE    = WSABASEERR+104;
  WSAEINVALIDPROVIDER     = WSABASEERR+105;
  WSAEPROVIDERFAILEDINIT  = WSABASEERR+106;
  WSASYSCALLFAILURE       = WSABASEERR+107;
  WSASERVICE_NOT_FOUND    = WSABASEERR+108;
  WSATYPE_NOT_FOUND       = WSABASEERR+109;
  WSA_E_NO_MORE           = WSABASEERR+110;
  WSA_E_CANCELLED         = WSABASEERR+111;
  WSAEREFUSED             = WSABASEERR+112;


{ Error return codes from gethostbyname() and gethostbyaddr()
  (when using the resolver). Note that these errors are
  retrieved via WSAGetLastError() and must therefore follow
  the rules for avoiding clashes with error numbers from
  specific implementations or language run-time systems.
  For this reason the codes are based at WSABASEERR+1001.
  Note also that [WSA]NO_ADDRESS is defined only for
  compatibility purposes. }

// Authoritative Answer: Host not found
  WSAHOST_NOT_FOUND        = WSABASEERR+1001;
  HOST_NOT_FOUND           = WSAHOST_NOT_FOUND;

// Non-Authoritative: Host not found, or SERVERFAIL
  WSATRY_AGAIN             = WSABASEERR+1002;
  TRY_AGAIN                = WSATRY_AGAIN;

// Non recoverable errors, FORMERR, REFUSED, NOTIMP
  WSANO_RECOVERY           = WSABASEERR+1003;
  NO_RECOVERY              = WSANO_RECOVERY;

// Valid name, no data record of requested type
  WSANO_DATA               = WSABASEERR+1004;
  NO_DATA                  = WSANO_DATA;

// no address, look for MX record
  WSANO_ADDRESS            = WSANO_DATA;
  NO_ADDRESS               = WSANO_ADDRESS;

// Define QOS related error return codes

  WSA_QOS_RECEIVERS          = WSABASEERR+1005; // at least one Reserve has arrived
  WSA_QOS_SENDERS            = WSABASEERR+1006; // at least one Path has arrived
  WSA_QOS_NO_SENDERS         = WSABASEERR+1007; // there are no senders
  WSA_QOS_NO_RECEIVERS       = WSABASEERR+1008; // there are no receivers
  WSA_QOS_REQUEST_CONFIRMED  = WSABASEERR+1009; // Reserve has been confirmed
  WSA_QOS_ADMISSION_FAILURE  = WSABASEERR+1010; // error due to lack of resources
  WSA_QOS_POLICY_FAILURE     = WSABASEERR+1011; // rejected for administrative reasons - bad credentials
  WSA_QOS_BAD_STYLE          = WSABASEERR+1012; // unknown or conflicting style
  WSA_QOS_BAD_OBJECT         = WSABASEERR+1013; // problem with some part of the filterspec or providerspecific buffer in general
  WSA_QOS_TRAFFIC_CTRL_ERROR = WSABASEERR+1014; // problem with some part of the flowspec
  WSA_QOS_GENERIC_ERROR      = WSABASEERR+1015; // general error
  WSA_QOS_ESERVICETYPE       = WSABASEERR+1016; // invalid service type in flowspec
  WSA_QOS_EFLOWSPEC          = WSABASEERR+1017; // invalid flowspec
  WSA_QOS_EPROVSPECBUF       = WSABASEERR+1018; // invalid provider specific buffer
  WSA_QOS_EFILTERSTYLE       = WSABASEERR+1019; // invalid filter style
  WSA_QOS_EFILTERTYPE        = WSABASEERR+1020; // invalid filter type
  WSA_QOS_EFILTERCOUNT       = WSABASEERR+1021; // incorrect number of filters
  WSA_QOS_EOBJLENGTH         = WSABASEERR+1022; // invalid object length
  WSA_QOS_EFLOWCOUNT         = WSABASEERR+1023; // incorrect number of flows
  WSA_QOS_EUNKOWNPSOBJ       = WSABASEERR+1024; // unknown object in provider specific buffer
  WSA_QOS_EPOLICYOBJ         = WSABASEERR+1025; // invalid policy object in provider specific buffer
  WSA_QOS_EFLOWDESC          = WSABASEERR+1026; // invalid flow descriptor in the list
  WSA_QOS_EPSFLOWSPEC        = WSABASEERR+1027; // inconsistent flow spec in provider specific buffer
  WSA_QOS_EPSFILTERSPEC      = WSABASEERR+1028; // invalid filter spec in provider specific buffer
  WSA_QOS_ESDMODEOBJ         = WSABASEERR+1029; // invalid shape discard mode object in provider specific buffer
  WSA_QOS_ESHAPERATEOBJ      = WSABASEERR+1030; // invalid shaping rate object in provider specific buffer
  WSA_QOS_RESERVED_PETYPE    = WSABASEERR+1031; // reserved policy element in provider specific buffer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -