aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2019-07-11 08:02:49 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-11 08:02:49 +0000
commit810097a72d1767627d2439bb94627b443f41bf7f (patch)
tree147af898e56b2f02fc9bc68cd4dac24e1dbc2cc1
parent1048a1839fde97a1bd790b002dad8b79e172724f (diff)
downloadgcc-810097a72d1767627d2439bb94627b443f41bf7f.zip
gcc-810097a72d1767627d2439bb94627b443f41bf7f.tar.gz
gcc-810097a72d1767627d2439bb94627b443f41bf7f.tar.bz2
[Ada] GNAT.Sockets: support ICMP, IGMP and RAW IP protocol levels
2019-07-11 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * libgnat/g-socket.ads (Level_Type): Add enumerators for IP_Protocol_For_ICMP, IP_Protocol_For_IGMP, IP_Protocol_For_RAW_Level. * libgnat/g-socket.adb (Levels): Handle them. * s-oscons-tmplt.c: Import socket protocols defined in netinet/in.h. From-SVN: r273398
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/libgnat/g-socket.adb5
-rw-r--r--gcc/ada/libgnat/g-socket.ads5
-rw-r--r--gcc/ada/s-oscons-tmplt.c105
4 files changed, 122 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2f8ad77..3b04ce8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2019-07-11 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * libgnat/g-socket.ads (Level_Type): Add enumerators for
+ IP_Protocol_For_ICMP, IP_Protocol_For_IGMP,
+ IP_Protocol_For_RAW_Level.
+ * libgnat/g-socket.adb (Levels): Handle them.
+ * s-oscons-tmplt.c: Import socket protocols defined in
+ netinet/in.h.
+
2019-07-11 Claire Dross <dross@adacore.com>
* libgnat/a-cfhama.adb, libgnat/a-cfhase.adb (Free): Do not
diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb
index 689389f..ceb2cb0 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -73,7 +73,10 @@ package body GNAT.Sockets is
IP_Protocol_For_IP_Level => SOSC.IPPROTO_IP,
IP_Protocol_For_IPv6_Level => SOSC.IPPROTO_IPV6,
IP_Protocol_For_UDP_Level => SOSC.IPPROTO_UDP,
- IP_Protocol_For_TCP_Level => SOSC.IPPROTO_TCP);
+ IP_Protocol_For_TCP_Level => SOSC.IPPROTO_TCP,
+ IP_Protocol_For_ICMP_Level => SOSC.IPPROTO_ICMP,
+ IP_Protocol_For_IGMP_Level => SOSC.IPPROTO_IGMP,
+ IP_Protocol_For_RAW_Level => SOSC.IPPROTO_RAW);
Modes : constant array (Mode_Type) of C.int :=
(Socket_Stream => SOSC.SOCK_STREAM,
diff --git a/gcc/ada/libgnat/g-socket.ads b/gcc/ada/libgnat/g-socket.ads
index 342577a..acd72f1 100644
--- a/gcc/ada/libgnat/g-socket.ads
+++ b/gcc/ada/libgnat/g-socket.ads
@@ -773,7 +773,10 @@ package GNAT.Sockets is
IP_Protocol_For_IP_Level,
IP_Protocol_For_IPv6_Level,
IP_Protocol_For_UDP_Level,
- IP_Protocol_For_TCP_Level);
+ IP_Protocol_For_TCP_Level,
+ IP_Protocol_For_ICMP_Level,
+ IP_Protocol_For_IGMP_Level,
+ IP_Protocol_For_RAW_Level);
-- There are several options available to manipulate sockets. Each option
-- has a name and several values available. Most of the time, the value
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 1e883b9..655d68a 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -1292,6 +1292,111 @@ CND(IPPROTO_UDP, "UDP")
#endif
CND(IPPROTO_TCP, "TCP")
+#ifndef IPPROTO_ICMP
+# define IPPROTO_ICMP -1
+#endif
+CND(IPPROTO_ICMP, "Internet Control Message Protocol")
+
+#ifndef IPPROTO_IGMP
+# define IPPROTO_IGMP -1
+#endif
+CND(IPPROTO_IGMP, "Internet Group Management Protocol")
+
+#ifndef IPPROTO_IPIP
+# define IPPROTO_IPIP -1
+#endif
+CND(IPPROTO_IPIP, "IPIP tunnels (older KA9Q tunnels use 94)")
+
+#ifndef IPPROTO_EGP
+# define IPPROTO_EGP -1
+#endif
+CND(IPPROTO_EGP, "Exterior Gateway Protocol")
+
+#ifndef IPPROTO_PUP
+# define IPPROTO_PUP -1
+#endif
+CND(IPPROTO_PUP, "PUP protocol")
+
+#ifndef IPPROTO_IDP
+# define IPPROTO_IDP -1
+#endif
+CND(IPPROTO_IDP, "XNS IDP protocol")
+
+#ifndef IPPROTO_TP
+# define IPPROTO_TP -1
+#endif
+CND(IPPROTO_TP, "SO Transport Protocol Class 4")
+
+#ifndef IPPROTO_DCCP
+# define IPPROTO_DCCP -1
+#endif
+CND(IPPROTO_DCCP, "Datagram Congestion Control Protocol")
+
+#ifndef IPPROTO_RSVP
+# define IPPROTO_RSVP -1
+#endif
+CND(IPPROTO_RSVP, "Reservation Protocol")
+
+#ifndef IPPROTO_GRE
+# define IPPROTO_GRE -1
+#endif
+CND(IPPROTO_GRE, "General Routing Encapsulation")
+
+#ifndef IPPROTO_ESP
+# define IPPROTO_ESP -1
+#endif
+CND(IPPROTO_ESP, "encapsulating security payload")
+
+#ifndef IPPROTO_AH
+# define IPPROTO_AH -1
+#endif
+CND(IPPROTO_AH, "authentication header")
+
+#ifndef IPPROTO_MTP
+# define IPPROTO_MTP -1
+#endif
+CND(IPPROTO_MTP, "Multicast Transport Protocol")
+
+#ifndef IPPROTO_BEETPH
+# define IPPROTO_BEETPH -1
+#endif
+CND(IPPROTO_BEETPH, "IP option pseudo header for BEET")
+
+#ifndef IPPROTO_ENCAP
+# define IPPROTO_ENCAP -1
+#endif
+CND(IPPROTO_ENCAP, "Encapsulation Header")
+
+#ifndef IPPROTO_PIM
+# define IPPROTO_PIM -1
+#endif
+CND(IPPROTO_PIM, "Protocol Independent Multicast")
+
+#ifndef IPPROTO_COMP
+# define IPPROTO_COMP -1
+#endif
+CND(IPPROTO_COMP, "Compression Header Protocol")
+
+#ifndef IPPROTO_SCTP
+# define IPPROTO_SCTP -1
+#endif
+CND(IPPROTO_SCTP, "Stream Control Transmission Protocol")
+
+#ifndef IPPROTO_UDPLITE
+# define IPPROTO_UDPLITE -1
+#endif
+CND(IPPROTO_UDPLITE, "UDP-Lite protocol")
+
+#ifndef IPPROTO_MPLS
+# define IPPROTO_MPLS -1
+#endif
+CND(IPPROTO_MPLS, "MPLS in IP")
+
+#ifndef IPPROTO_RAW
+# define IPPROTO_RAW -1
+#endif
+CND(IPPROTO_RAW, "Raw IP packets")
+
/*
-------------------