From d4ba738c67e5579d5a0dff07f20b36f3df9529d5 Mon Sep 17 00:00:00 2001 From: Dmitriy Anisimkov Date: Thu, 11 Jul 2019 08:02:26 +0000 Subject: [PATCH] [Ada] GNAT.Sockets: add support for RAW sockets 2019-07-11 Dmitriy Anisimkov gcc/ada/ * libgnat/g-socket.ads (Mode_Type): Add a Socket_Raw enumerator. * libgnat/g-socket.adb (Modes): Handle Socket_Raw. From-SVN: r273393 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/libgnat/g-socket.adb | 3 ++- gcc/ada/libgnat/g-socket.ads | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b51a3ccba7a..e20d10cb525 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-07-11 Dmitriy Anisimkov + + * libgnat/g-socket.ads (Mode_Type): Add a Socket_Raw enumerator. + * libgnat/g-socket.adb (Modes): Handle Socket_Raw. + 2019-07-11 Justin Squirek * exp_ch9.adb (Build_Private_Protected_Declaration): Add diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb index 2c9b8c76afd..689389f9cc8 100644 --- a/gcc/ada/libgnat/g-socket.adb +++ b/gcc/ada/libgnat/g-socket.adb @@ -77,7 +77,8 @@ package body GNAT.Sockets is Modes : constant array (Mode_Type) of C.int := (Socket_Stream => SOSC.SOCK_STREAM, - Socket_Datagram => SOSC.SOCK_DGRAM); + Socket_Datagram => SOSC.SOCK_DGRAM, + Socket_Raw => SOSC.SOCK_RAW); Shutmodes : constant array (Shutmode_Type) of C.int := (Shut_Read => SOSC.SHUT_RD, diff --git a/gcc/ada/libgnat/g-socket.ads b/gcc/ada/libgnat/g-socket.ads index 6db3c5422a9..342577a4ae3 100644 --- a/gcc/ada/libgnat/g-socket.ads +++ b/gcc/ada/libgnat/g-socket.ads @@ -475,16 +475,17 @@ package GNAT.Sockets is -- The order of the enumeration elements should not be changed unilaterally -- because the IPv6_TCP_Preferred routine rely on it. - type Mode_Type is (Socket_Stream, Socket_Datagram); + type Mode_Type is (Socket_Stream, Socket_Datagram, Socket_Raw); -- Stream sockets provide connection-oriented byte streams. Datagram - -- sockets support unreliable connectionless message based communication. + -- sockets support unreliable connectionless message-based communication. + -- Raw sockets provide raw network-protocol access. -- The order of the enumeration elements should not be changed unilaterally - -- because the IPv6_TCP_Preferred routine rely on it. + -- because the IPv6_TCP_Preferred routine relies on it. type Shutmode_Type is (Shut_Read, Shut_Write, Shut_Read_Write); -- When a process closes a socket, the policy is to retain any data queued -- until either a delivery or a timeout expiration (in this case, the data - -- are discarded). A finer control is available through shutdown. With + -- are discarded). Finer control is available through shutdown. With -- Shut_Read, no more data can be received from the socket. With_Write, no -- more data can be transmitted. Neither transmission nor reception can be -- performed with Shut_Read_Write. -- 2.30.2