Commit 810097a7 by Dmitriy Anisimkov Committed by Pierre-Marie de Rodat

[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
parent 1048a183
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> 2019-07-11 Claire Dross <dross@adacore.com>
* libgnat/a-cfhama.adb, libgnat/a-cfhase.adb (Free): Do not * libgnat/a-cfhama.adb, libgnat/a-cfhase.adb (Free): Do not
......
...@@ -73,7 +73,10 @@ package body GNAT.Sockets is ...@@ -73,7 +73,10 @@ package body GNAT.Sockets is
IP_Protocol_For_IP_Level => SOSC.IPPROTO_IP, IP_Protocol_For_IP_Level => SOSC.IPPROTO_IP,
IP_Protocol_For_IPv6_Level => SOSC.IPPROTO_IPV6, IP_Protocol_For_IPv6_Level => SOSC.IPPROTO_IPV6,
IP_Protocol_For_UDP_Level => SOSC.IPPROTO_UDP, 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 := Modes : constant array (Mode_Type) of C.int :=
(Socket_Stream => SOSC.SOCK_STREAM, (Socket_Stream => SOSC.SOCK_STREAM,
......
...@@ -773,7 +773,10 @@ package GNAT.Sockets is ...@@ -773,7 +773,10 @@ package GNAT.Sockets is
IP_Protocol_For_IP_Level, IP_Protocol_For_IP_Level,
IP_Protocol_For_IPv6_Level, IP_Protocol_For_IPv6_Level,
IP_Protocol_For_UDP_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 -- There are several options available to manipulate sockets. Each option
-- has a name and several values available. Most of the time, the value -- has a name and several values available. Most of the time, the value
......
...@@ -1292,6 +1292,111 @@ CND(IPPROTO_UDP, "UDP") ...@@ -1292,6 +1292,111 @@ CND(IPPROTO_UDP, "UDP")
#endif #endif
CND(IPPROTO_TCP, "TCP") 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")
/* /*
------------------- -------------------
......
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