Makefile.rtl (GNAT.Sockets.Thin_Common): New unit.

2008-05-20  Thomas Quinot  <quinot@adacore.com>

	* Makefile.rtl (GNAT.Sockets.Thin_Common): New unit.

	* g-sttsne-vxworks.adb: Add missing dependency on Sockets.Constants.
	Add missing "with" of Ada.Unchecked_Conversion

	* g-soccon-linux-ppc.ads, g-soccon-linux-64.ads, g-soccon-lynxos.ads, 
	g-soccon-linux-x86.ads, g-soccon-hpux-ia64.ads, 
	g-soccon-solaris-64.ads, g-soccon-tru64.ads, g-soccon-aix.ads, 
	g-soccon-irix.ads, g-soccon-hpux.ads, g-soccon-solaris.ads, 
	g-soccon-vms.ads, g-soccon-mingw.ads, g-soccon-vxworks.ads, 
	g-socthi-vxworks.adb, g-soccon-freebsd.ads, g-soccon.ads: 
	Move common code out of GNAT.Sockets.Thin implementations and into
	Thin_Common.
	New constant SIZEOF_fd_set
	New flag Has_Sockaddr_Len
	New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6

	* g-stsifd-sockets.adb
	(Create): Remove call to Set_Length; use Set_Family to set the family
	and (on appropriate platforms) length fields in struct sockaddr.

	* g-socthi.adb, g-socthi.ads, g-socthi-vms.ads, g-socthi-vms.adb, 
	g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi-vxworks.adb, 
	g-soccon-darwin.ads, g-soccon-darwin.ads: New constant SIZEOF_fd_set
	Move common code out of GNAT.Sockets.Thin implementations and into
	Thin_Common.

	* g-socket.ads, g-socket.adb: 
	Move common code out of GNAT.Sockets.Thin implementations and into
	Thin_Common.
	(Connect_Socket, Accept_Socket): Provide new versions of these two
	routines that operate with a user specified timeout.
	(Bind_Socket, Connect_Socket, Send_Socket): Remove calls to Set_Length,
	this is now handled automatically by Set_Family on platforms that
	require it.

	* gen-soccon.c: 
	Move common code out of GNAT.Sockets.Thin implementations and into
	Thin_Common.
	(SIZEOF_sockaddr_in6): On platforms where IPv6 is not supported, define
	this constant to 0 (not -1) because we use it to initialize an
	unsigned_char value.
	Align values for numeric constants only.
	Handle the case of systems that do not support AF_INET6.
	New constant SIZEOF_fd_set
	New flag Has_Sockaddr_Len
	New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6

	* gsocket.h: New flag Has_Sockaddr_Len
	New constants SIZEOF_sockaddr_in, SIZEOF_sockaddr_in6

From-SVN: r135612
This commit is contained in:
Thomas Quinot 2008-05-20 14:43:29 +02:00 committed by Arnaud Charlet
parent 0190265374
commit f983388f04
31 changed files with 2069 additions and 2464 deletions

View File

@ -368,6 +368,7 @@ GNATRTL_NONTASKING_OBJS= \
g-socket$(objext) \
g-socthi$(objext) \
g-soliop$(objext) \
g-sothco$(objext) \
g-souinf$(objext) \
g-speche$(objext) \
g-spchge$(objext) \

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 24; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 24; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 67; -- Address already in use
EADDRNOTAVAIL : constant := 68; -- Cannot assign address
EAFNOSUPPORT : constant := 66; -- Addr family not supported
EALREADY : constant := 56; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 72; -- Connection aborted
ECONNREFUSED : constant := 79; -- Connection refused
ECONNRESET : constant := 73; -- Connection reset by peer
EDESTADDRREQ : constant := 58; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 80; -- Host is down
EHOSTUNREACH : constant := 81; -- No route to host
EINPROGRESS : constant := 55; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 75; -- Socket already connected
ELOOP : constant := 85; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 59; -- Message too long
ENAMETOOLONG : constant := 86; -- Name too long
ENETDOWN : constant := 69; -- Network is down
ENETRESET : constant := 71; -- Disconn. on network reset
ENETUNREACH : constant := 70; -- Network is unreachable
ENOBUFS : constant := 74; -- No buffer space available
ENOPROTOOPT : constant := 61; -- Protocol not available
ENOTCONN : constant := 76; -- Socket not connected
ENOTSOCK : constant := 57; -- Operation on non socket
EOPNOTSUPP : constant := 64; -- Operation not supported
EPFNOSUPPORT : constant := 65; -- Unknown protocol family
EPROTONOSUPPORT : constant := 62; -- Unknown protocol
EPROTOTYPE : constant := 60; -- Unknown protocol type
ESHUTDOWN : constant := 77; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 63; -- Socket type not supported
ETIMEDOUT : constant := 78; -- Connection timed out
ETOOMANYREFS : constant := 115; -- Too many references
EWOULDBLOCK : constant := 11; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 67; -- Address already in use
EADDRNOTAVAIL : constant := 68; -- Cannot assign address
EAFNOSUPPORT : constant := 66; -- Addr family not supported
EALREADY : constant := 56; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 72; -- Connection aborted
ECONNREFUSED : constant := 79; -- Connection refused
ECONNRESET : constant := 73; -- Connection reset by peer
EDESTADDRREQ : constant := 58; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 80; -- Host is down
EHOSTUNREACH : constant := 81; -- No route to host
EINPROGRESS : constant := 55; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 75; -- Socket already connected
ELOOP : constant := 85; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 59; -- Message too long
ENAMETOOLONG : constant := 86; -- Name too long
ENETDOWN : constant := 69; -- Network is down
ENETRESET : constant := 71; -- Disconn. on network reset
ENETUNREACH : constant := 70; -- Network is unreachable
ENOBUFS : constant := 74; -- No buffer space available
ENOPROTOOPT : constant := 61; -- Protocol not available
ENOTCONN : constant := 76; -- Socket not connected
ENOTSOCK : constant := 57; -- Operation on non socket
EOPNOTSUPP : constant := 64; -- Operation not supported
EPFNOSUPPORT : constant := 65; -- Unknown protocol family
EPROTONOSUPPORT : constant := 62; -- Unknown protocol
EPROTOTYPE : constant := 60; -- Unknown protocol type
ESHUTDOWN : constant := 77; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 63; -- Socket type not supported
ETIMEDOUT : constant := 78; -- Connection timed out
ETOOMANYREFS : constant := 115; -- 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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 16; -- Maximum writev iovcnt
IOV_MAX : constant := 16; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 8192; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -35,141 +35,142 @@
-- 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-apple-darwin8.9.0
-- This is the version for i386-apple-darwin8.8.4
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 30; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 30; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- 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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 28; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 28; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- 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
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
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
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
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 := 131072; -- No SIGPIPE on send
MSG_Forced_Flags : constant := 0;
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 := 131072; -- 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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 1; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 22; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 16; -- Maximum writev iovcnt
IOV_MAX : constant := 16; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 8; -- tv_sec
SIZEOF_tv_usec : constant := 8; -- tv_usec
SIZEOF_tv_sec : constant := 8; -- tv_sec
SIZEOF_tv_usec : constant := 8; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 256; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := -1; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := -1; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 16; -- Maximum writev iovcnt
IOV_MAX : constant := 16; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 0; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 256; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 24; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 24; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 2; -- Stream socket
SOCK_DGRAM : constant := 1; -- Datagram socket
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 20; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 21; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 20; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 21; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 10; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 8; -- tv_sec
SIZEOF_tv_usec : constant := 8; -- tv_usec
SIZEOF_tv_sec : constant := 8; -- tv_sec
SIZEOF_tv_usec : constant := 8; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -35,141 +35,142 @@
-- 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 is the version for ppc-unknown-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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 10; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 10; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 28; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 28; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
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 links
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
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 links
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
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
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
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
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 := 128; -- Send end of record
MSG_WAITALL : constant := 256; -- Wait for full reception
MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
MSG_Forced_Flags : constant := 0;
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 := -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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 512; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 23; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 23; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 10013; -- Permission denied
EADDRINUSE : constant := 10048; -- Address already in use
EADDRNOTAVAIL : constant := 10049; -- Cannot assign address
EAFNOSUPPORT : constant := 10047; -- Addr family not supported
EALREADY : constant := 10037; -- Operation in progress
EBADF : constant := 10009; -- Bad file descriptor
ECONNABORTED : constant := 10053; -- Connection aborted
ECONNREFUSED : constant := 10061; -- Connection refused
ECONNRESET : constant := 10054; -- Connection reset by peer
EDESTADDRREQ : constant := 10039; -- Destination addr required
EFAULT : constant := 10014; -- Bad address
EHOSTDOWN : constant := 10064; -- Host is down
EHOSTUNREACH : constant := 10065; -- No route to host
EINPROGRESS : constant := 10036; -- Operation now in progress
EINTR : constant := 10004; -- Interrupted system call
EINVAL : constant := 10022; -- Invalid argument
EIO : constant := 10101; -- Input output error
EISCONN : constant := 10056; -- Socket already connected
ELOOP : constant := 10062; -- Too many symbolic links
EMFILE : constant := 10024; -- Too many open files
EMSGSIZE : constant := 10040; -- Message too long
ENAMETOOLONG : constant := 10063; -- Name too long
ENETDOWN : constant := 10050; -- Network is down
ENETRESET : constant := 10052; -- Disconn. on network reset
ENETUNREACH : constant := 10051; -- Network is unreachable
ENOBUFS : constant := 10055; -- No buffer space available
ENOPROTOOPT : constant := 10042; -- Protocol not available
ENOTCONN : constant := 10057; -- Socket not connected
ENOTSOCK : constant := 10038; -- Operation on non socket
EOPNOTSUPP : constant := 10045; -- Operation not supported
EPFNOSUPPORT : constant := 10046; -- Unknown protocol family
EPROTONOSUPPORT : constant := 10043; -- Unknown protocol
EPROTOTYPE : constant := 10041; -- Unknown protocol type
ESHUTDOWN : constant := 10058; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 10044; -- Socket type not supported
ETIMEDOUT : constant := 10060; -- Connection timed out
ETOOMANYREFS : constant := 10059; -- Too many references
EWOULDBLOCK : constant := 10035; -- Operation would block
EACCES : constant := 10013; -- Permission denied
EADDRINUSE : constant := 10048; -- Address already in use
EADDRNOTAVAIL : constant := 10049; -- Cannot assign address
EAFNOSUPPORT : constant := 10047; -- Addr family not supported
EALREADY : constant := 10037; -- Operation in progress
EBADF : constant := 10009; -- Bad file descriptor
ECONNABORTED : constant := 10053; -- Connection aborted
ECONNREFUSED : constant := 10061; -- Connection refused
ECONNRESET : constant := 10054; -- Connection reset by peer
EDESTADDRREQ : constant := 10039; -- Destination addr required
EFAULT : constant := 10014; -- Bad address
EHOSTDOWN : constant := 10064; -- Host is down
EHOSTUNREACH : constant := 10065; -- No route to host
EINPROGRESS : constant := 10036; -- Operation now in progress
EINTR : constant := 10004; -- Interrupted system call
EINVAL : constant := 10022; -- Invalid argument
EIO : constant := 10101; -- Input output error
EISCONN : constant := 10056; -- Socket already connected
ELOOP : constant := 10062; -- Too many symbolic links
EMFILE : constant := 10024; -- Too many open files
EMSGSIZE : constant := 10040; -- Message too long
ENAMETOOLONG : constant := 10063; -- Name too long
ENETDOWN : constant := 10050; -- Network is down
ENETRESET : constant := 10052; -- Disconn. on network reset
ENETUNREACH : constant := 10051; -- Network is unreachable
ENOBUFS : constant := 10055; -- No buffer space available
ENOPROTOOPT : constant := 10042; -- Protocol not available
ENOTCONN : constant := 10057; -- Socket not connected
ENOTSOCK : constant := 10038; -- Operation on non socket
EOPNOTSUPP : constant := 10045; -- Operation not supported
EPFNOSUPPORT : constant := 10046; -- Unknown protocol family
EPROTONOSUPPORT : constant := 10043; -- Unknown protocol
EPROTOTYPE : constant := 10041; -- Unknown protocol type
ESHUTDOWN : constant := 10058; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 10044; -- Socket type not supported
ETIMEDOUT : constant := 10060; -- Connection timed out
ETOOMANYREFS : constant := 10059; -- Too many references
EWOULDBLOCK : constant := 10035; -- Operation would block
-----------------
-- Host errors --
-----------------
HOST_NOT_FOUND : constant := 11001; -- Unknown host
TRY_AGAIN : constant := 11002; -- Host name lookup failure
NO_DATA : constant := 11004; -- No data record for name
NO_RECOVERY : constant := 11003; -- Non recoverable errors
HOST_NOT_FOUND : constant := 11001; -- Unknown host
TRY_AGAIN : constant := 11002; -- Host name lookup failure
NO_DATA : constant := 11004; -- No data record for name
NO_RECOVERY : constant := 11003; -- Non recoverable errors
-------------------
-- Control flags --
-------------------
FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
FIONREAD : constant := 1074030207; -- How many bytes to read
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
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
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 := -1; -- Send end of record
MSG_WAITALL : constant := -1; -- Wait for full reception
MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
MSG_Forced_Flags : constant := 0;
MSG_OOB : constant := 1; -- Process out-of-band data
MSG_PEEK : constant := 2; -- Peek at incoming data
MSG_EOR : constant := -1; -- Send end of record
MSG_WAITALL : constant := -1; -- 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_REUSEPORT : constant := -1; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := 19; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := 19; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,14 +178,32 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 4100; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.short;
subtype H_Length_T is Interfaces.C.short;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
------------------------------
-- MinGW-specific constants --
@ -193,16 +212,9 @@ package GNAT.Sockets.Constants is
-- These constants may be used only within the MinGW version of
-- GNAT.Sockets.Thin.
WSASYSNOTREADY : constant := 10091; -- System not ready
WSAVERNOTSUPPORTED : constant := 10092; -- Version not supported
WSANOTINITIALISED : constant := 10093; -- Winsock not initialized
WSAEDISCON : constant := 10101; -- Disconnected
----------------------
-- Additional flags --
----------------------
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
WSASYSNOTREADY : constant := 10091; -- System not ready
WSAVERNOTSUPPORTED : constant := 10092; -- Version not supported
WSANOTINITIALISED : constant := 10093; -- Winsock not initialized
WSAEDISCON : constant := 10101; -- Disconnected
end GNAT.Sockets.Constants;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -35,141 +35,142 @@
-- 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 sparc64-sun-solaris2.8
-- This is the version for sparc-sun-solaris2.8
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 16; -- Maximum writev iovcnt
IOV_MAX : constant := 16; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 8; -- tv_sec
SIZEOF_tv_usec : constant := 8; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 16; -- Maximum writev iovcnt
IOV_MAX : constant := 16; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- 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
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
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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 32; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 512; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -39,137 +39,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 26; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 37; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 39; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 64; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 36; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 62; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 40; -- Message too long
ENAMETOOLONG : constant := 63; -- Name too long
ENETDOWN : constant := 50; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 38; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 35; -- 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
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
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
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
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 := 128; -- Wait for full reception
MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
MSG_Forced_Flags : constant := 0;
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 := 128; -- 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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,18 +178,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 512; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -35,141 +35,142 @@
-- 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-wrs-vxworks
-- This is the version for VxWorks
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := -1; -- IPv6 address family
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 28; -- IPv6 address family
-----------
-- Modes --
-----------
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
SOCK_STREAM : constant := 1; -- Stream socket
SOCK_DGRAM : constant := 2; -- Datagram socket
-------------------
-- Socket errors --
-------------------
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 69; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 40; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 67; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 68; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 64; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 36; -- Message too long
ENAMETOOLONG : constant := 26; -- Name too long
ENETDOWN : constant := 62; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 50; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 70; -- Operation would block
EACCES : constant := 13; -- Permission denied
EADDRINUSE : constant := 48; -- Address already in use
EADDRNOTAVAIL : constant := 49; -- Cannot assign address
EAFNOSUPPORT : constant := 47; -- Addr family not supported
EALREADY : constant := 69; -- Operation in progress
EBADF : constant := 9; -- Bad file descriptor
ECONNABORTED : constant := 53; -- Connection aborted
ECONNREFUSED : constant := 61; -- Connection refused
ECONNRESET : constant := 54; -- Connection reset by peer
EDESTADDRREQ : constant := 40; -- Destination addr required
EFAULT : constant := 14; -- Bad address
EHOSTDOWN : constant := 67; -- Host is down
EHOSTUNREACH : constant := 65; -- No route to host
EINPROGRESS : constant := 68; -- Operation now in progress
EINTR : constant := 4; -- Interrupted system call
EINVAL : constant := 22; -- Invalid argument
EIO : constant := 5; -- Input output error
EISCONN : constant := 56; -- Socket already connected
ELOOP : constant := 64; -- Too many symbolic links
EMFILE : constant := 24; -- Too many open files
EMSGSIZE : constant := 36; -- Message too long
ENAMETOOLONG : constant := 26; -- Name too long
ENETDOWN : constant := 62; -- Network is down
ENETRESET : constant := 52; -- Disconn. on network reset
ENETUNREACH : constant := 51; -- Network is unreachable
ENOBUFS : constant := 55; -- No buffer space available
ENOPROTOOPT : constant := 42; -- Protocol not available
ENOTCONN : constant := 57; -- Socket not connected
ENOTSOCK : constant := 50; -- Operation on non socket
EOPNOTSUPP : constant := 45; -- Operation not supported
EPFNOSUPPORT : constant := 46; -- Unknown protocol family
EPROTONOSUPPORT : constant := 43; -- Unknown protocol
EPROTOTYPE : constant := 41; -- Unknown protocol type
ESHUTDOWN : constant := 58; -- Cannot send once shutdown
ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
ETIMEDOUT : constant := 60; -- Connection timed out
ETOOMANYREFS : constant := 59; -- Too many references
EWOULDBLOCK : constant := 70; -- 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
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 := 16; -- Set/clear non-blocking io
FIONREAD : constant := 1; -- How many bytes to read
FIONBIO : constant := 16; -- Set/clear non-blocking io
FIONREAD : constant := 1; -- 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
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
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;
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_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address
SO_REUSEPORT : constant := 512; -- Bind reuse port number
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 := 9; -- Set/get mcast interface
IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -177,14 +178,32 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 256; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 1; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
--------------------------------
-- VxWorks-specific constants --
@ -193,14 +212,7 @@ package GNAT.Sockets.Constants is
-- 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
----------------------
-- Additional flags --
----------------------
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
OK : constant := 0; -- VxWorks generic success
ERROR : constant := -1; -- VxWorks generic error
end GNAT.Sockets.Constants;

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
-- Copyright (C) 2000-2008, 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- --
@ -46,137 +46,138 @@
-- 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.
with Interfaces.C;
package GNAT.Sockets.Constants is
--------------
-- Families --
--------------
AF_INET : constant := 2; -- IPv4 address family
AF_INET6 : constant := 10; -- IPv6 address family
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
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 links
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
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 links
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
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
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
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
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;
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_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address
SO_REUSEPORT : constant := -1; -- Bind reuse port number
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
IP_PKTINFO : constant := 8; -- Get datagram info
-------------------
-- System limits --
-------------------
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
----------------------
-- Type definitions --
@ -184,18 +185,29 @@ package GNAT.Sockets.Constants is
-- Sizes (in bytes) of the components of struct timeval
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
SIZEOF_tv_sec : constant := 4; -- tv_sec
SIZEOF_tv_usec : constant := 4; -- tv_usec
-- Sizes of protocol specific address types (for sockaddr.sa_len)
SIZEOF_sockaddr_in : constant := 16; -- struct sockaddr_in
SIZEOF_sockaddr_in6 : constant := 28; -- struct sockaddr_in6
-- Size of file descriptor sets
SIZEOF_fd_set : constant := 128; -- fd_set
-- Fields of struct hostent
subtype H_Addrtype_T is Interfaces.C.int;
subtype H_Length_T is Interfaces.C.int;
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops
Has_Sockaddr_Len : constant := 0; -- Sockaddr has sa_len field
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking

View File

@ -36,7 +36,9 @@ with Ada.Exceptions; use Ada.Exceptions;
with Ada.Unchecked_Conversion;
with Interfaces.C.Strings;
with GNAT.Sockets.Constants;
with GNAT.Sockets.Thin_Common; use GNAT.Sockets.Thin_Common;
with GNAT.Sockets.Thin; use GNAT.Sockets.Thin;
with GNAT.Sockets.Thin.Task_Safe_NetDB; use GNAT.Sockets.Thin.Task_Safe_NetDB;
@ -48,6 +50,8 @@ with System; use System;
package body GNAT.Sockets is
package C renames Interfaces.C;
use type C.int;
Finalized : Boolean := False;
@ -63,10 +67,6 @@ package body GNAT.Sockets is
-- Correspondence tables
Families : constant array (Family_Type) of C.int :=
(Family_Inet => Constants.AF_INET,
Family_Inet6 => Constants.AF_INET6);
Levels : constant array (Level_Type) of C.int :=
(Socket_Level => Constants.SOL_SOCKET,
IP_Protocol_For_IP_Level => Constants.IPPROTO_IP,
@ -118,9 +118,6 @@ package body GNAT.Sockets is
Hex_To_Char : constant String (1 .. 16) := "0123456789ABCDEF";
-- Use to print in hexadecimal format
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
@ -162,7 +159,7 @@ package body GNAT.Sockets is
function Is_IP_Address (Name : String) return Boolean;
-- Return true when Name is an IP address in standard dot notation
function To_In_Addr (Addr : Inet_Addr_Type) return Thin.In_Addr;
function To_In_Addr (Addr : Inet_Addr_Type) return In_Addr;
procedure To_Inet_Addr
(Addr : In_Addr;
Result : out Inet_Addr_Type);
@ -230,6 +227,18 @@ package body GNAT.Sockets is
(Stream : in out Stream_Socket_Stream_Type;
Item : Ada.Streams.Stream_Element_Array);
procedure Wait_On_Socket
(Socket : Socket_Type;
For_Read : Boolean;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Common code for variants of socket operations supporting a timeout:
-- block in Check_Selector on Socket for at most the indicated timeout.
-- If For_Read is True, Socket is added to the read set for this call, else
-- it is added to the write set. If no selector is provided, a local one is
-- created for this call and destroyed prior to returning.
---------
-- "+" --
---------
@ -282,6 +291,37 @@ package body GNAT.Sockets is
Address.Port := Port_Type (Network_To_Short (Sin.Sin_Port));
end Accept_Socket;
-------------------
-- Accept_Socket --
-------------------
procedure Accept_Socket
(Server : Socket_Type;
Socket : out Socket_Type;
Address : out Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status)
is
begin
-- Wait for socket to become available for reading
Wait_On_Socket
(Socket => Server,
For_Read => True,
Timeout => Timeout,
Selector => Selector,
Status => Status);
-- Accept connection if available
if Status = Completed then
Accept_Socket (Server, Socket, Address);
else
Socket := No_Socket;
end if;
end Accept_Socket;
---------------
-- Addresses --
---------------
@ -356,14 +396,14 @@ package body GNAT.Sockets is
Res : C.int;
Sin : aliased Sockaddr_In;
Len : constant C.int := Sin'Size / 8;
-- This assumes that Address.Family = Family_Inet???
begin
if Address.Family = Family_Inet6 then
raise Socket_Error with "IPv6 not supported";
end if;
Set_Length (Sin'Unchecked_Access, Len);
Set_Family (Sin'Unchecked_Access, Families (Address.Family));
Set_Family (Sin.Sin_Family, Address.Family);
Set_Address (Sin'Unchecked_Access, To_In_Addr (Address.Addr));
Set_Port
(Sin'Unchecked_Access,
@ -387,12 +427,16 @@ package body GNAT.Sockets is
Status : out Selector_Status;
Timeout : Selector_Duration := Forever)
is
E_Socket_Set : Socket_Set_Type; -- (No_Socket, No_Socket_Set)
E_Socket_Set : Socket_Set_Type; -- (No_Socket, No_Fd_Set_Access)
begin
Check_Selector
(Selector, R_Socket_Set, W_Socket_Set, E_Socket_Set, Status, Timeout);
end Check_Selector;
--------------------
-- Check_Selector --
--------------------
procedure Check_Selector
(Selector : in out Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
@ -585,8 +629,7 @@ package body GNAT.Sockets is
raise Socket_Error with "IPv6 not supported";
end if;
Set_Length (Sin'Unchecked_Access, Len);
Set_Family (Sin'Unchecked_Access, Families (Server.Family));
Set_Family (Sin.Sin_Family, Server.Family);
Set_Address (Sin'Unchecked_Access, To_In_Addr (Server.Addr));
Set_Port
(Sin'Unchecked_Access,
@ -599,6 +642,55 @@ package body GNAT.Sockets is
end if;
end Connect_Socket;
--------------------
-- Connect_Socket --
--------------------
procedure Connect_Socket
(Socket : Socket_Type;
Server : Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status)
is
Req : Request_Type;
-- Used to set Socket to non-blocking I/O
begin
-- Set the socket to non-blocking I/O
Req := (Name => Non_Blocking_IO, Enabled => True);
Control_Socket (Socket, Request => Req);
-- Start operation (non-blocking), will raise Socket_Error with
-- EINPROGRESS.
begin
Connect_Socket (Socket, Server);
exception
when E : Socket_Error =>
if Resolve_Exception (E) = Operation_Now_In_Progress then
null;
else
raise;
end if;
end;
-- Wait for socket to become available for writing
Wait_On_Socket
(Socket => Socket,
For_Read => False,
Timeout => Timeout,
Selector => Selector,
Status => Status);
-- Reset the socket to blocking I/O
Req := (Name => Non_Blocking_IO, Enabled => False);
Control_Socket (Socket, Request => Req);
end Connect_Socket;
--------------------
-- Control_Socket --
--------------------
@ -704,9 +796,9 @@ package body GNAT.Sockets is
procedure Empty (Item : in out Socket_Set_Type) is
begin
if Item.Set /= No_Socket_Set then
if Item.Set /= No_Fd_Set_Access then
Free_Socket_Set (Item.Set);
Item.Set := No_Socket_Set;
Item.Set := No_Fd_Set_Access;
end if;
Item.Last := No_Socket;
@ -1257,7 +1349,7 @@ package body GNAT.Sockets is
procedure Listen_Socket
(Socket : Socket_Type;
Length : Positive := 15)
Length : Natural := 15)
is
Res : constant C.int := C_Listen (C.int (Socket), C.int (Length));
begin
@ -1273,7 +1365,7 @@ package body GNAT.Sockets is
procedure Narrow (Item : in out Socket_Set_Type) is
Last : aliased C.int := C.int (Item.Last);
begin
if Item.Set /= No_Socket_Set then
if Item.Set /= No_Fd_Set_Access then
Last_Socket_In_Set (Item.Set, Last'Unchecked_Access);
Item.Last := Socket_Type (Last);
end if;
@ -1297,6 +1389,63 @@ package body GNAT.Sockets is
return To_String (S.Official);
end Official_Name;
--------------------
-- Wait_On_Socket --
--------------------
procedure Wait_On_Socket
(Socket : Socket_Type;
For_Read : Boolean;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status)
is
type Local_Selector_Access is access Selector_Type;
for Local_Selector_Access'Storage_Size use Selector_Type'Size;
S : Selector_Access;
-- Selector to use for waiting
R_Fd_Set : Socket_Set_Type;
W_Fd_Set : Socket_Set_Type;
-- Socket sets, empty at elaboration
begin
-- Create selector if not provided by the user
if Selector = null then
declare
Local_S : constant Local_Selector_Access := new Selector_Type;
begin
S := Local_S.all'Unchecked_Access;
Create_Selector (S.all);
end;
else
S := Selector.all'Access;
end if;
if For_Read then
Set (R_Fd_Set, Socket);
else
Set (W_Fd_Set, Socket);
end if;
Check_Selector (S.all, R_Fd_Set, W_Fd_Set, Status, Timeout);
-- Cleanup actions (required in all cases to avoid memory leaks)
if For_Read then
Empty (R_Fd_Set);
else
Empty (W_Fd_Set);
end if;
if Selector = null then
Close_Selector (S.all);
end if;
end Wait_On_Socket;
-----------------
-- Port_Number --
-----------------
@ -1638,8 +1787,7 @@ package body GNAT.Sockets is
Len : constant C.int := Sin'Size / 8;
begin
Set_Length (Sin'Unchecked_Access, Len);
Set_Family (Sin'Unchecked_Access, Families (To.Family));
Set_Family (Sin.Sin_Family, To.Family);
Set_Address (Sin'Unchecked_Access, To_In_Addr (To.Addr));
Set_Port
(Sin'Unchecked_Access,
@ -1710,8 +1858,8 @@ package body GNAT.Sockets is
procedure Set (Item : in out Socket_Set_Type; Socket : Socket_Type) is
begin
if Item.Set = No_Socket_Set then
Item.Set := New_Socket_Set (No_Socket_Set);
if Item.Set = No_Fd_Set_Access then
Item.Set := New_Socket_Set (No_Fd_Set_Access);
Item.Last := Socket;
elsif Item.Last < Socket then
@ -1972,7 +2120,7 @@ package body GNAT.Sockets is
-- To_In_Addr --
----------------
function To_In_Addr (Addr : Inet_Addr_Type) return Thin.In_Addr is
function To_In_Addr (Addr : Inet_Addr_Type) return In_Addr is
begin
if Addr.Family = Family_Inet then
return (S_B1 => C.unsigned_char (Addr.Sin_V4 (1)),

View File

@ -52,8 +52,6 @@ with Ada.Exceptions;
with Ada.Streams;
with Ada.Unchecked_Deallocation;
with System;
package GNAT.Sockets is
-- Sockets are designed to provide a consistent communication facility
@ -397,6 +395,31 @@ package GNAT.Sockets is
No_Socket : constant Socket_Type;
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
-- Selector objects are used to wait for i/o events to occur on sockets
-- 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;
-- Should be Duration 2 ** (Constants.SIZEOF_tv_sec * 8 - 1) - 1 ???
subtype Timeval_Duration is Duration range Immediate .. Forever;
subtype Selector_Duration is Timeval_Duration;
-- Timeout value for selector operations
type Selector_Status is (Completed, Expired, Aborted);
-- Completion status of a selector operation, indicated as follows:
-- Complete: one of the expected events occurred
-- Expired: no event occurred before the expiration of the timeout
-- Aborted: an external action cancelled the wait operation before
-- any event occurred.
Socket_Error : exception;
-- There is only one exception in this package to deal with an error during
-- a socket routine. Once raised, its message contains a string describing
@ -435,10 +458,10 @@ package GNAT.Sockets is
No_Port : constant Port_Type;
type Inet_Addr_Type (Family : Family_Type := Family_Inet) is private;
-- An Internet address depends on an address family (IPv4 contains 4
-- octets and IPv6 contains 16 octets). Any_Inet_Addr is a special value
-- treated like a wildcard enabling all addresses. No_Inet_Addr provides a
-- special value to denote uninitialized inet addresses.
-- An Internet address depends on an address family (IPv4 contains 4 octets
-- and IPv6 contains 16 octets). Any_Inet_Addr is a special value treated
-- like a wildcard enabling all addresses. No_Inet_Addr provides a special
-- value to denote uninitialized inet addresses.
Any_Inet_Addr : constant Inet_Addr_Type;
No_Inet_Addr : constant Inet_Addr_Type;
@ -508,8 +531,8 @@ package GNAT.Sockets is
function Get_Host_By_Name
(Name : String) return Host_Entry_Type;
-- Return host entry structure for the given host name. Here name is
-- either a host name, or an IP address. If Name is an IP address, this is
-- equivalent to Get_Host_By_Address (Inet_Addr (Name)).
-- either a host name, or an IP address. If Name is an IP address, this
-- is equivalent to Get_Host_By_Address (Inet_Addr (Name)).
function Host_Name return String;
-- Return the name of the current host
@ -549,10 +572,10 @@ package GNAT.Sockets is
Service_Error : exception;
-- Comment required ???
-- Errors are described by an enumeration type. There is only one
-- exception Socket_Error in this package to deal with an error during a
-- socket routine. Once raised, its message contains the error code
-- between brackets and a string describing the error code.
-- Errors are described by an enumeration type. There is only one exception
-- Socket_Error in this package to deal with an error during a socket
-- routine. Once raised, its message contains the error code between
-- brackets and a string describing the error code.
-- The name of the enumeration constant documents the error condition
@ -602,16 +625,6 @@ package GNAT.Sockets is
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.
@ -722,9 +735,9 @@ package GNAT.Sockets is
-- Socket_Stream).
Peek_At_Incoming_Data : constant Request_Flag_Type;
-- This flag causes the receive operation to return data from the
-- beginning of the receive queue without removing that data from the
-- queue. A subsequent receive call will return the same data.
-- This flag causes the receive operation to return data from the beginning
-- of the receive queue without removing that data from the queue. A
-- subsequent receive call will return the same data.
Wait_For_A_Full_Reception : constant Request_Flag_Type;
-- This flag requests that the operation block until the full request is
@ -766,6 +779,20 @@ package GNAT.Sockets is
-- is filled in with the address of the connection. Raises Socket_Error on
-- error.
procedure Accept_Socket
(Server : Socket_Type;
Socket : out Socket_Type;
Address : out Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Accept a new connection on Server using Accept_Socket, waiting no longer
-- than the given timeout duration. Status is set to indicate whether the
-- operation completed successully, timed out, or was aborted. If Selector
-- is not null, the designated selector is used to wait for the socket to
-- become available, else a private selector object is created by this
-- procedure and destroyed before it returns.
procedure Bind_Socket
(Socket : Socket_Type;
Address : Sock_Addr_Type);
@ -781,12 +808,25 @@ package GNAT.Sockets is
-- Make a connection to another socket which has the address of Server.
-- Raises Socket_Error on error.
procedure Connect_Socket
(Socket : Socket_Type;
Server : Sock_Addr_Type;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Connect Socket to the given Server address using Connect_Socket, waiting
-- no longer than the given timeout duration. Status is set to indicate
-- whether the operation completed successully, timed out, or was aborted.
-- If Selector is not null, the designated selector is used to wait for the
-- socket to become available, else a private selector object is created
-- by this procedure and destroyed before it returns.
procedure Control_Socket
(Socket : Socket_Type;
Request : in out Request_Type);
-- Obtain or set parameter values that control the socket. This control
-- differs from the socket options in that they are not specific to
-- sockets but are available for any device.
-- differs from the socket options in that they are not specific to sockets
-- but are available for any device.
function Get_Peer_Name (Socket : Socket_Type) return Sock_Addr_Type;
-- Return the peer or remote socket address of a socket. Raise
@ -794,22 +834,23 @@ package GNAT.Sockets is
function Get_Socket_Name (Socket : Socket_Type) return Sock_Addr_Type;
-- Return the local or current socket address of a socket. Return
-- No_Sock_Addr on error (for instance, socket closed or not locally
-- bound).
-- No_Sock_Addr on error (e.g. socket closed or not locally bound).
function Get_Socket_Option
(Socket : Socket_Type;
Level : Level_Type := Socket_Level;
Name : Option_Name) return Option_Type;
-- Get the options associated with a socket. Raises Socket_Error
-- on error.
-- Get the options associated with a socket. Raises Socket_Error on error
procedure Listen_Socket
(Socket : Socket_Type;
Length : Positive := 15);
Length : Natural := 15);
-- To accept connections, a socket is first created with Create_Socket,
-- a willingness to accept incoming connections and a queue Length for
-- incoming connections are specified. Raise Socket_Error on error.
-- The queue length of 15 is an example value that should be appropriate
-- in usual cases. It can be adjusted according to each application's
-- particular requirements.
procedure Receive_Socket
(Socket : Socket_Type;
@ -959,11 +1000,6 @@ package GNAT.Sockets is
-- operation is typically to add a socket in one of the socket sets when
-- the timeout is set to forever.
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
subtype Selector_Duration is Timeval_Duration;
procedure Create_Selector (Selector : out Selector_Type);
-- Create a new selector
@ -973,8 +1009,6 @@ package GNAT.Sockets is
-- no other task still using Selector (i.e. still executing Check_Selector
-- or Abort_Selector on this Selector).
type Selector_Status is (Completed, Expired, Aborted);
procedure Check_Selector
(Selector : in out Selector_Type;
R_Socket_Set : in out Socket_Set_Type;
@ -1009,6 +1043,16 @@ package GNAT.Sockets is
procedure Abort_Selector (Selector : Selector_Type);
-- Send an abort signal to the selector
type Fd_Set_Access is private;
No_Fd_Set_Access : constant Fd_Set_Access;
-- ??? This type must not be used directly, it needs to be visible because
-- it is used in the visible part of GNAT.Sockets.Thin_Common. This is
-- really an inversion of abstraction. The private part of GNAT.Sockets
-- needs to have visibility on this type, but since Thin_Common is a child
-- of Sokcets, the type can't be declared there. The correct fix would
-- be to move the thin sockets binding outside of GNAT.Sockets altogether,
-- e.g. by renaming it to GNAT.Sockets_Thin.
private
type Socket_Type is new Integer;
@ -1017,18 +1061,19 @@ private
type Selector_Type is limited record
R_Sig_Socket : Socket_Type := No_Socket;
W_Sig_Socket : Socket_Type := No_Socket;
-- Signalling sockets used to abort a select operation
end record;
pragma Volatile (Selector_Type);
-- The two signalling sockets are used to abort a select operation
subtype Socket_Set_Access is System.Address;
No_Socket_Set : constant Socket_Set_Access := System.Null_Address;
type Fd_Set is null record;
type Fd_Set_Access is access all Fd_Set;
pragma Convention (C, Fd_Set_Access);
No_Fd_Set_Access : constant Fd_Set_Access := null;
type Socket_Set_Type is record
Last : Socket_Type := No_Socket;
Set : Socket_Set_Access := No_Socket_Set;
Set : Fd_Set_Access;
end record;
subtype Inet_Addr_Comp_Type is Natural range 0 .. 255;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -39,10 +39,12 @@
with Interfaces.C.Strings; use Interfaces.C.Strings;
with System; use System;
with GNAT.Sockets.Constants;
package body GNAT.Sockets.Thin is
use type C.unsigned;
use type C.int;
WSAData_Dummy : array (1 .. 512) of C.int;
@ -294,7 +296,7 @@ package body GNAT.Sockets.Thin is
RFS : constant Fd_Set_Access := Readfds;
WFS : constant Fd_Set_Access := Writefds;
WFSC : Fd_Set_Access := No_Fd_Set;
WFSC : Fd_Set_Access := No_Fd_Set_Access;
EFS : Fd_Set_Access := Exceptfds;
Res : C.int;
S : aliased C.int;
@ -310,10 +312,10 @@ package body GNAT.Sockets.Thin is
-- the initial write fd set, then move the socket from the
-- exception fd set to the write fd set.
if WFS /= No_Fd_Set then
if WFS /= No_Fd_Set_Access then
-- Add any socket present in write fd set into exception fd set
if EFS = No_Fd_Set then
if EFS = No_Fd_Set_Access then
EFS := New_Socket_Set (WFS);
else
@ -337,7 +339,7 @@ package body GNAT.Sockets.Thin is
Res := Standard_Select (Nfds, RFS, WFS, EFS, Timeout);
if EFS /= No_Fd_Set then
if EFS /= No_Fd_Set_Access then
declare
EFSC : constant Fd_Set_Access := New_Socket_Set (EFS);
Flag : constant C.int := Constants.MSG_PEEK + Constants.MSG_OOB;
@ -372,7 +374,7 @@ package body GNAT.Sockets.Thin is
-- set. Otherwise, ignore this event since the user
-- is not watching for it.
if WFSC /= No_Fd_Set
if WFSC /= No_Fd_Set_Access
and then (Is_Socket_In_Set (WFSC, S) /= 0)
then
Insert_Socket_In_Set (WFS, S);
@ -383,14 +385,14 @@ package body GNAT.Sockets.Thin is
Free_Socket_Set (EFSC);
end;
if Exceptfds = No_Fd_Set then
if Exceptfds = No_Fd_Set_Access then
Free_Socket_Set (EFS);
end if;
end if;
-- Free any copy of write fd set
if WFSC /= No_Fd_Set then
if WFSC /= No_Fd_Set_Access then
Free_Socket_Set (WFSC);
end if;
@ -473,57 +475,6 @@ package body GNAT.Sockets.Thin is
end if;
end Initialize;
-----------------
-- Set_Address --
-----------------
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr)
is
begin
Sin.Sin_Addr := Address;
end Set_Address;
----------------
-- Set_Family --
----------------
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int)
is
begin
Sin.Sin_Family := C.unsigned_short (Family);
end Set_Family;
----------------
-- Set_Length --
----------------
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int)
is
pragma Unreferenced (Sin);
pragma Unreferenced (Len);
begin
null;
end Set_Length;
--------------
-- Set_Port --
--------------
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short)
is
begin
Sin.Sin_Port := Port;
end Set_Port;
--------------------
-- Signalling_Fds --
--------------------

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -37,23 +37,18 @@
-- This version is for NT
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
with GNAT.Sockets.Constants;
with GNAT.Sockets.Thin_Common;
with System;
package GNAT.Sockets.Thin is
use Thin_Common;
package C renames Interfaces.C;
use type C.int;
-- So that we can declare the Failure constant below
Success : constant C.int := 0;
Failure : constant C.int := -1;
function Socket_Errno return Integer;
-- Returns last socket error number
@ -77,158 +72,6 @@ package GNAT.Sockets.Thin is
end Host_Error_Messages;
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
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 : time_t;
Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
type Timeval_Access is access all Timeval;
pragma Convention (C, Timeval_Access);
Immediat : constant Timeval := (0, 0);
type Int_Access is access all C.int;
pragma Convention (C, Int_Access);
-- Access to C integers
type Chars_Ptr_Array is array (C.size_t range <>) of
aliased C.Strings.chars_ptr;
package Chars_Ptr_Pointers is
new C.Pointers (C.size_t, C.Strings.chars_ptr, Chars_Ptr_Array,
C.Strings.Null_Ptr);
-- Arrays of C (char *)
type In_Addr is record
S_B1, S_B2, S_B3, S_B4 : C.unsigned_char;
end record;
for In_Addr'Alignment use C.int'Alignment;
pragma Convention (C, In_Addr);
-- IPv4 address, represented as a network-order C.int. Note that the
-- underlying operating system may assume that values of this type have
-- C.int alignment, so we need to provide a suitable alignment clause here.
type In_Addr_Access is access all In_Addr;
pragma Convention (C, In_Addr_Access);
-- Access to internet address
Inaddr_Any : aliased constant In_Addr := (others => 0);
-- Any internet address (all the interfaces)
type In_Addr_Access_Array is array (C.size_t range <>)
of aliased In_Addr_Access;
pragma Convention (C, In_Addr_Access_Array);
package In_Addr_Access_Pointers is
new C.Pointers (C.size_t, In_Addr_Access, In_Addr_Access_Array, null);
-- Array of internet addresses
type Sockaddr is record
Sa_Family : C.unsigned_short;
Sa_Data : C.char_array (1 .. 14);
end record;
pragma Convention (C, Sockaddr);
-- Socket address
type Sockaddr_Access is access all Sockaddr;
pragma Convention (C, Sockaddr_Access);
-- Access to socket address
type Sockaddr_In is record
Sin_Family : C.unsigned_short := Constants.AF_INET;
Sin_Port : C.unsigned_short := 0;
Sin_Addr : In_Addr := Inaddr_Any;
Sin_Zero : C.char_array (1 .. 8) := (others => C.char'Val (0));
end record;
pragma Convention (C, Sockaddr_In);
-- Internet socket address
type Sockaddr_In_Access is access all Sockaddr_In;
pragma Convention (C, Sockaddr_In_Access);
-- Access to internet socket address
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int);
pragma Inline (Set_Length);
-- Set Sin.Sin_Length to Len.
-- On this platform, nothing is done as there is no such field.
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int);
pragma Inline (Set_Family);
-- Set Sin.Sin_Family to Family
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short);
pragma Inline (Set_Port);
-- Set Sin.Sin_Port to Port
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr);
pragma Inline (Set_Address);
-- Set Sin.Sin_Addr to Address
type Hostent is record
H_Name : C.Strings.chars_ptr;
H_Aliases : Chars_Ptr_Pointers.Pointer;
H_Addrtype : C.short;
H_Length : C.short;
H_Addr_List : In_Addr_Access_Pointers.Pointer;
end record;
pragma Convention (C, Hostent);
-- Host entry
type Hostent_Access is access all Hostent;
pragma Convention (C, Hostent_Access);
-- Access to host entry
type Servent is record
S_Name : C.Strings.chars_ptr;
S_Aliases : Chars_Ptr_Pointers.Pointer;
S_Port : C.int;
S_Proto : C.Strings.chars_ptr;
end record;
pragma Convention (C, Servent);
-- Service entry
type Servent_Access is access all Servent;
pragma Convention (C, Servent_Access);
-- Access to service entry
type Two_Ints is array (0 .. 1) of C.int;
pragma Convention (C, Two_Ints);
-- Container for two int values
subtype Fd_Pair is Two_Ints;
-- Two_Ints as used for Create_Signalling_Fds: a pair of connected file
-- descriptors, one of which (the "read end" of the connection) being used
-- for reading, the other one (the "write end") being used for writing.
Read_End : constant := 0;
Write_End : constant := 1;
-- Indices into an Fd_Pair value providing access to each of the connected
-- file descriptors.
--------------------------------
-- Standard library functions --
--------------------------------
@ -382,55 +225,6 @@ package GNAT.Sockets.Thin is
end Signalling_Fds;
----------------------------
-- Socket sets management --
----------------------------
procedure Free_Socket_Set
(Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
(Set : Fd_Set_Access;
Socket : Int_Access;
Last : Int_Access);
-- Get last socket in Socket and remove it from the socket set. The
-- parameter Last is a maximum value of the largest socket. This hint is
-- used to avoid scanning very large socket sets. After a call to
-- Get_Socket_From_Set, Last is set back to the real largest socket in the
-- socket set.
procedure Insert_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Insert socket in the socket set
function Is_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int) return C.int;
-- Check whether Socket is in the socket set, return a non-zero
-- value if it is, zero if it is not.
procedure Last_Socket_In_Set
(Set : Fd_Set_Access;
Last : Int_Access);
-- Find the largest socket in the socket set. This is needed for select().
-- When Last_Socket_In_Set is called, parameter Last is a maximum value of
-- the largest socket. This hint is used to avoid scanning very large
-- socket sets. After the call, Last is set back to the real largest socket
-- in the socket set.
function New_Socket_Set
(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.
procedure Remove_Socket_From_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Remove socket from the socket set
procedure WSACleanup;
procedure Initialize;
@ -461,12 +255,4 @@ private
pragma Import (Stdcall, WSAStartup, "WSAStartup");
pragma Import (Stdcall, WSACleanup, "WSACleanup");
pragma Import (C, Free_Socket_Set, "__gnat_free_socket_set");
pragma Import (C, Get_Socket_From_Set, "__gnat_get_socket_from_set");
pragma Import (C, Is_Socket_In_Set, "__gnat_is_socket_in_set");
pragma Import (C, Last_Socket_In_Set, "__gnat_last_socket_in_set");
pragma Import (C, New_Socket_Set, "__gnat_new_socket_set");
pragma Import (C, Insert_Socket_In_Set, "__gnat_insert_socket_in_set");
pragma Import (C, Remove_Socket_From_Set, "__gnat_remove_socket_from_set");
end GNAT.Sockets.Thin;

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -34,6 +34,7 @@
-- Temporary version for Alpha/VMS
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@ -41,7 +42,7 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
Non_Blocking_Sockets : constant Fd_Set_Access :=
New_Socket_Set (No_Socket_Set);
New_Socket_Set (No_Fd_Set_Access);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@ -182,15 +183,15 @@ package body GNAT.Sockets.Thin is
Now : aliased Timeval;
begin
WSet := New_Socket_Set (No_Socket_Set);
WSet := New_Socket_Set (No_Fd_Set_Access);
loop
Insert_Socket_In_Set (WSet, S);
Now := Immediat;
Res := C_Select
(S + 1,
No_Fd_Set,
No_Fd_Set_Access,
WSet,
No_Fd_Set,
No_Fd_Set_Access,
Now'Unchecked_Access);
exit when Res > 0;
@ -208,10 +209,9 @@ package body GNAT.Sockets.Thin is
Res := Syscall_Connect (S, Name, Namelen);
if Res = Failure
and then Errno = Constants.EISCONN
then
return Thin.Success;
if Res = Failure and then Errno = Constants.EISCONN then
return Thin_Common.Success;
else
return Res;
end if;
@ -410,35 +410,6 @@ package body GNAT.Sockets.Thin is
return R;
end Non_Blocking_Socket;
-----------------
-- Set_Address --
-----------------
procedure Set_Address (Sin : Sockaddr_In_Access; Address : In_Addr) is
begin
Sin.Sin_Addr := Address;
end Set_Address;
----------------
-- Set_Family --
----------------
procedure Set_Family (Sin : Sockaddr_In_Access; Family : C.int) is
begin
Sin.Sin_Family := C.unsigned_short (Family);
end Set_Family;
----------------
-- Set_Length --
----------------
procedure Set_Length (Sin : Sockaddr_In_Access; Len : C.int) is
pragma Unreferenced (Sin);
pragma Unreferenced (Len);
begin
null;
end Set_Length;
-----------------------------
-- Set_Non_Blocking_Socket --
-----------------------------
@ -456,15 +427,6 @@ package body GNAT.Sockets.Thin is
Task_Lock.Unlock;
end Set_Non_Blocking_Socket;
--------------
-- Set_Port --
--------------
procedure Set_Port (Sin : Sockaddr_In_Access; Port : C.unsigned_short) is
begin
Sin.Sin_Port := Port;
end Set_Port;
--------------------
-- Signalling_Fds --
--------------------

View File

@ -37,27 +37,21 @@
-- This is the Alpha/VMS version
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
with GNAT.OS_Lib;
with GNAT.Sockets.Constants;
with GNAT.Sockets.Thin_Common;
with System;
with System.Aux_DEC;
package GNAT.Sockets.Thin is
-- ??? more comments needed ???
use Thin_Common;
package C renames Interfaces.C;
use type C.int;
-- This is so we can declare the Failure constant below
Success : constant C.int := 0;
Failure : constant C.int := -1;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@ -81,162 +75,6 @@ package GNAT.Sockets.Thin is
end Host_Error_Messages;
subtype Fd_Set_Access is System.Aux_DEC.Short_Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
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 : time_t;
Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
type Timeval_Access is access all Timeval;
pragma Convention (C, Timeval_Access);
Immediat : constant Timeval := (0, 0);
type Int_Access is access all C.int;
pragma Convention (C, Int_Access);
-- Access to C integers
type Chars_Ptr_Array is array (C.size_t range <>) of
aliased C.Strings.chars_ptr;
package Chars_Ptr_Pointers is
new C.Pointers (C.size_t, C.Strings.chars_ptr, Chars_Ptr_Array,
C.Strings.Null_Ptr);
-- Arrays of C (char *)
type In_Addr is record
S_B1, S_B2, S_B3, S_B4 : C.unsigned_char;
end record;
for In_Addr'Alignment use C.int'Alignment;
pragma Convention (C, In_Addr);
-- IPv4 address, represented as a network-order C.int. Note that the
-- underlying operating system may assume that values of this type have
-- C.int alignment, so we need to provide a suitable alignment clause here.
type In_Addr_Access is access all In_Addr;
pragma Convention (C, In_Addr_Access);
-- Access to internet address
Inaddr_Any : aliased constant In_Addr := (others => 0);
-- Any internet address (all the interfaces)
type In_Addr_Access_Array is array (C.size_t range <>)
of aliased In_Addr_Access;
pragma Convention (C, In_Addr_Access_Array);
package In_Addr_Access_Pointers is
new C.Pointers (C.size_t, In_Addr_Access, In_Addr_Access_Array, null);
-- Array of internet addresses
type Sockaddr is record
Sa_Family : C.unsigned_short;
Sa_Data : C.char_array (1 .. 14);
end record;
pragma Convention (C, Sockaddr);
-- Socket address
type Sockaddr_Access is access all Sockaddr;
for Sockaddr_Access'Size use 32;
pragma Convention (C, Sockaddr_Access);
-- Access to socket address
type Sockaddr_In is record
Sin_Family : C.unsigned_short := Constants.AF_INET;
Sin_Port : C.unsigned_short := 0;
Sin_Addr : In_Addr := Inaddr_Any;
Sin_Zero : C.char_array (1 .. 8) := (others => C.char'Val (0));
end record;
pragma Convention (C, Sockaddr_In);
-- Internet socket address
type Sockaddr_In_Access is access all Sockaddr_In;
for Sockaddr_In_Access'Size use 32;
pragma Convention (C, Sockaddr_In_Access);
-- Access to internet socket address
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int);
pragma Inline (Set_Length);
-- Set Sin.Sin_Length to Len.
-- On this platform, nothing is done as there is no such field.
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int);
pragma Inline (Set_Family);
-- Set Sin.Sin_Family to Family
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short);
pragma Inline (Set_Port);
-- Set Sin.Sin_Port to Port
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr);
pragma Inline (Set_Address);
-- Set Sin.Sin_Addr to Address
type Hostent is record
H_Name : C.Strings.chars_ptr;
H_Aliases : Chars_Ptr_Pointers.Pointer;
H_Addrtype : C.int;
H_Length : C.int;
H_Addr_List : In_Addr_Access_Pointers.Pointer;
end record;
pragma Convention (C, Hostent);
-- Host entry
type Hostent_Access is access all Hostent;
for Hostent_Access'Size use 32;
pragma Convention (C, Hostent_Access);
-- Access to host entry
type Servent is record
S_Name : C.Strings.chars_ptr;
S_Aliases : Chars_Ptr_Pointers.Pointer;
S_Port : C.int;
S_Proto : C.Strings.chars_ptr;
end record;
pragma Convention (C, Servent);
-- Service entry
type Servent_Access is access all Servent;
for Servent_Access'Size use 32;
pragma Convention (C, Servent_Access);
-- Access to service entry
type Two_Ints is array (0 .. 1) of C.int;
pragma Convention (C, Two_Ints);
-- Container for two int values
subtype Fd_Pair is Two_Ints;
-- Two_Ints as used for Create_Signalling_Fds: a pair of connected file
-- descriptors, one of which (the "read end" of the connection) being used
-- for reading, the other one (the "write end") being used for writing.
Read_End : constant := 0;
Write_End : constant := 1;
-- Indices into an Fd_Pair value providing access to each of the connected
-- file descriptors.
--------------------------------
-- Standard library functions --
--------------------------------
@ -386,55 +224,6 @@ package GNAT.Sockets.Thin is
end Signalling_Fds;
----------------------------
-- Socket sets management --
----------------------------
procedure Free_Socket_Set
(Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
(Set : Fd_Set_Access;
Socket : Int_Access;
Last : Int_Access);
-- Get last socket in Socket and remove it from the socket set. The
-- parameter Last is a maximum value of the largest socket. This hint is
-- used to avoid scanning very large socket sets. After a call to
-- Get_Socket_From_Set, Last is set back to the real largest socket in the
-- socket set.
procedure Insert_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Insert socket in the socket set
function Is_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int) return C.int;
-- Check whether Socket is in the socket set, return a non-zero
-- value if it is, zero if it is not.
procedure Last_Socket_In_Set
(Set : Fd_Set_Access;
Last : Int_Access);
-- Find the largest socket in the socket set. This is needed for select().
-- When Last_Socket_In_Set is called, parameter Last is a maximum value of
-- the largest socket. This hint is used to avoid scanning very large
-- socket sets. After the call, Last is set back to the real largest socket
-- in the socket set.
function New_Socket_Set
(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.
procedure Remove_Socket_From_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Remove socket from the socket set
-------------------------------------------
-- Nonreentrant network databases access --
-------------------------------------------
@ -474,14 +263,6 @@ private
pragma Import (C, C_Strerror, "DECC$STRERROR");
pragma Import (C, C_System, "DECC$SYSTEM");
pragma Import (C, Free_Socket_Set, "__gnat_free_socket_set");
pragma Import (C, Get_Socket_From_Set, "__gnat_get_socket_from_set");
pragma Import (C, Is_Socket_In_Set, "__gnat_is_socket_in_set");
pragma Import (C, Last_Socket_In_Set, "__gnat_last_socket_in_set");
pragma Import (C, New_Socket_Set, "__gnat_new_socket_set");
pragma Import (C, Insert_Socket_In_Set, "__gnat_insert_socket_in_set");
pragma Import (C, Remove_Socket_From_Set, "__gnat_remove_socket_from_set");
pragma Import (C, Nonreentrant_Gethostbyname, "DECC$GETHOSTBYNAME");
pragma Import (C, Nonreentrant_Gethostbyaddr, "DECC$GETHOSTBYADDR");
pragma Import (C, Nonreentrant_Getservbyname, "DECC$GETSERVBYNAME");

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2007, AdaCore --
-- Copyright (C) 2002-2008, 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- --
@ -38,6 +38,7 @@
-- This version is for VxWorks
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@ -45,7 +46,7 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
Non_Blocking_Sockets : constant Fd_Set_Access :=
New_Socket_Set (No_Socket_Set);
New_Socket_Set (No_Fd_Set_Access);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@ -195,16 +196,16 @@ package body GNAT.Sockets.Thin is
Now : aliased Timeval;
begin
WSet := New_Socket_Set (No_Socket_Set);
WSet := New_Socket_Set (No_Fd_Set_Access);
loop
Insert_Socket_In_Set (WSet, S);
Now := Immediat;
Res := C_Select
(S + 1,
No_Fd_Set,
No_Fd_Set_Access,
WSet,
No_Fd_Set,
No_Fd_Set_Access,
Now'Unchecked_Access);
exit when Res > 0;
@ -225,7 +226,7 @@ package body GNAT.Sockets.Thin is
if Res = Failure
and then Errno = Constants.EISCONN
then
return Thin.Success;
return Thin_Common.Success;
else
return Res;
end if;
@ -425,42 +426,6 @@ package body GNAT.Sockets.Thin is
return R;
end Non_Blocking_Socket;
-----------------
-- Set_Address --
-----------------
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr)
is
begin
Sin.Sin_Addr := Address;
end Set_Address;
----------------
-- Set_Family --
----------------
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int)
is
begin
Sin.Sin_Family := C.unsigned_char (Family);
end Set_Family;
----------------
-- Set_Length --
----------------
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int)
is
begin
Sin.Sin_Length := C.unsigned_char (Len);
end Set_Length;
-----------------------------
-- Set_Non_Blocking_Socket --
-----------------------------
@ -477,18 +442,6 @@ package body GNAT.Sockets.Thin is
Task_Lock.Unlock;
end Set_Non_Blocking_Socket;
--------------
-- Set_Port --
--------------
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short)
is
begin
Sin.Sin_Port := Port;
end Set_Port;
--------------------
-- Signalling_Fds --
--------------------

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -38,6 +38,7 @@
-- This is the default version
with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Sockets.Constants;
with GNAT.Task_Lock;
with Interfaces.C; use Interfaces.C;
@ -45,7 +46,7 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
Non_Blocking_Sockets : constant Fd_Set_Access :=
New_Socket_Set (No_Socket_Set);
New_Socket_Set (No_Fd_Set_Access);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@ -199,15 +200,15 @@ package body GNAT.Sockets.Thin is
Now : aliased Timeval;
begin
WSet := New_Socket_Set (No_Socket_Set);
WSet := New_Socket_Set (No_Fd_Set_Access);
loop
Insert_Socket_In_Set (WSet, S);
Now := Immediat;
Res := C_Select
(S + 1,
No_Fd_Set,
No_Fd_Set_Access,
WSet,
No_Fd_Set,
No_Fd_Set_Access,
Now'Unchecked_Access);
exit when Res > 0;
@ -228,7 +229,7 @@ package body GNAT.Sockets.Thin is
if Res = Failure
and then Errno = Constants.EISCONN
then
return Thin.Success;
return Thin_Common.Success;
else
return Res;
end if;
@ -427,45 +428,6 @@ package body GNAT.Sockets.Thin is
return R;
end Non_Blocking_Socket;
-----------------
-- Set_Address --
-----------------
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr)
is
begin
Sin.Sin_Addr := Address;
end Set_Address;
----------------
-- Set_Family --
----------------
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int)
is
begin
Sin.Sin_Family := C.unsigned_short (Family);
end Set_Family;
----------------
-- Set_Length --
----------------
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int)
is
pragma Unreferenced (Sin);
pragma Unreferenced (Len);
begin
null;
end Set_Length;
-----------------------------
-- Set_Non_Blocking_Socket --
-----------------------------
@ -483,18 +445,6 @@ package body GNAT.Sockets.Thin is
Task_Lock.Unlock;
end Set_Non_Blocking_Socket;
--------------
-- Set_Port --
--------------
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short)
is
begin
Sin.Sin_Port := Port;
end Set_Port;
--------------------
-- Signalling_Fds --
--------------------

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -37,11 +37,10 @@
-- This is the default version
with Interfaces.C.Pointers;
with Interfaces.C.Strings;
with GNAT.OS_Lib;
with GNAT.Sockets.Constants;
with GNAT.Sockets.Thin_Common;
with System;
@ -51,14 +50,10 @@ package GNAT.Sockets.Thin is
-- standard interface. It will be used as a default for all the platforms
-- that do not have a specific version of this file.
use Thin_Common;
package C renames Interfaces.C;
use type C.int;
-- This is so we can declare the Failure constant below
Success : constant C.int := 0;
Failure : constant C.int := -1;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@ -79,158 +74,6 @@ package GNAT.Sockets.Thin is
end Host_Error_Messages;
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
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 : time_t;
Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
type Timeval_Access is access all Timeval;
pragma Convention (C, Timeval_Access);
Immediat : constant Timeval := (0, 0);
type Int_Access is access all C.int;
pragma Convention (C, Int_Access);
-- Access to C integers
type Chars_Ptr_Array is array (C.size_t range <>) of
aliased C.Strings.chars_ptr;
package Chars_Ptr_Pointers is
new C.Pointers (C.size_t, C.Strings.chars_ptr, Chars_Ptr_Array,
C.Strings.Null_Ptr);
-- Arrays of C (char *)
type In_Addr is record
S_B1, S_B2, S_B3, S_B4 : C.unsigned_char;
end record;
for In_Addr'Alignment use C.int'Alignment;
pragma Convention (C, In_Addr);
-- IPv4 address, represented as a network-order C.int. Note that the
-- underlying operating system may assume that values of this type have
-- C.int alignment, so we need to provide a suitable alignment clause here.
type In_Addr_Access is access all In_Addr;
pragma Convention (C, In_Addr_Access);
-- Access to internet address
Inaddr_Any : aliased constant In_Addr := (others => 0);
-- Any internet address (all the interfaces)
type In_Addr_Access_Array is array (C.size_t range <>)
of aliased In_Addr_Access;
pragma Convention (C, In_Addr_Access_Array);
package In_Addr_Access_Pointers is
new C.Pointers (C.size_t, In_Addr_Access, In_Addr_Access_Array, null);
-- Array of internet addresses
type Sockaddr is record
Sa_Family : C.unsigned_short;
Sa_Data : C.char_array (1 .. 14);
end record;
pragma Convention (C, Sockaddr);
-- Socket address
type Sockaddr_Access is access all Sockaddr;
pragma Convention (C, Sockaddr_Access);
-- Access to socket address
type Sockaddr_In is record
Sin_Family : C.unsigned_short := Constants.AF_INET;
Sin_Port : C.unsigned_short := 0;
Sin_Addr : In_Addr := Inaddr_Any;
Sin_Zero : C.char_array (1 .. 8) := (others => C.char'Val (0));
end record;
pragma Convention (C, Sockaddr_In);
-- Internet socket address
type Sockaddr_In_Access is access all Sockaddr_In;
pragma Convention (C, Sockaddr_In_Access);
-- Access to internet socket address
procedure Set_Length
(Sin : Sockaddr_In_Access;
Len : C.int);
pragma Inline (Set_Length);
-- Set Sin.Sin_Length to Len.
-- On this platform, nothing is done as there is no such field.
procedure Set_Family
(Sin : Sockaddr_In_Access;
Family : C.int);
pragma Inline (Set_Family);
-- Set Sin.Sin_Family to Family
procedure Set_Port
(Sin : Sockaddr_In_Access;
Port : C.unsigned_short);
pragma Inline (Set_Port);
-- Set Sin.Sin_Port to Port
procedure Set_Address
(Sin : Sockaddr_In_Access;
Address : In_Addr);
pragma Inline (Set_Address);
-- Set Sin.Sin_Addr to Address
type Hostent is record
H_Name : C.Strings.chars_ptr;
H_Aliases : Chars_Ptr_Pointers.Pointer;
H_Addrtype : C.int;
H_Length : C.int;
H_Addr_List : In_Addr_Access_Pointers.Pointer;
end record;
pragma Convention (C, Hostent);
-- Host entry
type Hostent_Access is access all Hostent;
pragma Convention (C, Hostent_Access);
-- Access to host entry
type Servent is record
S_Name : C.Strings.chars_ptr;
S_Aliases : Chars_Ptr_Pointers.Pointer;
S_Port : C.int;
S_Proto : C.Strings.chars_ptr;
end record;
pragma Convention (C, Servent);
-- Service entry
type Servent_Access is access all Servent;
pragma Convention (C, Servent_Access);
-- Access to service entry
type Two_Ints is array (0 .. 1) of C.int;
pragma Convention (C, Two_Ints);
-- Container for two int values
subtype Fd_Pair is Two_Ints;
-- Two_Ints as used for Create_Signalling_Fds: a pair of connected file
-- descriptors, one of which (the "read end" of the connection) being used
-- for reading, the other one (the "write end") being used for writing.
Read_End : constant := 0;
Write_End : constant := 1;
-- Indices into an Fd_Pair value providing access to each of the connected
-- file descriptors.
--------------------------------
-- Standard library functions --
--------------------------------
@ -380,55 +223,6 @@ package GNAT.Sockets.Thin is
end Signalling_Fds;
----------------------------
-- Socket sets management --
----------------------------
procedure Free_Socket_Set
(Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
(Set : Fd_Set_Access;
Socket : Int_Access;
Last : Int_Access);
-- Get last socket in Socket and remove it from the socket set. The
-- parameter Last is a maximum value of the largest socket. This hint is
-- used to avoid scanning very large socket sets. After a call to
-- Get_Socket_From_Set, Last is set back to the real largest socket in the
-- socket set.
procedure Insert_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Insert socket in the socket set
function Is_Socket_In_Set
(Set : Fd_Set_Access;
Socket : C.int) return C.int;
-- Check whether Socket is in the socket set, return a non-zero
-- value if it is, zero if it is not.
procedure Last_Socket_In_Set
(Set : Fd_Set_Access;
Last : Int_Access);
-- Find the largest socket in the socket set. This is needed for select().
-- When Last_Socket_In_Set is called, parameter Last is a maximum value of
-- the largest socket. This hint is used to avoid scanning very large
-- socket sets. After the call, Last is set back to the real largest socket
-- in the socket set.
function New_Socket_Set
(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.
procedure Remove_Socket_From_Set
(Set : Fd_Set_Access;
Socket : C.int);
-- Remove socket from the socket set
-------------------------------------------
-- Nonreentrant network databases access --
-------------------------------------------
@ -473,14 +267,6 @@ private
pragma Import (C, C_System, "system");
pragma Import (C, C_Writev, "writev");
pragma Import (C, Free_Socket_Set, "__gnat_free_socket_set");
pragma Import (C, Get_Socket_From_Set, "__gnat_get_socket_from_set");
pragma Import (C, Is_Socket_In_Set, "__gnat_is_socket_in_set");
pragma Import (C, Last_Socket_In_Set, "__gnat_last_socket_in_set");
pragma Import (C, New_Socket_Set, "__gnat_new_socket_set");
pragma Import (C, Insert_Socket_In_Set, "__gnat_insert_socket_in_set");
pragma Import (C, Remove_Socket_From_Set, "__gnat_remove_socket_from_set");
pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname");
pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr");
pragma Import (C, Nonreentrant_Getservbyname, "getservbyname");

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2007, AdaCore --
-- Copyright (C) 2001-2008, 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- --
@ -90,15 +90,14 @@ package body Signalling_Fds is
-- Bind the socket to an available port on localhost
Len := Sin'Size / 8;
Set_Length (Sin'Unchecked_Access, Len);
Sin.Sin_Family := Constants.AF_INET;
Set_Family (Sin.Sin_Family, Family_Inet);
Sin.Sin_Addr.S_B1 := 127;
Sin.Sin_Addr.S_B2 := 0;
Sin.Sin_Addr.S_B3 := 0;
Sin.Sin_Addr.S_B4 := 1;
Sin.Sin_Port := 0;
Len := C.int (Lengths (Family_Inet));
Res := C_Bind (L_Sock, Sin'Address, Len);
if Res = Failure then
@ -143,7 +142,7 @@ package body Signalling_Fds is
-- marked "in use", even though it has been closed (perhaps by some
-- other process that has already exited). This causes the above
-- C_Connect to fail with EADDRINUSE. In this case, we close the
-- ports, and loop back to try again. This mysterious windows
-- ports, and loop back to try again. This mysterious Windows
-- behavior is documented. See, for example:
-- http://msdn2.microsoft.com/en-us/library/ms737625.aspx
-- In an experiment with 2000 calls, 21 required exactly one retry, 7
@ -186,7 +185,7 @@ package body Signalling_Fds is
Fds.all := (Read_End => R_Sock, Write_End => W_Sock);
return Success;
return Thin_Common.Success;
<<Fail>>
declare

View File

@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2007, AdaCore --
-- Copyright (C) 2007-2008, 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- --
@ -34,7 +34,9 @@
-- This version is used on VxWorks. Note that the corresponding spec is in
-- g-sttsne-locking.ads.
with Ada.Unchecked_Conversion;
with Interfaces.C; use Interfaces.C;
with GNAT.Sockets.Constants;
package body GNAT.Sockets.Thin.Task_Safe_NetDB is

View File

@ -51,16 +51,19 @@
#include "gsocket.h"
typedef enum { NUM, TXT } kind_t;
struct line {
char *text;
char *value;
char *comment;
kind_t kind;
struct line *next;
};
struct line *first = NULL, *last = NULL;
#define TXT(_text) add_line(_text, NULL, NULL);
#define TXT(_text) add_line(_text, NULL, NULL, TXT);
/* Plain text */
#define _NL TXT("")
@ -69,13 +72,13 @@ struct line *first = NULL, *last = NULL;
#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);
#define CND(name,comment) add_line(#name, itoad (name), comment, NUM);
/* Constant (decimal) */
#define CNX(name,comment) add_line(#name, itoax (name), comment);
#define CNX(name,comment) add_line(#name, itoax (name), comment, NUM);
/* Constant (hexadecimal) */
#define CN_(name,comment) add_line(#name, name, comment);
#define CN_(name,comment) add_line(#name, name, comment, TXT);
/* Constant (generic) */
#define STR(p) STR1(p)
@ -87,7 +90,7 @@ void output (void);
char *f_itoa (char *, int);
/* int to string */
void add_line (char *, char*, char*);
void add_line (char *, char*, char*, kind_t);
#ifdef __MINGW32__
unsigned int _CRT_fmode = _O_BINARY;
@ -137,6 +140,7 @@ 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
TXT("with Interfaces.C;")
TXT("package GNAT.Sockets.Constants is")
_NL
TXT(" --------------")
@ -145,12 +149,14 @@ TXT(" --------------")
_NL
#ifndef AF_INET
#define AF_INET -1
# define AF_INET -1
#endif
CND(AF_INET, "IPv4 address family")
#ifndef AF_INET6
#define AF_INET6 -1
# define AF_INET6 -1
#else
# define HAVE_AF_INET6 1
#endif
CND(AF_INET6, "IPv6 address family")
_NL
@ -604,7 +610,34 @@ CND(SIZEOF_tv_sec, "tv_sec")
#define SIZEOF_tv_usec (sizeof tv.tv_usec)
CND(SIZEOF_tv_usec, "tv_usec")
}
_NL
TXT(" -- Sizes of protocol specific address types (for sockaddr.sa_len)")
_NL
#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
CND(SIZEOF_sockaddr_in, "struct sockaddr_in")
#ifdef HAVE_AF_INET6
# define SIZEOF_sockaddr_in6 (sizeof (struct sockaddr_in6))
#else
# define SIZEOF_sockaddr_in6 0
#endif
CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
_NL
TXT(" -- Size of file descriptor sets")
_NL
#define SIZEOF_fd_set (sizeof (fd_set))
CND(SIZEOF_fd_set, "fd_set");
_NL
TXT(" -- Fields of struct hostent")
_NL
#ifdef __MINGW32__
# define h_addrtype_t "short"
# define h_length_t "short"
#else
# define h_addrtype_t "int"
# define h_length_t "int"
#endif
TXT(" subtype H_Addrtype_T is Interfaces.C." h_addrtype_t ";")
TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
_NL
TXT(" ----------------------------------------")
TXT(" -- Properties of supported interfaces --")
@ -612,6 +645,10 @@ TXT(" ----------------------------------------")
_NL
CND(Need_Netdb_Buffer, "Need buffer for Netdb ops")
CND(Has_Sockaddr_Len, "Sockaddr has sa_len field")
_NL
TXT(" Thread_Blocking_IO : constant Boolean := True;")
TXT(" -- Set False for contexts where socket i/o are process blocking")
#ifdef __vxworks
_NL
@ -641,17 +678,8 @@ CND(WSASYSNOTREADY, "System not ready")
CND(WSAVERNOTSUPPORTED, "Version not supported")
CND(WSANOTINITIALISED, "Winsock not initialized")
CND(WSAEDISCON, "Disconnected")
#endif
_NL
TXT(" ----------------------")
TXT(" -- Additional flags --")
TXT(" ----------------------")
_NL
TXT(" Thread_Blocking_IO : constant Boolean := True;")
TXT(" -- Set False for contexts where socket i/o are process blocking")
_NL
TXT("end GNAT.Sockets.Constants;")
@ -672,7 +700,8 @@ output (void) {
for (p = first; p != NULL; p = p->next) {
if (p->value != NULL) {
UPD_MAX(text);
UPD_MAX(value);
if (p->kind == NUM)
UPD_MAX(value);
}
}
sprintf (fmt, " %%-%ds : constant := %%%ds;%%s%%s\n",
@ -700,13 +729,15 @@ f_itoa (char *fmt, int n) {
}
void
add_line (char *_text, char *_value, char *_comment) {
add_line (char *_text, char *_value, char *_comment, kind_t _kind) {
struct line *l = (struct line *) malloc (sizeof (struct line));
l->text = _text;
l->value = _value;
l->text = _text;
l->value = _value;
l->comment = _comment;
l->next = NULL;
l->kind = _kind;
l->next = NULL;
if (last == NULL)
first = last = l;
else {

View File

@ -184,3 +184,9 @@
#else
# define Need_Netdb_Buffer 0
#endif
#if defined (__FreeBSD__) || defined (__vxworks)
# define Has_Sockaddr_Len 1
#else
# define Has_Sockaddr_Len 0
#endif