-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program.
--- This is the version for powerpc-ibm-aix5.1.0.0
+-- This is the version for powerpc-ibm-aix5.3.0.0
-- This file is generated automatically, do not modify it by hand! Instead,
-- make changes to gen-soccon.c and re-run it on each target.
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for ia64-hp-hpux11.23
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 22; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 226; -- Address already in use
+ EADDRNOTAVAIL : constant := 227; -- Cannot assign address
+ EAFNOSUPPORT : constant := 225; -- Addr family not supported
+ EALREADY : constant := 244; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 231; -- Connection aborted
+ ECONNREFUSED : constant := 239; -- Connection refused
+ ECONNRESET : constant := 232; -- Connection reset by peer
+ EDESTADDRREQ : constant := 217; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 241; -- Host is down
+ EHOSTUNREACH : constant := 242; -- No route to host
+ EINPROGRESS : constant := 245; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 234; -- Socket already connected
+ ELOOP : constant := 249; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 218; -- Message too long
+ ENAMETOOLONG : constant := 248; -- Name too long
+ ENETDOWN : constant := 228; -- Network is down
+ ENETRESET : constant := 230; -- Disconn. on network reset
+ ENETUNREACH : constant := 229; -- Network is unreachable
+ ENOBUFS : constant := 233; -- No buffer space available
+ ENOPROTOOPT : constant := 220; -- Protocol not available
+ ENOTCONN : constant := 235; -- Socket not connected
+ ENOTSOCK : constant := 216; -- Operation on non socket
+ EOPNOTSUPP : constant := 223; -- Operation not supported
+ EPFNOSUPPORT : constant := 224; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 221; -- Unknown protocol
+ EPROTOTYPE : constant := 219; -- Unknown protocol type
+ ESHUTDOWN : constant := 236; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 222; -- Socket type not supported
+ ETIMEDOUT : constant := 238; -- Connection timed out
+ ETOOMANYREFS : constant := 237; -- Too many references
+ EWOULDBLOCK : constant := 246; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 2; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 3; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for ia64-hp-linux-gnu
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for powerpc-linux
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 19; -- Emission timeout
+ SO_RCVTIMEO : constant := 18; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for i686-pc-linux-gnu
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
--- /dev/null
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for sparc-sun-solaris2.8/64
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 26; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 2; -- Stream socket
+ SOCK_DGRAM : constant := 1; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 125; -- Address already in use
+ EADDRNOTAVAIL : constant := 126; -- Cannot assign address
+ EAFNOSUPPORT : constant := 124; -- Addr family not supported
+ EALREADY : constant := 149; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 130; -- Connection aborted
+ ECONNREFUSED : constant := 146; -- Connection refused
+ ECONNRESET : constant := 131; -- Connection reset by peer
+ EDESTADDRREQ : constant := 96; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 147; -- Host is down
+ EHOSTUNREACH : constant := 148; -- No route to host
+ EINPROGRESS : constant := 150; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 133; -- Socket already connected
+ ELOOP : constant := 90; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 97; -- Message too long
+ ENAMETOOLONG : constant := 78; -- Name too long
+ ENETDOWN : constant := 127; -- Network is down
+ ENETRESET : constant := 129; -- Disconn. on network reset
+ ENETUNREACH : constant := 128; -- Network is unreachable
+ ENOBUFS : constant := 132; -- No buffer space available
+ ENOPROTOOPT : constant := 99; -- Protocol not available
+ ENOTCONN : constant := 134; -- Socket not connected
+ ENOTSOCK : constant := 95; -- Operation on non socket
+ EOPNOTSUPP : constant := 122; -- Operation not supported
+ EPFNOSUPPORT : constant := 123; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 120; -- Unknown protocol
+ EPROTOTYPE : constant := 98; -- Unknown protocol type
+ ESHUTDOWN : constant := 143; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
+ ETIMEDOUT : constant := 145; -- Connection timed out
+ ETOOMANYREFS : constant := 144; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 16; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 17; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+ --------------------------------
+ -- VxWorks-specific constants --
+ --------------------------------
+
+ -- These constants may be used only within the VxWorks version of
+ -- GNAT.Sockets.Thin.
+
+ OK : constant := 0; -- VxWorks generic success
+ ERROR : constant := -1; -- VxWorks generic error
+
end GNAT.Sockets.Constants;
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- directly with'ed by an applications program.
-- This is the version for i686-pc-linux-gnu
+-- WARNING! This file is a default version that must be replaced for
+-- each platform.
+
-- This file is generated automatically, do not modify it by hand! Instead,
-- make changes to gen-soccon.c and re-run it on each target.
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
No_Delay => Constants.TCP_NODELAY,
Add_Membership => Constants.IP_ADD_MEMBERSHIP,
Drop_Membership => Constants.IP_DROP_MEMBERSHIP,
+ Multicast_If => Constants.IP_MULTICAST_IF,
Multicast_TTL => Constants.IP_MULTICAST_TTL,
- Multicast_Loop => Constants.IP_MULTICAST_LOOP);
+ Multicast_Loop => Constants.IP_MULTICAST_LOOP,
+ Send_Timeout => Constants.SO_SNDTIMEO,
+ Receive_Timeout => Constants.SO_RCVTIMEO);
Flags : constant array (0 .. 3) of C.int :=
(0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data
function To_In_Addr is new Ada.Unchecked_Conversion (C.int, In_Addr);
function To_Int is new Ada.Unchecked_Conversion (In_Addr, C.int);
+ function Err_Code_Image (E : Integer) return String;
+ -- Return the value of E surrounded with brackets
+
-----------------------
-- Local subprograms --
-----------------------
function To_Service_Entry (E : Servent) return Service_Entry_Type;
-- Conversion function
- function To_Timeval (Val : Selector_Duration) return Timeval;
+ function To_Timeval (Val : Timeval_Duration) return Timeval;
-- Separate Val in seconds and microseconds
+ function To_Duration (Val : Timeval) return Timeval_Duration;
+ -- Reconstruct a Duration value from a Timeval record (seconds and
+ -- microseconds).
+
procedure Raise_Socket_Error (Error : Integer);
-- Raise Socket_Error with an exception message describing the error code
+ -- from errno.
- procedure Raise_Host_Error (Error : Integer);
+ procedure Raise_Host_Error (H_Error : Integer);
-- Raise Host_Error exception with message describing error code (note
- -- hstrerror seems to be obsolete).
+ -- hstrerror seems to be obsolete) from h_errno.
procedure Narrow (Item : in out Socket_Set_Type);
-- Update Last as it may be greater than the real last socket
is
Res : C.int;
Last : C.int;
+ RSig : Socket_Type renames Selector.R_Sig_Socket;
RSet : Socket_Set_Type;
WSet : Socket_Set_Type;
ESet : Socket_Set_Type;
TPtr : Timeval_Access;
begin
- Status := Completed;
+ begin
+ Status := Completed;
- -- No timeout or Forever is indicated by a null timeval pointer
+ -- No timeout or Forever is indicated by a null timeval pointer
- if Timeout = Forever then
- TPtr := null;
- else
- TVal := To_Timeval (Timeout);
- TPtr := TVal'Unchecked_Access;
- end if;
+ if Timeout = Forever then
+ TPtr := null;
+ else
+ TVal := To_Timeval (Timeout);
+ TPtr := TVal'Unchecked_Access;
+ end if;
- -- Copy R_Socket_Set in RSet and add read signalling socket
+ -- Copy R_Socket_Set in RSet and add read signalling socket
- RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
- Last => R_Socket_Set.Last);
- Set (RSet, Selector.R_Sig_Socket);
+ RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
+ Last => R_Socket_Set.Last);
+ Set (RSet, RSig);
- -- Copy W_Socket_Set in WSet
+ -- Copy W_Socket_Set in WSet
- WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
- Last => W_Socket_Set.Last);
+ WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
+ Last => W_Socket_Set.Last);
- -- Copy E_Socket_Set in ESet
+ -- Copy E_Socket_Set in ESet
- ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
- Last => E_Socket_Set.Last);
+ ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
+ Last => E_Socket_Set.Last);
- Last := C.int'Max (C.int'Max (C.int (RSet.Last),
- C.int (WSet.Last)),
- C.int (ESet.Last));
+ Last := C.int'Max (C.int'Max (C.int (RSet.Last),
+ C.int (WSet.Last)),
+ C.int (ESet.Last));
- Res :=
- C_Select
- (Last + 1,
- RSet.Set,
- WSet.Set,
- ESet.Set,
- TPtr);
+ Res :=
+ C_Select
+ (Last + 1,
+ RSet.Set,
+ WSet.Set,
+ ESet.Set,
+ TPtr);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
- -- If Select was resumed because of read signalling socket, read this
- -- data and remove socket from set.
+ -- If Select was resumed because of read signalling socket, read this
+ -- data and remove socket from set.
- if Is_Set (RSet, Selector.R_Sig_Socket) then
- Clear (RSet, Selector.R_Sig_Socket);
+ if Is_Set (RSet, RSig) then
+ Clear (RSet, RSig);
- declare
- Buf : Character;
+ declare
+ Buf : Character;
- begin
- Res := C_Recv (C.int (Selector.R_Sig_Socket), Buf'Address, 1, 0);
+ begin
+ Res := C_Recv (C.int (RSig), Buf'Address, 1, 0);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
- end;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
+ end;
- Status := Aborted;
+ Status := Aborted;
- elsif Res = 0 then
- Status := Expired;
- end if;
+ elsif Res = 0 then
+ Status := Expired;
+ end if;
- -- Update RSet, WSet and ESet in regard to their new socket sets
+ -- Update RSet, WSet and ESet in regard to their new socket sets
- Narrow (RSet);
- Narrow (WSet);
- Narrow (ESet);
+ Narrow (RSet);
+ Narrow (WSet);
+ Narrow (ESet);
- -- Reset RSet as it should be if R_Sig_Socket was not added
+ -- Reset RSet as it should be if R_Sig_Socket was not added
- if Is_Empty (RSet) then
- Empty (RSet);
- end if;
+ if Is_Empty (RSet) then
+ Empty (RSet);
+ end if;
- if Is_Empty (WSet) then
- Empty (WSet);
- end if;
+ if Is_Empty (WSet) then
+ Empty (WSet);
+ end if;
- if Is_Empty (ESet) then
- Empty (ESet);
- end if;
+ if Is_Empty (ESet) then
+ Empty (ESet);
+ end if;
- -- Deliver RSet, WSet and ESet
+ -- Deliver RSet, WSet and ESet
- Empty (R_Socket_Set);
- R_Socket_Set := RSet;
+ Empty (R_Socket_Set);
+ R_Socket_Set := RSet;
- Empty (W_Socket_Set);
- W_Socket_Set := WSet;
+ Empty (W_Socket_Set);
+ W_Socket_Set := WSet;
- Empty (E_Socket_Set);
- E_Socket_Set := ESet;
+ Empty (E_Socket_Set);
+ E_Socket_Set := ESet;
+
+ exception
+
+ when Socket_Error =>
+
+ -- The local socket sets must be emptied before propagating
+ -- Socket_Error so the associated storage is freed.
+
+ Empty (RSet);
+ Empty (WSet);
+ Empty (ESet);
+ raise;
+ end;
end Check_Selector;
-----------
-- Close_Selector --
--------------------
- -- Comments needed below ???
- -- Why are exceptions ignored ???
-
procedure Close_Selector (Selector : in out Selector_Type) is
begin
+
+ -- Close the signalling sockets used internally for the implementation
+ -- of Abort_Selector. Exceptions are ignored because these sockets
+ -- are implementation artefacts of no interest to the user, and
+ -- there is little that can be done if either Close_Socket call fails
+ -- (which theoretically should not happen anyway). We also want to try
+ -- to perform the second Close_Socket even if the first one failed.
+
begin
Close_Socket (Selector.R_Sig_Socket);
exception
Item.Last := No_Socket;
end Empty;
+ --------------------
+ -- Err_Code_Image --
+ --------------------
+
+ function Err_Code_Image (E : Integer) return String is
+ Msg : String := E'Img & "] ";
+ begin
+ Msg (Msg'First) := '[';
+ return Msg;
+ end Err_Code_Image;
+
--------------
-- Finalize --
--------------
Res := C_Gethostbyaddr (HA'Address, HA'Size / 8, Constants.AF_INET);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
Res := C_Gethostbyname (HN);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
+ VT : aliased Timeval;
Len : aliased C.int;
Add : System.Address;
Res : C.int;
No_Delay |
Send_Buffer |
Receive_Buffer |
+ Multicast_If |
Error =>
Len := V4'Size / 8;
Add := V4'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
when Linger |
Add_Membership |
Drop_Membership =>
To_Inet_Addr (To_In_Addr (V8 (V8'First)), Opt.Multicast_Address);
To_Inet_Addr (To_In_Addr (V8 (V8'Last)), Opt.Local_Interface);
+ when Multicast_If =>
+ To_Inet_Addr (To_In_Addr (V4), Opt.Outgoing_If);
+
when Multicast_TTL =>
Opt.Time_To_Live := Integer (V1);
when Multicast_Loop =>
Opt.Enabled := (V1 /= 0);
+ when Send_Timeout |
+ Receive_Timeout =>
+ Opt.Timeout := To_Duration (VT);
+
end case;
return Opt;
-- Raise_Host_Error --
----------------------
- procedure Raise_Host_Error (Error : Integer) is
+ procedure Raise_Host_Error (H_Error : Integer) is
function Host_Error_Message return String;
- -- We do not use a C function like strerror because hstrerror
- -- that would correspond seems to be obsolete. Return
- -- appropriate string for error value.
+ -- We do not use a C function like strerror because hstrerror that would
+ -- correspond is obsolete. Return appropriate string for error value.
------------------------
-- Host_Error_Message --
function Host_Error_Message return String is
begin
- case Error is
+ case H_Error is
when Constants.HOST_NOT_FOUND => return "Host not found";
when Constants.TRY_AGAIN => return "Try again";
when Constants.NO_RECOVERY => return "No recovery";
-- Start of processing for Raise_Host_Error
begin
- Ada.Exceptions.Raise_Exception (Host_Error'Identity, Host_Error_Message);
+ Ada.Exceptions.Raise_Exception (Host_Error'Identity,
+ Err_Code_Image (H_Error)
+ & Host_Error_Message);
end Raise_Host_Error;
------------------------
procedure Raise_Socket_Error (Error : Integer) is
use type C.Strings.chars_ptr;
-
- function Image (E : Integer) return String;
-
- -----------
- -- Image --
- -----------
-
- function Image (E : Integer) return String is
- Msg : String := E'Img & "] ";
- begin
- Msg (Msg'First) := '[';
- return Msg;
- end Image;
-
- -- Start of processing for Raise_Socket_Error
-
begin
- Ada.Exceptions.Raise_Exception
- (Socket_Error'Identity,
- Image (Error) & C.Strings.Value (Socket_Error_Message (Error)));
+ Ada.Exceptions.Raise_Exception (Socket_Error'Identity,
+ Err_Code_Image (Error)
+ & C.Strings.Value (Socket_Error_Message (Error)));
end Raise_Socket_Error;
----------
is
Id : constant Exception_Id := Exception_Identity (Occurrence);
Msg : constant String := Exception_Message (Occurrence);
- First : Natural := Msg'First;
+ First : Natural;
Last : Natural;
Val : Integer;
begin
+ First := Msg'First;
while First <= Msg'Last
and then Msg (First) not in '0' .. '9'
loop
end if;
Last := First;
-
while Last < Msg'Last
and then Msg (Last + 1) in '0' .. '9'
loop
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
- Len : aliased C.int;
+ VT : aliased Timeval;
+ Len : C.int;
Add : System.Address := Null_Address;
Res : C.int;
Len := V8'Size / 8;
Add := V8'Address;
+ when Multicast_If =>
+ V4 := To_Int (To_In_Addr (Option.Outgoing_If));
+ Len := V4'Size / 8;
+ Add := V4'Address;
+
when Multicast_TTL =>
V1 := C.unsigned_char (Option.Time_To_Live);
Len := V1'Size / 8;
Len := V1'Size / 8;
Add := V1'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ VT := To_Timeval (Option.Timeout);
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
end case;
Res := C_Setsockopt
return Integer (Socket);
end To_C;
+ -----------------
+ -- To_Duration --
+ -----------------
+
+ function To_Duration (Val : Timeval) return Timeval_Duration is
+ begin
+ return Natural (Val.Tv_Sec) * 1.0 + Natural (Val.Tv_Usec) * 1.0E-6;
+ end To_Duration;
+
-------------------
-- To_Host_Entry --
-------------------
if Flags (J) = -1 then
Raise_Socket_Error (Constants.EOPNOTSUPP);
end if;
+
Result := Result + Flags (J);
end if;
-- To_Timeval --
----------------
- function To_Timeval (Val : Selector_Duration) return Timeval is
- S : Timeval_Unit;
- MS : Timeval_Unit;
+ function To_Timeval (Val : Timeval_Duration) return Timeval is
+ S : time_t;
+ uS : suseconds_t;
begin
-- If zero, set result as zero (otherwise it gets rounded down to -1)
if Val = 0.0 then
S := 0;
- MS := 0;
+ uS := 0;
-- Normal case where we do round down
else
- S := Timeval_Unit (Val - 0.5);
- MS := Timeval_Unit (1_000_000 * (Val - Selector_Duration (S)));
+ S := time_t (Val - 0.5);
+ uS := suseconds_t (1_000_000 * (Val - Selector_Duration (S)));
end if;
- return (S, MS);
+ return (S, uS);
end To_Timeval;
-----------
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Host_Error : exception;
-- Exception raised by the two following procedures. Once raised, its
-- message contains a string describing the error code. This exception is
- -- raised when an host entry can not be retrieved.
+ -- raised when an host entry cannot be retrieved.
function Get_Host_By_Address
(Address : Inet_Addr_Type;
Unknown_Server_Error,
Cannot_Resolve_Error);
+ -- Timeval_Duration is a subtype of Standard.Duration because the full
+ -- range of Standard.Duration cannot be represented in the equivalent C
+ -- structure. Moreover, negative values are not allowed to avoid system
+ -- incompatibilities.
+
+ Immediate : constant := 0.0;
+ Forever : constant := Duration (Integer'Last) * 1.0;
+
+ subtype Timeval_Duration is Duration range Immediate .. Forever;
+
-- Get_Socket_Options and Set_Socket_Options manipulate options associated
-- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level.
-- a boolean to enable or disable this option.
type Option_Name is (
- Keep_Alive, -- Enable sending of keep-alive messages
- Reuse_Address, -- Allow bind to reuse local address
- Broadcast, -- Enable datagram sockets to recv/send broadcast packets
- Send_Buffer, -- Set/get the maximum socket send buffer in bytes
- Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
- Linger, -- Shutdown wait for msg to be sent or timeout occur
- Error, -- Get and clear the pending socket error
- No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
- Add_Membership, -- Join a multicast group
- Drop_Membership, -- Leave a multicast group
- Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
- Multicast_Loop); -- Sent multicast packets are looped to the local socket
+ Keep_Alive, -- Enable sending of keep-alive messages
+ Reuse_Address, -- Allow bind to reuse local address
+ Broadcast, -- Enable datagram sockets to recv/send broadcasts
+ Send_Buffer, -- Set/get the maximum socket send buffer in bytes
+ Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
+ Linger, -- Shutdown wait for msg to be sent or timeout occur
+ Error, -- Get and clear the pending socket error
+ No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
+ Add_Membership, -- Join a multicast group
+ Drop_Membership, -- Leave a multicast group
+ Multicast_If, -- Set default outgoing interface for multicast packets
+ Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
+ Multicast_Loop, -- Sent multicast packets are looped to local socket
+ Send_Timeout, -- Set timeout value for output
+ Receive_Timeout); -- Set timeout value for input
type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is
Multicast_Address : Inet_Addr_Type;
Local_Interface : Inet_Addr_Type;
+ when Multicast_If =>
+ Outgoing_If : Inet_Addr_Type;
+
when Multicast_TTL =>
Time_To_Live : Natural;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Timeout : Timeval_Duration;
+
end case;
end record;
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
- -- Selector_Duration is a subtype of Standard.Duration because the full
- -- range of Standard.Duration cannot be represented in the equivalent C
- -- structure. Moreover, negative values are not allowed to avoid system
- -- incompatibilities.
-
- Immediate : constant := 0.0;
- Forever : constant := Duration (Integer'Last) * 1.0;
-
- subtype Selector_Duration is Duration range Immediate .. Forever;
+ subtype Selector_Duration is Timeval_Duration;
procedure Create_Selector (Selector : out Selector_Type);
-- Create a new selector
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
function Standard_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
pragma Import (Stdcall, Standard_Connect, "connect");
function Standard_Select
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
pragma Import (Stdcall, Standard_Select, "select");
type Error_Type is
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int
+ Namelen : C.int) return C.int
is
Res : C.int;
function C_Readv
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int
+ Timeout : Timeval_Access) return C.int
is
pragma Warnings (Off, Exceptfds);
function C_Writev
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
--------------------------
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr
+ (Errno : Integer) return C.Strings.chars_ptr
is
- use GNAT.Sockets.Constants;
-
begin
case Errno is
when EINTR => return Error_Messages (N_EINTR);
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Set last socket error number
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr;
+ (Errno : Integer) return C.Strings.chars_ptr;
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.long;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_sec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_usec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access)
- return C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
(S : C.int;
- How : C.int)
- return C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
function To_Pointer is
new Unchecked_Conversion (System.Address, int_Access);
- procedure VxWorks_Gethostbyaddr
- (Addr : C.int; Buf : out C.char_array);
- pragma Import (C, VxWorks_Gethostbyaddr, "hostGetByAddr");
+ function VxWorks_hostGetByAddr
+ (Addr : C.int; Buf : System.Address) return C.int;
+ pragma Import (C, VxWorks_hostGetByAddr, "hostGetByAddr");
- Host_Name : C.char_array (1 .. Max_Name_Length);
+ Host_Name : aliased C.char_array (1 .. Max_Name_Length);
begin
- VxWorks_Gethostbyaddr (To_Pointer (Addr).all, Host_Name);
+ if VxWorks_hostGetByAddr (To_Pointer (Addr).all,
+ Host_Name (Host_Name'First)'Address)
+ /= Constants.OK
+ then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (To_Pointer (Addr).all);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (Host_Name);
function C_Gethostbyname
(Name : C.char_array) return Hostent_Access
is
- function VxWorks_Gethostbyname
+ function VxWorks_hostGetByName
(Name : C.char_array) return C.int;
- pragma Import (C, VxWorks_Gethostbyname, "hostGetByName");
+ pragma Import (C, VxWorks_hostGetByName, "hostGetByName");
Addr : C.int;
begin
- Addr := VxWorks_Gethostbyname (Name);
+ Addr := VxWorks_hostGetByName (Name);
+ if Addr /= Constants.OK then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (Addr);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (To_C (Host_Name));
function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean;
-
begin
Task_Lock.Lock;
R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
- (S : C.int;
- Req : C.int;
- Arg : Int_Access)
- return C.int;
+ (S : C.int;
+ Req : C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
- (S : C.int;
- How : C.int)
- return C.int;
+ (S : C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
* *
* G E N - S O C C O N *
* *
- * Copyright (C) 2004-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 2004-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
/* This program generates g-soccon.ads */
/* To build using DEC C:
- CC/DEFINE="TARGET=OpenVMS" gen-soccon
+ CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
LINK gen-soccon
RUN gen-soccon
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
+
+#ifdef __MINGW32__
+#include <fcntl.h>
+#endif
#include "gsocket.h"
#define _NL TXT("")
/* Empty line */
-#define itoad(n) f_itoa ("%d", n)
-#define itoax(n) f_itoa ("16#%08x#", n)
+#define itoad(n) f_itoa ("%d", (n))
+#define itoax(n) f_itoa ("16#%08x#", (n))
#define CND(name,comment) add_line(#name, itoad (name), comment);
/* Constant (decimal) */
void add_line (char *, char*, char*);
+#ifdef __MINGW32__
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
int
main (void) {
TXT("-- --")
TXT("-- S p e c --")
TXT("-- --")
-TXT("-- Copyright (C) 2000-2005 Free Software Foundation, Inc. --")
+TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --")
TXT("-- --")
TXT("-- GNAT is free software; you can redistribute it and/or modify it under --")
TXT("-- terms of the GNU General Public License as published by the Free Soft- --")
TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
TXT("-- directly with'ed by an applications program.")
_NL
-TXT("-- This is the version for " STR (TARGET))
+TXT("-- This is the version for " TARGET)
TXT("-- This file is generated automatically, do not modify it by hand! Instead,")
TXT("-- make changes to gen-soccon.c and re-run it on each target.")
_NL
#endif
CND(IOV_MAX, "Maximum writev iovcnt")
+_NL
+TXT(" ----------------------")
+TXT(" -- Type definitions --")
+TXT(" ----------------------")
+_NL
+
+{
+ struct timeval tv;
+TXT(" -- Sizes (in bytes) of the components of struct timeval")
+_NL
+#define SIZEOF_tv_sec (sizeof tv.tv_sec)
+CND(SIZEOF_tv_sec, "tv_sec")
+#define SIZEOF_tv_usec (sizeof tv.tv_usec)
+CND(SIZEOF_tv_usec, "tv_usec")
+}
+
+#ifdef __vxworks
+_NL
+TXT(" --------------------------------")
+TXT(" -- VxWorks-specific constants --")
+TXT(" --------------------------------")
+_NL
+TXT(" -- These constants may be used only within the VxWorks version of")
+TXT(" -- GNAT.Sockets.Thin.")
+_NL
+
+CND(OK, "VxWorks generic success")
+CND(ERROR, "VxWorks generic error")
+#endif
+
_NL
TXT("end GNAT.Sockets.Constants;")
void
add_line (char *_text, char *_value, char *_comment) {
struct line *l = (struct line *) malloc (sizeof (struct line));
+
l->text = _text;
l->value = _value;
l->comment = _comment;
#if defined(__vxworks)
#include <vxWorks.h>
#include <ioLib.h>
+#include <hostLib.h>
+#include <resolvLib.h>
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#include <errno.h>
#endif
-#ifndef __vxworks
+#ifdef __vxworks
+#include <sys/times.h>
+#else
#include <sys/time.h>
#endif
/* Required for __gnat_malloc() */
#include <string.h>
+/* Required for memcpy() */
extern void __gnat_disable_sigpipe (int fd);
extern void __gnat_free_socket_set (fd_set *);
extern int __gnat_is_socket_in_set (fd_set *, int);
extern fd_set *__gnat_new_socket_set (fd_set *);
extern void __gnat_remove_socket_from_set (fd_set *, int);
+extern int __gnat_get_h_errno (void);
\f
/* Disable the sending of SIGPIPE for writes on a broken stream */
+
void
__gnat_disable_sigpipe (int fd)
{
{
FD_CLR (socket, set);
}
+
+/* Get the value of the last host error */
+
+int
+__gnat_get_h_errno (void) {
+#ifdef __vxworks
+ int vxw_errno = errno;
+
+ switch (vxw_errno) {
+ case 0:
+ return 0;
+
+ case S_resolvLib_HOST_NOT_FOUND:
+ case S_hostLib_UNKNOWN_HOST:
+ return HOST_NOT_FOUND;
+
+ case S_resolvLib_TRY_AGAIN:
+ return TRY_AGAIN;
+
+ case S_resolvLib_NO_RECOVERY:
+ case S_resolvLib_BUFFER_2_SMALL:
+ case S_resolvLib_INVALID_PARAMETER:
+ case S_resolvLib_INVALID_ADDRESS:
+ case S_hostLib_INVALID_PARAMETER:
+ return NO_RECOVERY;
+
+ case S_resolvLib_NO_DATA:
+ return NO_DATA;
+
+ default:
+ return -1;
+ }
+#elif defined(VMS)
+ return errno;
+#else
+ return h_errno;
+#endif
+}