IP_Protocol_For_TCP_Level);
-- There are several options available to manipulate sockets. Each option
- -- has a name and several values available. Most of the time, the value is
- -- a boolean to enable or disable this option.
+ -- has a name and several values available. Most of the time, the value
+ -- 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
(Generic_Option,
- Keep_Alive, -- Enable sending of keep-alive messages
- Reuse_Address, -- Allow bind to reuse local address
- Broadcast, -- Enable datagram sockets to recv/send broadcasts
- Send_Buffer, -- Set/get the maximum socket send buffer in bytes
- Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
- Linger, -- Shutdown wait for msg to be sent or timeout occur
- Error, -- Get and clear the pending socket error
- No_Delay, -- Do not delay send to coalesce data (TCP_NODELAY)
- Add_Membership_V4, -- Join a multicast group
- Add_Membership_V6, -- Idem for IPv6 socket
- Drop_Membership_V4, -- Leave a multicast group
- Drop_Membership_V6, -- Idem for IPv6 socket
- Multicast_If_V4, -- Set default out interface for multicast packets
- Multicast_If_V6, -- Idem for IPv6 socket
- Multicast_Loop_V4, -- Sent multicast packets are looped to local socket
- Multicast_Loop_V6, -- Idem for IPv6 socket
- Multicast_TTL, -- Set the time-to-live of sent multicast packets
- Multicast_Hops, -- Set the multicast hop limit for the IPv6 socket
- Receive_Packet_Info, -- Receive low level packet info as ancillary data
- Send_Timeout, -- Set timeout value for output
- Receive_Timeout, -- Set timeout value for input
- IPv6_Only, -- Restricted to IPv6 communications only
- Busy_Polling); -- Set busy polling mode
+ -- Can be used to set/get any socket option via an OS-specific option
+ -- code with an integer value.
+
+ ------------------
+ -- Socket_Level --
+ ------------------
+
+ Keep_Alive, -- SO_KEEPALIVE
+ -- Enable sending of keep-alive messages on connection-oriented sockets
+
+ Reuse_Address, -- SO_REUSEADDR
+ -- Enable binding to an address and port already in use
+
+ Broadcast, -- SO_BROADCAST
+ -- Enable sending broadcast datagrams on the socket
+
+ Send_Buffer, -- SO_SNDBUF
+ -- Set/get the maximum socket send buffer in bytes
+
+ Receive_Buffer, -- SO_RCVBUF
+ -- Set/get the maximum socket receive buffer in bytes
+
+ 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
Option_Name range Keep_Alive .. Option_Name'Last;
function Get_Socket_Option
(Socket : Socket_Type;
- Level : Level_Type := Socket_Level;
+ Level : Level_Type;
Name : Option_Name;
Optname : Interfaces.C.int := -1) return Option_Type;
-- Get the options associated with a socket. Raises Socket_Error on error.
procedure Set_Socket_Option
(Socket : Socket_Type;
- Level : Level_Type := Socket_Level;
+ Level : Level_Type;
Option : Option_Type);
-- Manipulate socket options. Raises Socket_Error on error