Commit 4e0ede3d by Thomas Quinot Committed by Arnaud Charlet

re PR ada/33688 (Ada package Gnat.Sockets missing constant for IP_PKTINFO (patch))

2008-03-26  Thomas Quinot  <quinot@adacore.com>

PR ada/33688

	* g-socket.ads, g-socket.adb (Options, Set_Socket_Option,
	Get_Socket_Option): Add support for Receive_Packet_Info.

	* g-soccon.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-freebsd.ads,
	g-soccon-hpux-ia64.ads, g-soccon-solaris-64.ads, g-soccon-darwin.ads,
	g-soccon-lynxos.ads, g-soccon-linux-64.ads, g-soccon-linux-x86.ads: Add
	new constants SO_REUSEPORT and IP_PKTINFO

From-SVN: r133545
parent 939759fc
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be -- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program. -- directly with'ed by an applications program.
-- This is the version for powerpc-apple-darwin8.8.0 -- This is the version for powerpc-apple-darwin8.9.0
-- This file is generated automatically, do not modify it by hand! Instead, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -182,7 +183,7 @@ package GNAT.Sockets.Constants is ...@@ -182,7 +183,7 @@ package GNAT.Sockets.Constants is
-- Properties of supported interfaces -- -- Properties of supported interfaces --
---------------------------------------- ----------------------------------------
Need_Netdb_Buffer : constant := 1; -- Need buffer for Netdb ops Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
---------------------- ----------------------
-- Additional flags -- -- Additional flags --
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be -- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program. -- directly with'ed by an applications program.
-- This is the version for i386-unknown-freebsd6.1 -- This is the version for i386-unknown-freebsd6.2
-- This file is generated automatically, do not modify it by hand! Instead, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 22; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 23; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 24; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be -- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program. -- directly with'ed by an applications program.
-- This is the version for ia64-hp-linux-gnu -- This is the version for x86_64-pc-linux-gnu
-- This file is generated automatically, do not modify it by hand! Instead, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address 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_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
SO_LINGER : constant := 13; -- Defer close to flush data SO_LINGER : constant := 13; -- Defer close to flush data
SO_BROADCAST : constant := 6; -- Can send broadcast msgs SO_BROADCAST : constant := 6; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
IP_PKTINFO : constant := 8; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address 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_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
SO_LINGER : constant := 13; -- Defer close to flush data SO_LINGER : constant := 13; -- Defer close to flush data
SO_BROADCAST : constant := 6; -- Can send broadcast msgs SO_BROADCAST : constant := 6; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
IP_PKTINFO : constant := 8; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := 19; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
...@@ -184,13 +186,6 @@ package GNAT.Sockets.Constants is ...@@ -184,13 +186,6 @@ package GNAT.Sockets.Constants is
Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops Need_Netdb_Buffer : constant := 0; -- Need buffer for Netdb ops
----------------------
-- Additional flags --
----------------------
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
------------------------------ ------------------------------
-- MinGW-specific constants -- -- MinGW-specific constants --
------------------------------ ------------------------------
...@@ -203,4 +198,11 @@ package GNAT.Sockets.Constants is ...@@ -203,4 +198,11 @@ package GNAT.Sockets.Constants is
WSANOTINITIALISED : constant := 10093; -- Winsock not intialized WSANOTINITIALISED : constant := 10093; -- Winsock not intialized
WSAEDISCON : constant := 10101; -- Disconnected WSAEDISCON : constant := 10101; -- Disconnected
----------------------
-- Additional flags --
----------------------
Thread_Blocking_IO : constant Boolean := True;
-- Set False for contexts where socket i/o are process blocking
end GNAT.Sockets.Constants; end GNAT.Sockets.Constants;
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be -- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program. -- directly with'ed by an applications program.
-- This is the version for sparc-sun-solaris2.8/64 -- This is the version for sparc64-sun-solaris2.8
-- This file is generated automatically, do not modify it by hand! Instead, -- 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. -- make changes to gen-soccon.c and re-run it on each target.
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is ...@@ -149,6 +149,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 4; -- Bind reuse local address 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_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
SO_LINGER : constant := 128; -- Defer close to flush data SO_LINGER : constant := 128; -- Defer close to flush data
SO_BROADCAST : constant := 32; -- Can send broadcast msgs SO_BROADCAST : constant := 32; -- Can send broadcast msgs
...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is ...@@ -162,6 +163,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
IP_PKTINFO : constant := -1; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -156,6 +156,7 @@ package GNAT.Sockets.Constants is ...@@ -156,6 +156,7 @@ package GNAT.Sockets.Constants is
TCP_NODELAY : constant := 1; -- Do not coalesce packets TCP_NODELAY : constant := 1; -- Do not coalesce packets
SO_REUSEADDR : constant := 2; -- Bind reuse local address 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_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
SO_LINGER : constant := 13; -- Defer close to flush data SO_LINGER : constant := 13; -- Defer close to flush data
SO_BROADCAST : constant := 6; -- Can send broadcast msgs SO_BROADCAST : constant := 6; -- Can send broadcast msgs
...@@ -169,6 +170,7 @@ package GNAT.Sockets.Constants is ...@@ -169,6 +170,7 @@ package GNAT.Sockets.Constants is
IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
IP_PKTINFO : constant := 8; -- Get datagram info
------------------- -------------------
-- System limits -- -- System limits --
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -87,21 +87,24 @@ package body GNAT.Sockets is ...@@ -87,21 +87,24 @@ package body GNAT.Sockets is
N_Bytes_To_Read => Constants.FIONREAD); N_Bytes_To_Read => Constants.FIONREAD);
Options : constant array (Option_Name) of C.int := Options : constant array (Option_Name) of C.int :=
(Keep_Alive => Constants.SO_KEEPALIVE, (Keep_Alive => Constants.SO_KEEPALIVE,
Reuse_Address => Constants.SO_REUSEADDR, Reuse_Address => Constants.SO_REUSEADDR,
Broadcast => Constants.SO_BROADCAST, Broadcast => Constants.SO_BROADCAST,
Send_Buffer => Constants.SO_SNDBUF, Send_Buffer => Constants.SO_SNDBUF,
Receive_Buffer => Constants.SO_RCVBUF, Receive_Buffer => Constants.SO_RCVBUF,
Linger => Constants.SO_LINGER, Linger => Constants.SO_LINGER,
Error => Constants.SO_ERROR, Error => Constants.SO_ERROR,
No_Delay => Constants.TCP_NODELAY, No_Delay => Constants.TCP_NODELAY,
Add_Membership => Constants.IP_ADD_MEMBERSHIP, Add_Membership => Constants.IP_ADD_MEMBERSHIP,
Drop_Membership => Constants.IP_DROP_MEMBERSHIP, Drop_Membership => Constants.IP_DROP_MEMBERSHIP,
Multicast_If => Constants.IP_MULTICAST_IF, Multicast_If => Constants.IP_MULTICAST_IF,
Multicast_TTL => Constants.IP_MULTICAST_TTL, Multicast_TTL => Constants.IP_MULTICAST_TTL,
Multicast_Loop => Constants.IP_MULTICAST_LOOP, Multicast_Loop => Constants.IP_MULTICAST_LOOP,
Send_Timeout => Constants.SO_SNDTIMEO, Receive_Packet_Info => Constants.IP_PKTINFO,
Receive_Timeout => Constants.SO_RCVTIMEO); Send_Timeout => Constants.SO_SNDTIMEO,
Receive_Timeout => Constants.SO_RCVTIMEO);
-- ??? Note: for OpenSolaris, Receive_Packet_Info should be IP_RECVPKTINFO,
-- but for Linux compatibility this constant is the same as IP_PKTINFO.
Flags : constant array (0 .. 3) of C.int := Flags : constant array (0 .. 3) of C.int :=
(0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data (0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data
...@@ -865,8 +868,7 @@ package body GNAT.Sockets is ...@@ -865,8 +868,7 @@ package body GNAT.Sockets is
begin begin
if Safe_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then if Safe_Getservbyname (SN, SP, Res'Access, Buf'Address, Buflen) /= 0 then
Ada.Exceptions.Raise_Exception raise Service_Error with "Service not found";
(Service_Error'Identity, "Service not found");
end if; end if;
-- Translate from the C format to the API format -- Translate from the C format to the API format
...@@ -892,8 +894,7 @@ package body GNAT.Sockets is ...@@ -892,8 +894,7 @@ package body GNAT.Sockets is
(C.int (Short_To_Network (C.unsigned_short (Port))), SP, (C.int (Short_To_Network (C.unsigned_short (Port))), SP,
Res'Access, Buf'Address, Buflen) /= 0 Res'Access, Buf'Address, Buflen) /= 0
then then
Ada.Exceptions.Raise_Exception raise Service_Error with "Service not found";
(Service_Error'Identity, "Service not found");
end if; end if;
-- Translate from the C format to the API format -- Translate from the C format to the API format
...@@ -946,8 +947,9 @@ package body GNAT.Sockets is ...@@ -946,8 +947,9 @@ package body GNAT.Sockets is
begin begin
case Name is case Name is
when Multicast_Loop | when Multicast_Loop |
Multicast_TTL => Multicast_TTL |
Receive_Packet_Info =>
Len := V1'Size / 8; Len := V1'Size / 8;
Add := V1'Address; Add := V1'Address;
...@@ -1015,7 +1017,8 @@ package body GNAT.Sockets is ...@@ -1015,7 +1017,8 @@ package body GNAT.Sockets is
when Multicast_TTL => when Multicast_TTL =>
Opt.Time_To_Live := Integer (V1); Opt.Time_To_Live := Integer (V1);
when Multicast_Loop => when Multicast_Loop |
Receive_Packet_Info =>
Opt.Enabled := (V1 /= 0); Opt.Enabled := (V1 /= 0);
when Send_Timeout | when Send_Timeout |
...@@ -1320,9 +1323,9 @@ package body GNAT.Sockets is ...@@ -1320,9 +1323,9 @@ package body GNAT.Sockets is
procedure Raise_Host_Error (H_Error : Integer) is procedure Raise_Host_Error (H_Error : Integer) is
begin begin
Ada.Exceptions.Raise_Exception (Host_Error'Identity, raise Host_Error with
Err_Code_Image (H_Error) Err_Code_Image (H_Error)
& C.Strings.Value (Host_Error_Messages.Host_Error_Message (H_Error))); & C.Strings.Value (Host_Error_Messages.Host_Error_Message (H_Error));
end Raise_Host_Error; end Raise_Host_Error;
------------------------ ------------------------
...@@ -1332,9 +1335,9 @@ package body GNAT.Sockets is ...@@ -1332,9 +1335,9 @@ package body GNAT.Sockets is
procedure Raise_Socket_Error (Error : Integer) is procedure Raise_Socket_Error (Error : Integer) is
use type C.Strings.chars_ptr; use type C.Strings.chars_ptr;
begin begin
Ada.Exceptions.Raise_Exception (Socket_Error'Identity, raise Socket_Error with
Err_Code_Image (Error) Err_Code_Image (Error)
& C.Strings.Value (Socket_Error_Message (Error))); & C.Strings.Value (Socket_Error_Message (Error));
end Raise_Socket_Error; end Raise_Socket_Error;
---------- ----------
...@@ -1795,7 +1798,8 @@ package body GNAT.Sockets is ...@@ -1795,7 +1798,8 @@ package body GNAT.Sockets is
Len := V1'Size / 8; Len := V1'Size / 8;
Add := V1'Address; Add := V1'Address;
when Multicast_Loop => when Multicast_Loop |
Receive_Packet_Info =>
V1 := C.unsigned_char (Boolean'Pos (Option.Enabled)); V1 := C.unsigned_char (Boolean'Pos (Option.Enabled));
Len := V1'Size / 8; Len := V1'Size / 8;
Add := V1'Address; Add := V1'Address;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -623,30 +623,32 @@ package GNAT.Sockets is ...@@ -623,30 +623,32 @@ package GNAT.Sockets is
-- a boolean to enable or disable this option. -- a boolean to enable or disable this option.
type Option_Name is ( type Option_Name is (
Keep_Alive, -- Enable sending of keep-alive messages Keep_Alive, -- Enable sending of keep-alive messages
Reuse_Address, -- Allow bind to reuse local address Reuse_Address, -- Allow bind to reuse local address
Broadcast, -- Enable datagram sockets to recv/send broadcasts Broadcast, -- Enable datagram sockets to recv/send broadcasts
Send_Buffer, -- Set/get the maximum socket send buffer in bytes Send_Buffer, -- Set/get the maximum socket send buffer in bytes
Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
Linger, -- Shutdown wait for msg to be sent or timeout occur Linger, -- Shutdown wait for msg to be sent or timeout occur
Error, -- Get and clear the pending socket error Error, -- Get and clear the pending socket error
No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY) No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY)
Add_Membership, -- Join a multicast group Add_Membership, -- Join a multicast group
Drop_Membership, -- Leave a multicast group Drop_Membership, -- Leave a multicast group
Multicast_If, -- Set default outgoing interface for multicast packets Multicast_If, -- Set default out interface for multicast packets
Multicast_TTL, -- Indicate the time-to-live of sent multicast packets Multicast_TTL, -- Set the time-to-live of sent multicast packets
Multicast_Loop, -- Sent multicast packets are looped to local socket Multicast_Loop, -- Sent multicast packets are looped to local socket
Send_Timeout, -- Set timeout value for output Receive_Packet_Info, -- Receive low level packet info as ancillary data
Receive_Timeout); -- Set timeout value for input Send_Timeout, -- Set timeout value for output
Receive_Timeout); -- Set timeout value for input
type Option_Type (Name : Option_Name := Keep_Alive) is record type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is case Name is
when Keep_Alive | when Keep_Alive |
Reuse_Address | Reuse_Address |
Broadcast | Broadcast |
Linger | Linger |
No_Delay | No_Delay |
Multicast_Loop => Receive_Packet_Info |
Multicast_Loop =>
Enabled : Boolean; Enabled : Boolean;
case Name is case Name is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment