/usr/share/ada/adainclude/anet/anet.ads is in libanet0.1-dev 0.1-3.
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 | --
-- Copyright (C) 2011, 2012 secunet Security Networks AG
-- Copyright (C) 2011, 2012 Reto Buerki <reet@codelabs.ch>
-- Copyright (C) 2011, 2012 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.
--
-- 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.
--
pragma License (Modified_GPL);
pragma Detect_Blocking;
with Ada.Streams;
package Anet is
type Byte is range 0 .. 255;
subtype Hex_Byte_Str is String (1 .. 2);
function To_Hex (B : Byte) return String;
-- Convert byte to hexadecimal string representation.
function To_Hex (Data : Ada.Streams.Stream_Element_Array) return String;
-- Convert given stream element array to hex string.
function To_Byte (Str : Hex_Byte_Str) return Byte;
-- Convert hex byte string to byte.
type Double_Byte is range 0 .. 2 ** 16 - 1;
type Word32 is range 0 .. 2 ** 32 - 1;
type Byte_Array is array (Positive range <>) of Byte;
function To_String (Bytes : Byte_Array) return String;
-- Convert given byte array to string.
function To_Bytes (Str : String) return Byte_Array;
-- Convert given string to byte array.
subtype Port_Type is Double_Byte;
-- Port number.
Any_Port : constant Port_Type;
type HW_Addr_Len_Type is range 1 .. 16;
-- Allowed length for hardware addresses.
type Hardware_Addr_Type is array (HW_Addr_Len_Type range <>) of Byte;
-- Link-layer address.
function To_String (Address : Hardware_Addr_Type) return String;
-- Return string representation of a hardware address.
Bcast_HW_Addr : constant Hardware_Addr_Type;
-- ff:ff:ff:ff:ff:ff
type IPv4_Addr_Type is array (1 .. 4) of Byte;
-- IPv4 address.
function To_IPv4_Addr (Str : String) return IPv4_Addr_Type;
-- Return IPv4 address for given string.
function To_String (Address : IPv4_Addr_Type) return String;
-- Return string representation of an IPv4 address.
Any_Addr : constant IPv4_Addr_Type;
-- 0.0.0.0
Loopback_Addr_V4 : constant IPv4_Addr_Type;
-- 127.0.0.1
Bcast_Addr : constant IPv4_Addr_Type;
-- 255.255.255.255
type IPv6_Addr_Type is array (1 .. 16) of Byte;
-- IPv6 address.
function To_IPv6_Addr (Str : String) return IPv6_Addr_Type;
-- Return IPv6 address for given string.
function To_String (Address : IPv6_Addr_Type) return String;
-- Return string representation of an IPv6 address.
Loopback_Addr_V6 : constant IPv6_Addr_Type;
-- IPv6 loopback address (::1).
C_Failure : constant := -1;
-- Used to test return codes of imported C functions.
function Get_Errno_String return String;
-- Return error string associated with current errno value.
private
for Byte'Size use 8;
for Double_Byte'Size use 16;
for Word32'Size use 32;
for IPv4_Addr_Type'Size use 32;
for IPv6_Addr_Type'Size use 128;
for HW_Addr_Len_Type'Size use 8;
Bcast_HW_Addr : constant Hardware_Addr_Type (1 .. 6) := (others => 255);
Any_Addr : constant IPv4_Addr_Type := (others => 0);
Loopback_Addr_V4 : constant IPv4_Addr_Type := (127, 0, 0, 1);
Loopback_Addr_V6 : constant IPv6_Addr_Type := (16 => 1, others => 0);
Bcast_Addr : constant IPv4_Addr_Type := (others => 255);
Any_Port : constant Port_Type := 0;
end Anet;
|