/usr/share/ada/adainclude/aws/aws-net-std.ads is in libaws3.3.2.2-dev 17.2.2017-2.
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 | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2002-2014, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 3, or (at your option) any --
-- later version. This library 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. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
------------------------------------------------------------------------------
pragma Ada_2012;
-- This is the standard (non-SSL) socket support. Only the implementation of
-- this package depends on a specific socket binding. To port AWS to another
-- socket implementation you need only to rewrite the body.
with Ada.Strings.Fixed;
with Ada.Strings.Maps.Constants;
package AWS.Net.Std is
Socket_Error : exception renames Net.Socket_Error;
type Socket_Type is new Net.Socket_Type with private;
----------------
-- Initialize --
----------------
overriding procedure Bind
(Socket : in out Socket_Type;
Port : Natural;
Host : String := "";
Reuse_Address : Boolean := False;
Family : Family_Type := Family_Unspec);
-- Bind a socket on a given port
overriding procedure Listen
(Socket : Socket_Type;
Queue_Size : Positive := 5);
-- Set the queue size of the socket
overriding procedure Accept_Socket
(Socket : Net.Socket_Type'Class;
New_Socket : in out Socket_Type);
-- Accept a connection on a socket
overriding procedure Connect
(Socket : in out Socket_Type;
Host : String;
Port : Positive;
Wait : Boolean := True;
Family : Family_Type := Family_Unspec);
-- Connect a socket on a given host/port. If Wait is True Connect will wait
-- for the connection to be established for timeout seconds, specified by
-- Set_Timeout routine. If Wait is False Connect will return immediately,
-- not waiting for the connection to be establised. It is possible to wait
-- for the Connection completion by calling Wait routine with Output set to
-- True in Events parameter.
overriding procedure Shutdown
(Socket : Socket_Type; How : Shutmode_Type := Shut_Read_Write);
-- Shutdown the read, write or both side of the socket.
-- If How is Both, close it. Does not raise Socket_Error if the socket is
-- not connected or already shutdown.
--------
-- IO --
--------
overriding procedure Send
(Socket : Socket_Type;
Data : Stream_Element_Array;
Last : out Stream_Element_Offset);
overriding procedure Receive
(Socket : Socket_Type;
Data : out Stream_Element_Array;
Last : out Stream_Element_Offset)
with Inline;
overriding function Pending
(Socket : Socket_Type) return Stream_Element_Count;
-- Returns the number of bytes which are available inside socket
-- for immediate read.
------------
-- Others --
------------
overriding function Get_FD (Socket : Socket_Type) return Integer;
-- Returns the file descriptor associated with the socket
overriding function Peer_Addr (Socket : Socket_Type) return String;
-- Returns the peer name/address
overriding function Peer_Port (Socket : Socket_Type) return Positive;
-- Returns the port of the peer socket
overriding function Get_Addr (Socket : Socket_Type) return String;
-- Returns the name/address of the socket
overriding function Get_Port (Socket : Socket_Type) return Positive;
-- Returns the port of the socket
overriding function Is_Any_Address (Socket : Socket_Type) return Boolean;
-- Return true if the socket accepts connections on any of the hosts's
-- network addresses.
overriding function Is_IPv6 (Socket : Socket_Type) return Boolean;
function IPv6_Available return Boolean;
function Host_Name return String;
overriding function Is_Timeout
(Socket : Socket_Type;
E : Exception_Occurrence) return Boolean;
-- Returns True if the message associated with the Exception_Occurence for
-- a Socket_Error is a timeout.
overriding function Is_Peer_Closed
(Socket : Socket_Type;
E : Exception_Occurrence) return Boolean;
-- Returns True if the message associated with the Exception_Occurence for
-- a Socket_Error is a "socket closed by peer".
overriding procedure Set_No_Delay
(Socket : Socket_Type; Value : Boolean := True);
-- Set/clear TCP_NODELAY option on socket
overriding procedure Set_Send_Buffer_Size
(Socket : Socket_Type;
Size : Natural);
-- Set the internal socket send buffer size.
-- Do not confuse with buffers for the AWS.Net.Buffered operations.
overriding procedure Set_Receive_Buffer_Size
(Socket : Socket_Type;
Size : Natural);
-- Set the internal socket receive buffer size.
-- Do not confuse with buffers for the AWS.Net.Buffered operations.
overriding function Get_Send_Buffer_Size
(Socket : Socket_Type) return Natural;
-- Returns the internal socket send buffer size.
-- Do not confuse with buffers for the AWS.Net.Buffered operations.
overriding function Get_Receive_Buffer_Size
(Socket : Socket_Type) return Natural;
-- Returns the internal socket receive buffer size.
-- Do not confuse with buffers for the AWS.Net.Buffered operations.
overriding function Errno (Socket : Socket_Type) return Integer;
-- Returns and clears error state in socket
private
type Socket_Hidden;
type Socket_Hidden_Access is access Socket_Hidden;
type Socket_Type is new Net.Socket_Type with record
S : Socket_Hidden_Access;
end record;
overriding procedure Free (Socket : in out Socket_Type);
-- Release memory associated with the socket object
function Error_On_Connect (Text : String) return String is
((if Text'Length > 0 and then Text (Text'Last) = '.'
then Text (Text'First .. Text'Last - 1) else Text)
& (if Strings.Fixed.Index
(Text, "connect",
Mapping => Strings.Maps.Constants.Lower_Case_Map) = 0
then " on connect" else "") & " to ");
-- Function to concatenate error message with connection address in human
-- readable manner. Declare in specification because it is common code for
-- GNAT and IPv6 implementations.
end AWS.Net.Std;
|