DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦00a25e30c⟧ Ada Source

    Length: 14336 (0x3800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package Transport_Name, pragma Module_Name 4 3535, pragma Subsystem Input_Output, seg_006432

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Profile;
with Transport;
with Transport_Defs;
with Text_Io;

package Transport_Name is

    pragma Subsystem (Input_Output, Private_Part => Closed);
    pragma Module_Name (4, 3535);

    function Host_To_Network_Name (Host_Name : String)
                                  return Transport_Defs.Network_Name;

    function Host_To_Host_Id (Host_Name : String) return Transport_Defs.Host_Id;

    function Host_Id_To_Host (Host : Transport_Defs.Host_Id) return String;

    -- function Host_Id_To_Host (Network : Transport_Defs.Network_Name;
    --                           Host : Transport_Defs.Host_Id) return String;
    -- ... at end for upward-compatibility.

    Undefined : exception;

    type Host_Iterator is limited private;
    procedure Init  (Iter : in out Host_Iterator);
    procedure Next  (Iter : in out Host_Iterator);
    function  Value (Iter : Host_Iterator) return String;
    function  Done  (Iter : Host_Iterator) return Boolean;

    function Host_To_Machine_Type (Host_Name : String) return String;

    -- Host_to_Network_Name and Host_to_Host_Id begin by attempting to
    -- query a TCP/IP name server.  The object !Machine.Tcp_Ip_Name_Server
    -- is read as text: it must contain the Internet address of the server
    -- in decimal dotted notation.  The address is used to send a query in
    -- a UDP datagram.  If an answer is received, Host_to_Host_Id returns
    -- it, and Host_to_Network_Name returns "TCP/IP".  If any step of this
    -- process fails (for example, there is no Tcp_Ip_Name_Server file),
    -- the function instead attempts to resolve the name as follows:
    --
    -- Other name resolution operations are driven by a text file, namely
    -- !Machine.Transport_Name_Map.  The mapping from host_name to other
    -- values is changed by changing this file.  Each line of the file
    -- must contain the following, in the order given, separated by spaces:
    --
    --    a network_name,
    --    a host_id, in decimal notation xx.yy.zz, and
    --    a host_name, which must be an Ada simple identifier.
    --
    -- After the host name, each line may contain an optional machine_type:
    -- this identifies the operating system running on that host.
    -- See Ftp_Name_Map.Machine_Type.  If the machine_type is omitted,
    -- Host_to_Machine_Type will return the null string.
    --
    -- Comments, beginning with "--", may be added to the end of any line.

    function Local_Host_Name
                (Network : Transport_Defs.Network_Name) return String;


    -- Each user may keep maps from Host_Name to username, password
    -- and session for that host.  The maps are pointed to by the
    -- profile values Remote_Passwords (for usernames and passwords)
    -- and Remote_Sessions (for sessions).  See the documentation of
    -- package Profile for further details.

    function Host_To_Remote_Username
                (Host_Name : String;
                 Response  : Profile.Response_Profile := Profile.Get)
                return String;
    function Host_To_Remote_Password
                (Host_Name : String;
                 Response  : Profile.Response_Profile := Profile.Get)
                return String;
    function Host_To_Remote_Session
                (Host_Name : String;
                 Response  : Profile.Response_Profile := Profile.Get)
                return String;

    function Host_Id_To_Host (Network : Transport_Defs.Network_Name;
                              Host    : Transport_Defs.Host_Id) return String;

    -- A network object name consists of "!!", followed by a host
    -- name, followed by either "." or "!", followed by the name
    -- of an object within that host.

    function Is_Network_Object_Name (Name : String) return Boolean;
    -- Return true iff the name is a syntactically correct
    -- network object name.  The host_name need not be defined.

    function Network_Object_To_Host (Name : String) return String;
    -- If not Is_Network_Object_Name (Name) then raise Constraint_Error.
    -- Otherwise, return the host name part of a network object name,
    -- without the leading "!!" or trailing punctuation "!" or ".".
    -- The returned name is not neccessarily defined.

    function Network_Object_To_Rest (Name : String) return String;
    -- if not Is_Network_Object_Name (Name) then raise Constraint_Error.
    -- Otherwise, return the object name part of a network object name,
    -- beginning with "!" (even if the original punctuation was ".").
    -- The returned name does not neccessarily denote an extant object.

    package Service is
        -- A mapping from the name of a service to where it is available;
        -- that is, the Network(s) and Socket_Id(s) where its servers wait.

        -- This mapping is stored in the text object named
        File_Name : constant String := "!Machine.Transport_Services";

        -- Within this object, each non-empty text line contains
        --   * a Transport_Defs.Network_Name,
        --   * a Transport_Defs.Socket_Id,
        --   * a service name, and
        --   * optionally a machine name;
        -- in that order, separated by white space (blanks or tabs).
        -- Characters from "--" to the end of the line are a comment.  A
        -- Network_Name, Socket_Id, service name or machine name must not
        -- contain any white space or the character sequence "--".  The
        -- Transport_Defs.Socket_Id is in decimal dotted notation; that is, a
        -- sequence of non-negative decimal integers separated by periods.
        -- Each integer represents one or more bytes, as minimally required to
        -- represent that integer in binary form, most significant byte first.
        -- For example, 258 and 1.2 represent the same Socket_Id, which is
        -- expressed in Ada as (1,2).  A service name or a machine name should
        -- be a valid Ada identifier.  The case (upper or lower) of a service
        -- name or a machine name is not significant.

        -- A line signifies that the named service is available via the given
        -- network at the given socket in the given machine; if no machine
        -- name is given, the line signifies that the named service is
        -- available via the given network at the given socket in all machines
        -- not specifically named in other lines.

        function Normalize (Service_Name : String) return String;
        -- change to lower case, and strip leading or trailing white space.

        function Socket  (Service_Name, Host_Name : String)
                        return Transport_Defs.Socket_Id;
        function Network (Service_Name, Host_Name : String)
                         return Transport_Defs.Network_Name;
        -- Return the first defined Socket or Network associated with
        -- the given Service_Name and Hst_Name.  If no such specific
        -- association is defined, return Socket (Service_Name) or
        -- Network (Service_Name), below.

        function Socket (Service_Name : String) return Transport_Defs.Socket_Id;
        function Network (Service_Name : String)
                         return Transport_Defs.Network_Name;
        -- Return the first defined Socket or Network associated with
        -- the given Service_Name, but no specific Host_Name.
        -- If no such association is defined, raise

        Undefined : exception;

        function Local_Socket
                    (Service_Name : String;
                     Network      : Transport_Defs.Network_Name := "TCP/IP")
                    return Transport_Defs.Socket_Id;
        -- Return the socket at which the given service is available in
        -- this machine as identified in the given Network.  That is:
        -- begin
        --     return Socket (Service_Name,
        --                    Transport_Name.Local_Host_Name (Network));
        -- exception
        --     when Transport_Name.Undefined =>
        --         return Socket (Service_Name);
        -- end;
        -- This function may raise Transport_Name.Service.Undefined.

        function Local_Network
                    (Service_Name : String;
                     Network      : Transport_Defs.Network_Name := "TCP/IP")
                    return Transport_Defs.Network_Name;
        -- Return the network via which the given service is available in
        -- this machine as identified in the given Network.  That is:
        -- begin
        --     return Network (Service_Name,
        --                     Transport_Name.Local_Host_Name (Network));
        -- exception
        --     when Transport_Name.Undefined =>
        --         return Network (Service_Name);
        -- end;
        -- This function may raise Transport_Name.Service.Undefined.


        -- A service may be available on multiple Socket/Network pairs;
        -- they may be found by iterating through all service definitions
        -- searching for definitions that match the service and host name:

        type Iterator is limited private;
        procedure Init   (Iter : in out Iterator);
        procedure Next   (Iter : in out Iterator);
        procedure Finish (Iter : in out Iterator); -- Done (Iter) becomes True.
        -- You are encouraged to Finish an Iterator when you're done using it,
        -- to release any global resource (actions, file handles) it may hold.

        function Done (Iter : Iterator) return Boolean;
        function Network (Iter : Iterator) return Transport_Defs.Network_Name;
        function Socket (Iter : Iterator) return Transport_Defs.Socket_Id;
        function Service_Name (Iter : Iterator) return String;
        function Host_Name (Iter : Iterator) return String;

        function Matches (Iter : Iterator; Service_Name, Host_Name : String)
                         return Boolean;
        -- Return true iff Service_Name (Iter) = Normalize (Service_Name)
        -- and Host_Name (Iter) = Normalize (Host_Name).

        function Matches (Iter : Iterator; Service_Name : String)  
                         return Boolean;
        -- Return true iff Service_Name (Iter) = Normalize (Service_Name)
        -- and Host_Name (Iter) = "".

    private
        type Iterator is
            record
                File : Text_Io.File_Type;
                Last : Natural;
                Line : String (1 .. 2048);
            end record;
    end Service;


end Transport_Name;

E3 Meta Data

    nblk1=d
    nid=0
    hdr6=1a
        [0x00] rec0=1d rec1=00 rec2=01 rec3=074
        [0x01] rec0=01 rec1=00 rec2=0d rec3=000
        [0x02] rec0=11 rec1=00 rec2=02 rec3=026
        [0x03] rec0=16 rec1=00 rec2=03 rec3=040
        [0x04] rec0=17 rec1=00 rec2=04 rec3=008
        [0x05] rec0=11 rec1=00 rec2=05 rec3=084
        [0x06] rec0=10 rec1=00 rec2=06 rec3=096
        [0x07] rec0=12 rec1=00 rec2=07 rec3=04e
        [0x08] rec0=00 rec1=00 rec2=0c rec3=002
        [0x09] rec0=15 rec1=00 rec2=08 rec3=028
        [0x0a] rec0=17 rec1=00 rec2=09 rec3=028
        [0x0b] rec0=11 rec1=00 rec2=0a rec3=080
        [0x0c] rec0=15 rec1=00 rec2=0b rec3=000
    tail 0x21701afd681bf82241d1f 0x42a00088462065003