From b0dabd07460cec7db05ac01e355ad418b8dc06ce Mon Sep 17 00:00:00 2001 From: Almindor Date: Wed, 22 Nov 2006 11:32:07 +0000 Subject: [PATCH] * fix windows sockets AT_ and PF_ (because of the unix changes) * fix some missing T-less names for types in winsock2 + add fpwinsockh.inc for windows specific consts needed to be delegated from winsock git-svn-id: trunk@5442 - --- .gitattributes | 1 + rtl/win/fpwinsockh.inc | 61 ++++++++++++++++++++++++++++++++++++++++++ rtl/win/sockets.pp | 5 +--- rtl/win/winsock2.pp | 18 +++++++++++++ 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 rtl/win/fpwinsockh.inc diff --git a/.gitattributes b/.gitattributes index 49a67a6b55..53c936f40d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5295,6 +5295,7 @@ rtl/win/crt.pp svneol=native#text/plain rtl/win/dos.pp svneol=native#text/plain rtl/win/dynlibs.inc svneol=native#text/plain rtl/win/fpcmemdll.pp svneol=native#text/plain +rtl/win/fpwinsockh.inc svneol=native#text/plain rtl/win/keyboard.pp svneol=native#text/plain rtl/win/messages.pp svneol=native#text/plain rtl/win/mouse.pp svneol=native#text/plain diff --git a/rtl/win/fpwinsockh.inc b/rtl/win/fpwinsockh.inc new file mode 100644 index 0000000000..2b55b5acef --- /dev/null +++ b/rtl/win/fpwinsockh.inc @@ -0,0 +1,61 @@ +{ + Should be aliases but I copy pasted them from winsock2 for now... +} + +const +{ 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 = 6; { 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_MAX = 24; + + 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; diff --git a/rtl/win/sockets.pp b/rtl/win/sockets.pp index 2846301293..e89a07a3c8 100644 --- a/rtl/win/sockets.pp +++ b/rtl/win/sockets.pp @@ -28,11 +28,8 @@ Type psocklen= ^tsocklen; - Const - AF_MAX = WinSock2.AF_MAX; - PF_MAX = AF_MAX; - {$i socketsh.inc} +{$i fpwinsockh.inc} Implementation diff --git a/rtl/win/winsock2.pp b/rtl/win/winsock2.pp index 649d607273..5b094f4fe8 100755 --- a/rtl/win/winsock2.pp +++ b/rtl/win/winsock2.pp @@ -52,12 +52,21 @@ type fd_count: u_int; fd_array: array[0..FD_SETSIZE-1] of TSocket; end; + fdset = TFDSet; PTimeVal = ^TTimeVal; TTimeVal = record tv_sec: Longint; tv_usec: Longint; end; + timeval = TTimeVal; + + timezone = record + tz_minuteswest : longint; + tz_dsttime : longint; + end; + TTimeZone = timezone; + PTimeZone = ^TTimeZone; const IOCPARM_MASK = $7f; @@ -87,6 +96,7 @@ type 0: (h_addr_list: ^PChar); 1: (h_addr: ^PChar) end; + hostent = THostEnt; PNetEnt = ^TNetEnt; TNetEnt = record @@ -95,6 +105,7 @@ type n_addrtype: Smallint; n_net: u_long; end; + netent = TNetEnt; PServEnt = ^TServEnt; TServEnt = record @@ -108,6 +119,7 @@ type s_proto: PChar; {$endif WIN64} end; + servent = TServEnt; PProtoEnt = ^TProtoEnt; TProtoEnt = record @@ -115,6 +127,7 @@ type p_aliases: ^Pchar; p_proto: Smallint; end; + protoent = TProtoEnt; const @@ -364,6 +377,7 @@ type 1: (S_un_w: SunW); 2: (S_addr: u_long); end; + in_addr = TInAddr; PSockAddrIn = ^TSockAddrIn; TSockAddrIn = record @@ -375,6 +389,7 @@ type 1: (sa_family: u_short; sa_data: array[0..13] of Char) end; + sockaddr_in = TSockAddrIn; { Structure used by kernel to store most addresses. } @@ -387,6 +402,7 @@ type sp_family: u_short; sp_protocol: u_short; end; + sockproto = TSockProto; { Structure used for manipulating linger option. } PLinger = ^TLinger; @@ -625,6 +641,7 @@ type lpVendorInfo : pchar; { 4 byte, ofs 396 } {$endif win64} end; + WSAData = TWSAData; { WSAOVERLAPPED = Record Internal: LongInt; @@ -661,6 +678,7 @@ type MaxSduSize, MinimumPolicedSize : LongInt;// In Bytes end; PFlowSpec = ^TFLOWSPEC; + flowspec = TFlowSpec; TQualityOfService = record SendingFlowspec: TFlowSpec; { the flow spec for data sending }