Bladeren bron

Merged revisions 208-210 via svnmerge from
/trunk

git-svn-id: branches/fixes_2_0@350 -

peter 20 jaren geleden
bovenliggende
commit
2545679839
5 gewijzigde bestanden met toevoegingen van 107 en 21 verwijderingen
  1. 1 0
      .gitattributes
  2. 2 2
      fcl/Makefile
  3. 4 0
      fcl/Makefile.fpc
  4. 6 19
      fcl/inc/ssockets.pp
  5. 94 0
      fcl/os2/resolve.inc

+ 1 - 0
.gitattributes

@@ -783,6 +783,7 @@ fcl/os2/custapp.inc svneol=native#text/plain
 fcl/os2/eventlog.inc svneol=native#text/plain
 fcl/os2/ezcgi.inc svneol=native#text/plain
 fcl/os2/pipes.inc svneol=native#text/plain
+fcl/os2/resolve.inc svneol=native#text/plain
 fcl/passrc/Makefile -text
 fcl/passrc/Makefile.fpc svneol=native#text/plain
 fcl/passrc/pastree.pp svneol=native#text/plain

+ 2 - 2
fcl/Makefile

@@ -344,7 +344,7 @@ ifeq ($(FULL_TARGET),i386-win32)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process fileinfo resolve ssockets syncobjs
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex
+override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  resolve ssockets
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  process ssockets resolve fpasync syncobjs
@@ -371,7 +371,7 @@ ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex
+override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex  resolve ssockets
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 override TARGET_UNITS+=$(CLASSES10) contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls avl_tree xmlreg registry eventlog custapp cgiapp wformat whtml wtex rttiutils bufstream streamex

+ 4 - 0
fcl/Makefile.fpc

@@ -14,6 +14,8 @@ packages_darwin=netdb libasync pthreads
 packages_netbsd=netdb libasync
 packages_openbsd=netdb libasync
 packages_win32=netdb
+packages_os2=netdb
+packages_emx=netdb
 
 # clean package units
 [clean]
@@ -30,6 +32,8 @@ units_netbsd=process ssockets resolve fpasync
 units_openbsd=process ssockets resolve fpasync
 units_linux=process resolve ssockets fpasync syncobjs
 units_win32=process fileinfo resolve ssockets syncobjs
+units_os2=resolve ssockets
+units_emx=resolve ssockets
 units_netware=resolve ssockets
 units_netwlibc=resolve ssockets syncobjs
 rsts=$(CLASSES10) ssockets cachecls resolve custapp cgiapp eventlog registry

+ 6 - 19
fcl/inc/ssockets.pp

@@ -12,19 +12,6 @@
  **********************************************************************}
 {$MODE objfpc}
 
-{$ifdef win32}
-  {$define notUnix}
-{$endif}
-
-{$ifdef netware}
-  {$define notUnix}
-{$endif}
-
-{$ifdef netwlibc}
-  {$define notUnix}
-  {$define netware}
-{$endif}
-
 unit ssockets;
 
 
@@ -126,7 +113,7 @@ type
     Property Port : Word Read FPort;
   end;
 
-{$ifndef notUnix}
+{$ifdef Unix}
   TUnixServer = Class(TSocketServer)
   Private
     FUnixAddr : TUnixSockAddr;
@@ -155,7 +142,7 @@ type
     Property Port : Word Read FPort;
   end;
 
-{$ifndef notUnix}
+{$ifdef Unix}
 
   TUnixSocket = Class(TSocketStream)
   Private
@@ -394,7 +381,7 @@ end;
 Procedure TSocketServer.SetNonBlocking;
 
 begin
-{$ifndef notUnix}
+{$ifdef Unix}
   fpfcntl(FSocket,F_SETFL,O_NONBLOCK);
 {$endif}
   FNonBlocking:=True;
@@ -445,7 +432,7 @@ begin
   L:=SizeOf(FAddr);
   Result:=Sockets.Accept(Socket,Faddr,L);
   If Result<0 then
-{$ifndef notUnix}
+{$ifdef Unix}
     If SocketError=ESysEWOULDBLOCK then
       Raise ESocketError.Create(seAcceptWouldBlock,[socket])
     else
@@ -456,7 +443,7 @@ end;
 { ---------------------------------------------------------------------
     TUnixServer
   ---------------------------------------------------------------------}
-{$ifndef notUnix}
+{$ifdef Unix}
 Constructor TUnixServer.Create(AFileName : String);
 
 Var S : Longint;
@@ -563,7 +550,7 @@ end;
 { ---------------------------------------------------------------------
     TUnixSocket
   ---------------------------------------------------------------------}
-{$ifndef notUnix}
+{$ifdef Unix}
 Constructor TUnixSocket.Create(ASocket : Longint);
 
 begin

+ 94 - 0
fcl/os2/resolve.inc

@@ -0,0 +1,94 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 Soren Ager
+
+    Implementation of TCP/IP name resolution for OS/2.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+const
+  { Net type }
+  socklib = 'TCP32DLL';
+  AF_INET = 2;
+
+  { Error constants. Returned by LastError method of THost, TNet}
+
+  NETDB_INTERNAL= -1;       { see errno }
+  NETDB_SUCCESS = 0;        { no problem }
+  HOST_NOT_FOUND= 1;        { Authoritative Answer Host not found }
+  TRY_AGAIN     = 2;        { Non-Authoritive Host not found, or SERVERFAIL }
+  NO_RECOVERY   = 3;        { Non recoverable errors, FORMERR, REFUSED, NOTIMP }
+  NO_DATA       = 4;        { Valid name, no data record of requested type }
+  NO_ADDRESS    = NO_DATA;  { no address, look for MX record }
+
+
+Type
+
+  { THostEnt Object }
+  THostEnt = record
+    H_Name     : pchar;   { Official name }
+    H_Aliases  : ppchar;  { Null-terminated list of aliases}
+    H_Addrtype : longint;   { Host address type }
+    H_length  : longint;   { Length of address }
+    H_Addr : ppchar;    { null-terminated list of adresses }
+  end;
+  PHostEntry = ^THostEnt;
+
+  { TNetEnt object }
+  TNetEnt = record
+    N_Name     : pchar;   { Official name }
+    N_Aliases  : ppchar;  { Nill-terminated alias list }
+    N_AddrType : longint; { Net address type }
+    N_net      : Cardinal; { Network number }
+  end;
+  PNetEntry = ^TNetEnt;
+
+  TServEnt = record
+    s_name    : pchar;    { Service name }
+    s_aliases : ppchar;   { Null-terminated alias list }
+    s_port    : longint;  { Port number }
+    s_proto   : pchar;    { Protocol to use }
+  end;
+  PServEntry = ^TServEnt;
+
+
+function gethostent : PHostEntry; cdecl; external socklib index 30;
+procedure sethostent (stayopen : longint); cdecl; external socklib index 28;
+procedure endhostent; cdecl; external socklib index 29;
+
+function getnetent : PNetEntry; cdecl; external socklib index 17;
+procedure setnetent ( Stayopen : Longint);  cdecl; external socklib index 15;
+procedure endnetent; cdecl; external socklib index 16;
+
+function getservent : PServEntry; cdecl; external socklib index 27;
+procedure setservent (StayOpen : longint); cdecl; external socklib index 25;
+procedure endservent; cdecl; external socklib index 26;
+
+function getnetbyaddr ( Net : Longint; nettype : Longint) : PNetEntry; cdecl; external socklib index 14;
+function gethostbyname ( Name : Pchar) : PHostEntry; cdecl; external socklib index 11;
+function gethostbyaddr ( Addr : PChar; Len : Longint; HType : Longint) : PHostentry ; cdecl; external socklib index 12;
+function getnetbyname ( Name : pchar) : PNetEntry; cdecl; external socklib index 13;
+function getservbyname (name : pchar  ; protocol : pchar) : PServEntry; cdecl; external socklib index 24;
+function getservbyport (port : longint; protocol : pchar) : PServEntry; cdecl; external socklib index 23;
+
+function  GetDNSError : LongInt;
+begin
+  GetDNSError:=0;   //!!! fpgetCerrno;
+end;
+
+Function InitResolve : Boolean;
+begin
+  Result:=True;
+end;
+
+Function FinalResolve : Boolean;
+begin
+  Result:=True;
+end;