/usr/share/ada/adainclude/anet/anet-sockets-inet.ads is in libanet0.3.1-dev 0.3.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | --
-- Copyright (C) 2012 secunet Security Networks AG
-- Copyright (C) 2012-2014 Reto Buerki <reet@codelabs.ch>
-- Copyright (C) 2012-2014 Adrian-Ken Rueegsegger <ken@codelabs.ch>
--
-- This program is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; either version 2 of the License, or (at your
-- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-- for more details.
--
-- As a special exception, if other files instantiate generics from this
-- unit, or you link this unit with other files to produce an
-- executable this unit does not by itself cause the resulting
-- executable to be covered by the GNU General Public License. This
-- exception does not however invalidate any other reasons why the
-- executable file might be covered by the GNU Public License.
--
with Anet.Types;
package Anet.Sockets.Inet is
type Inet_Socket_Type is abstract new Socket_Type with private;
-- Internet socket.
procedure Bind
(Socket : in out Inet_Socket_Type;
Iface : Types.Iface_Name_Type);
-- Bind given Inet socket to the specified interface.
----------
-- IPv4 --
----------
type IPv4_Socket_Type is abstract new Inet_Socket_Type with private;
-- IPv4 socket.
procedure Bind
(Socket : in out IPv4_Socket_Type;
Address : IPv4_Addr_Type := Any_Addr;
Port : Port_Type);
-- Bind given IPv4 socket to the specified IPv4 address and port.
procedure Send
(Socket : IPv4_Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Dst_Addr : IPv4_Addr_Type;
Dst_Port : Port_Type);
-- Send given data to the specified destination via the given socket.
type UDPv4_Socket_Type is new IPv4_Socket_Type
and Dgram_Socket_Type with private;
-- IPv4/UDP socket.
procedure Init (Socket : in out UDPv4_Socket_Type);
-- Initialize given IPv4/UDP socket.
type UDPv4_Sockaddr_Type is record
Addr : IPv4_Addr_Type;
Port : Port_Type;
end record;
-- UDPv4 socket address.
procedure Receive
(Socket : UDPv4_Socket_Type;
Src : out UDPv4_Sockaddr_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Receive data from given UDPv4 socket. This procedure blocks until data
-- has been received. Last is the index value such that Item (Last) is the
-- last character assigned. An exception is raised if a socket error
-- occurs. The source argument is set to the sender's address and port from
-- which the data was received.
procedure Join_Multicast_Group
(Socket : UDPv4_Socket_Type;
Group : IPv4_Addr_Type;
Iface : Types.Iface_Name_Type := "");
-- Join the given multicast group on the interface specified by name. If no
-- interface name is provided, the kernel selects the interface.
procedure Multicast_Set_Sending_Interface
(Socket : UDPv4_Socket_Type;
Iface_Addr : IPv4_Addr_Type);
-- Use interface specified by address for Multicast sending on this socket.
type TCPv4_Socket_Type is new IPv4_Socket_Type
and Stream_Socket_Type with private;
-- IPv4/TCP socket.
overriding
procedure Accept_Connection
(Socket : TCPv4_Socket_Type;
New_Socket : out TCPv4_Socket_Type);
-- Accept first connection request from listening socket and return new
-- connected socket.
procedure Init (Socket : in out TCPv4_Socket_Type);
-- Initialize given IPv4/TCP socket.
procedure Connect
(Socket : in out TCPv4_Socket_Type;
Address : IPv4_Addr_Type;
Port : Port_Type);
-- Connect TCPv4 socket to specified IPv4 address and port.
----------
-- IPv6 --
----------
type IPv6_Socket_Type is abstract new Inet_Socket_Type with private;
-- IPv6 socket.
procedure Bind
(Socket : in out IPv6_Socket_Type;
Address : IPv6_Addr_Type := Any_Addr_V6;
Port : Port_Type);
-- Bind given IPv6 socket to the specified IPv6 address and port.
procedure Send
(Socket : IPv6_Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Dst_Addr : IPv6_Addr_Type;
Dst_Port : Port_Type);
-- Send given data to the specified destination via the given socket.
type UDPv6_Socket_Type is new IPv6_Socket_Type
and Dgram_Socket_Type with private;
-- IPv6/UDP socket.
procedure Init (Socket : in out UDPv6_Socket_Type);
-- Initialize given IPv6/UDP socket.
type UDPv6_Sockaddr_Type is record
Addr : IPv6_Addr_Type;
Port : Port_Type;
end record;
-- UDPv6 socket address.
procedure Receive
(Socket : UDPv6_Socket_Type;
Src : out UDPv6_Sockaddr_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Receive data from given UDPv6 socket. This procedure blocks until data
-- has been received. Last is the index value such that Item (Last) is the
-- last character assigned. An exception is raised if a socket error
-- occurs. The source argument is set to the sender's address and port from
-- which the data was received.
procedure Join_Multicast_Group
(Socket : UDPv6_Socket_Type;
Group : IPv6_Addr_Type;
Iface : Types.Iface_Name_Type := "");
-- Join the given multicast group on the interface specified by name. If no
-- interface name is provided, the kernel selects the interface.
procedure Multicast_Set_Sending_Interface
(Socket : UDPv6_Socket_Type;
Iface : Types.Iface_Name_Type);
-- Use interface specified by name for Multicast sending on this socket.
type TCPv6_Socket_Type is new IPv6_Socket_Type
and Stream_Socket_Type with private;
-- IPv6/TCP socket.
overriding
procedure Accept_Connection
(Socket : TCPv6_Socket_Type;
New_Socket : out TCPv6_Socket_Type);
-- Accept first connection request from listening socket and return new
-- connected socket.
procedure Init (Socket : in out TCPv6_Socket_Type);
-- Initialize given IPv6/TCP socket.
procedure Connect
(Socket : in out TCPv6_Socket_Type;
Address : IPv6_Addr_Type;
Port : Port_Type);
-- Connect TCPv6 socket to specified IPv6 address and port.
private
type Inet_Socket_Type is abstract new Socket_Type with null record;
type IPv4_Socket_Type is abstract new Inet_Socket_Type with null record;
type IPv6_Socket_Type is abstract new Inet_Socket_Type with null record;
type UDPv4_Socket_Type is new IPv4_Socket_Type
and Dgram_Socket_Type with null record;
type TCPv4_Socket_Type is new IPv4_Socket_Type
and Stream_Socket_Type with null record;
type UDPv6_Socket_Type is new IPv6_Socket_Type
and Dgram_Socket_Type with null record;
type TCPv6_Socket_Type is new IPv6_Socket_Type
and Stream_Socket_Type with null record;
end Anet.Sockets.Inet;
|