Commit 0a904120 by Dmitriy Anisimkov Committed by Pierre-Marie de Rodat

[Ada] GNAT.Sockets: remove default level in Get/Set_Socket_Option

2019-07-08  Dmitriy Anisimkov  <anisimko@adacore.com>

gcc/ada/

	* libgnat/g-socket.ads, libgnat/g-socket.adb: Improve
	documentation.
	(Get_Socket_Option, Set_Socket_Option): Remove default value for
	the Level formal.

From-SVN: r273198
parent e87f67eb
2019-07-08 Dmitriy Anisimkov <anisimko@adacore.com>
* libgnat/g-socket.ads, libgnat/g-socket.adb: Improve
documentation.
(Get_Socket_Option, Set_Socket_Option): Remove default value for
the Level formal.
2019-07-08 Ed Schonberg <schonberg@adacore.com> 2019-07-08 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): For an * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): For an
......
...@@ -1369,7 +1369,7 @@ package body GNAT.Sockets is ...@@ -1369,7 +1369,7 @@ package body GNAT.Sockets is
function Get_Socket_Option function Get_Socket_Option
(Socket : Socket_Type; (Socket : Socket_Type;
Level : Level_Type := Socket_Level; Level : Level_Type;
Name : Option_Name; Name : Option_Name;
Optname : Interfaces.C.int := -1) return Option_Type Optname : Interfaces.C.int := -1) return Option_Type
is is
...@@ -2539,7 +2539,7 @@ package body GNAT.Sockets is ...@@ -2539,7 +2539,7 @@ package body GNAT.Sockets is
procedure Set_Socket_Option procedure Set_Socket_Option
(Socket : Socket_Type; (Socket : Socket_Type;
Level : Level_Type := Socket_Level; Level : Level_Type;
Option : Option_Type) Option : Option_Type)
is is
use type C.unsigned; use type C.unsigned;
......
...@@ -775,34 +775,113 @@ package GNAT.Sockets is ...@@ -775,34 +775,113 @@ package GNAT.Sockets is
IP_Protocol_For_TCP_Level); IP_Protocol_For_TCP_Level);
-- There are several options available to manipulate sockets. Each option -- There are several options available to manipulate sockets. Each option
-- has a name and several values available. Most of the time, the value is -- has a name and several values available. Most of the time, the value
-- a boolean to enable or disable this option. -- is a boolean to enable or disable this option. Each socket option is
-- provided with an appropriate C name taken from the sockets API comments.
-- The C name can be used to find a detailed description in the OS-specific
-- documentation. The options are grouped by main Level_Type value, which
-- can be used together with this option in calls to the Set_Socket_Option
-- and Get_Socket_Option routines. Note that some options can be used with
-- more than one level.
type Option_Name is type Option_Name is
(Generic_Option, (Generic_Option,
Keep_Alive, -- Enable sending of keep-alive messages -- Can be used to set/get any socket option via an OS-specific option
Reuse_Address, -- Allow bind to reuse local address -- code with an integer value.
Broadcast, -- Enable datagram sockets to recv/send broadcasts
Send_Buffer, -- Set/get the maximum socket send buffer in bytes ------------------
Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes -- Socket_Level --
Linger, -- Shutdown wait for msg to be sent or timeout occur ------------------
Error, -- Get and clear the pending socket error
No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY) Keep_Alive, -- SO_KEEPALIVE
Add_Membership_V4, -- Join a multicast group -- Enable sending of keep-alive messages on connection-oriented sockets
Add_Membership_V6, -- Idem for IPv6 socket
Drop_Membership_V4, -- Leave a multicast group Reuse_Address, -- SO_REUSEADDR
Drop_Membership_V6, -- Idem for IPv6 socket -- Enable binding to an address and port already in use
Multicast_If_V4, -- Set default out interface for multicast packets
Multicast_If_V6, -- Idem for IPv6 socket Broadcast, -- SO_BROADCAST
Multicast_Loop_V4, -- Sent multicast packets are looped to local socket -- Enable sending broadcast datagrams on the socket
Multicast_Loop_V6, -- Idem for IPv6 socket
Multicast_TTL, -- Set the time-to-live of sent multicast packets Send_Buffer, -- SO_SNDBUF
Multicast_Hops, -- Set the multicast hop limit for the IPv6 socket -- Set/get the maximum socket send buffer in bytes
Receive_Packet_Info, -- Receive low level packet info as ancillary data
Send_Timeout, -- Set timeout value for output Receive_Buffer, -- SO_RCVBUF
Receive_Timeout, -- Set timeout value for input -- Set/get the maximum socket receive buffer in bytes
IPv6_Only, -- Restricted to IPv6 communications only
Busy_Polling); -- Set busy polling mode Linger, -- SO_LINGER
-- When enabled, a Close_Socket or Shutdown_Socket will wait until all
-- queued messages for the socket have been successfully sent or the
-- linger timeout has been reached.
Error, -- SO_ERROR
-- Get and clear the pending socket error integer code
Send_Timeout, -- SO_SNDTIMEO
-- Specify sending timeout until reporting an error
Receive_Timeout, -- SO_RCVTIMEO
-- Specify receiving timeout until reporting an error
Busy_Polling, -- SO_BUSY_POLL
-- Sets the approximate time in microseconds to busy poll on a blocking
-- receive when there is no data.
-------------------------------
-- IP_Protocol_For_TCP_Level --
-------------------------------
No_Delay, -- TCP_NODELAY
-- Disable the Nagle algorithm. This means that output buffer content
-- is always sent as soon as possible, even if there is only a small
-- amount of data.
------------------------------
-- IP_Protocol_For_IP_Level --
------------------------------
Add_Membership_V4, -- IP_ADD_MEMBERSHIP
-- Join a multicast group
Drop_Membership_V4, -- IP_DROP_MEMBERSHIP
-- Leave a multicast group
Multicast_If_V4, -- IP_MULTICAST_IF
-- Set/Get outgoing interface for sending multicast packets
Multicast_Loop_V4, -- IP_MULTICAST_LOOP
-- This boolean option determines whether sent multicast packets should
-- be looped back to the local sockets.
Multicast_TTL, -- IP_MULTICAST_TTL
-- Set/Get the time-to-live of sent multicast packets
Receive_Packet_Info, -- IP_PKTINFO
-- Receive low-level packet info as ancillary data
--------------------------------
-- IP_Protocol_For_IPv6_Level --
--------------------------------
Add_Membership_V6, -- IPV6_ADD_MEMBERSHIP
-- Join IPv6 multicast group
Drop_Membership_V6, -- IPV6_DROP_MEMBERSHIP
-- Leave IPv6 multicast group
Multicast_If_V6, -- IPV6_MULTICAST_IF
-- Set/Get outgoing interface index for sending multicast packets
Multicast_Loop_V6, -- IPV6_MULTICAST_LOOP
-- This boolean option determines whether sent multicast IPv6 packets
-- should be looped back to the local sockets.
IPv6_Only, -- IPV6_V6ONLY
-- Restricted to IPv6 communications only
Multicast_Hops -- IPV6_MULTICAST_HOPS
-- Set the multicast hop limit for the IPv6 socket
);
subtype Specific_Option_Name is subtype Specific_Option_Name is
Option_Name range Keep_Alive .. Option_Name'Last; Option_Name range Keep_Alive .. Option_Name'Last;
...@@ -1084,7 +1163,7 @@ package GNAT.Sockets is ...@@ -1084,7 +1163,7 @@ package GNAT.Sockets is
function Get_Socket_Option function Get_Socket_Option
(Socket : Socket_Type; (Socket : Socket_Type;
Level : Level_Type := Socket_Level; Level : Level_Type;
Name : Option_Name; Name : Option_Name;
Optname : Interfaces.C.int := -1) return Option_Type; Optname : Interfaces.C.int := -1) 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.
...@@ -1199,7 +1278,7 @@ package GNAT.Sockets is ...@@ -1199,7 +1278,7 @@ package GNAT.Sockets is
procedure Set_Socket_Option procedure Set_Socket_Option
(Socket : Socket_Type; (Socket : Socket_Type;
Level : Level_Type := Socket_Level; Level : Level_Type;
Option : Option_Type); Option : Option_Type);
-- Manipulate socket options. Raises Socket_Error on error -- Manipulate socket options. Raises Socket_Error on error
......
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