|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 28358 (0x6ec6)
Types: TextFile
Names: »V«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
└─⟦6f12a12be⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
WITH Unix_Base_Types;
PACKAGE Socket_System_Interface IS
Sock_Stream : CONSTANT Unix_Base_Types.Int := 1;
Af_Inet : CONSTANT Unix_Base_Types.Short := 2;
Inaddr_Any : CONSTANT Unix_Base_Types.U_Long := 0;
Sol_Socket : CONSTANT := 16#ffff#;
So_Linger : CONSTANT := 16#80#;
So_Dontlinger : CONSTANT := 16#ef#;
So_Reuseaddr : CONSTANT := 16#04#;
-- A pointer to an object of this type will be used with setsockopt
-- during the socket command. The initialized values tell the socket to
-- NOT linger after a close. All socket objects will be set to No_Linger
-- during the Socket operation by default.
TYPE Linger_Structure IS
RECORD
L_Onoff : Unix_Base_Types.Int := 0;
L_Linger : Unix_Base_Types.Int := 0;
END RECORD;
FOR Linger_Structure USE
RECORD
L_Onoff AT 0 RANGE 0 .. 31;
L_Linger AT 4 RANGE 0 .. 31;
END RECORD;
PRAGMA Pack (Linger_Structure);
TYPE Linger_Structure_Ptr IS ACCESS Linger_Structure;
TYPE Char_Array IS ARRAY (Natural RANGE <>) OF Character;
TYPE Sockaddr_In IS
RECORD
Sin_Family : Unix_Base_Types.Short;
Sin_Port : Unix_Base_Types.Ushort;
Sin_Addr : Unix_Base_Types.U_Long;
Sin_Zero : Char_Array (1 .. 8) := (OTHERS => Ascii.Nul);
END RECORD;
FOR Sockaddr_In USE
RECORD
Sin_Family AT 0 RANGE 0 .. 15;
Sin_Port AT 2 RANGE 0 .. 15;
Sin_Addr AT 4 RANGE 0 .. 31;
Sin_Zero AT 8 RANGE 0 .. 63;
END RECORD;
TYPE Sockaddr_In_Ptr IS ACCESS Sockaddr_In;
TYPE Sockaddr IS
RECORD
Sa_Family : Unix_Base_Types.Short;
Sa_Data : Char_Array (1 .. 14);
END RECORD;
FOR Sockaddr USE
RECORD
Sa_Family AT 0 RANGE 0 .. 15;
Sa_Data AT 2 RANGE 0 .. 111;
END RECORD;
TYPE Sockaddr_Ptr IS ACCESS Sockaddr;
TYPE Int_Ptr IS ACCESS Unix_Base_Types.Int;
TYPE Char_Ptr_Ptr IS ACCESS Unix_Base_Types.Char_Ptrs;
FOR Char_Ptr_Ptr'Storage_Size USE 0;
TYPE Hostent IS
RECORD
H_Name : Unix_Base_Types.Char_Ptr;
H_Aliases : Char_Ptr_Ptr;
H_Addrtype : Unix_Base_Types.Int;
H_Length : Unix_Base_Types.Int;
H_Addr_List : Char_Ptr_Ptr;
END RECORD;
FOR Hostent USE
RECORD
H_Name AT 0 RANGE 0 .. 31;
H_Aliases AT 4 RANGE 0 .. 31;
H_Addrtype AT 8 RANGE 0 .. 31;
H_Length AT 12 RANGE 0 .. 31;
H_Addr_List AT 16 RANGE 0 .. 31;
END RECORD;
TYPE Hostent_Ptr IS ACCESS Hostent;
FOR Hostent_Ptr'Storage_Size USE 0;
-- NAME
-- accept - accept a connection on a socket
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
--
-- int accept(s, addr, addrlen)
-- int s;
-- struct sockaddr *addr;
-- int *addrlen;
--
-- DESCRIPTION
-- The argument s is a socket that has been created with
-- socket(2), bound to an address with bind(2), and is listen-
-- ing for connections after a listen(2). accept() extracts
-- the first connection on the queue of pending connections,
-- creates a new socket with the same properties of s and allo-
-- cates a new file descriptor for the socket. If no pending
-- connections are present on the queue, and the socket is not
-- marked as non-blocking, accept() blocks the caller until a
-- connection is present. If the socket is marked non-blocking
-- and no pending connections are present on the queue,
-- accept() returns an error as described below. The accepted
-- socket is used to read and write data to and from the socket
-- which connected to this one; it is not used to accept more
-- connections. The original socket s remains open for accept-
-- ing further connections.
--
-- The argument addr is a result parameter that is filled in
-- with the address of the connecting entity, as known to the
-- communications layer. The exact format of the addr parame-
-- ter is determined by the domain in which the communication
-- is occurring. The addrlen is a value-result parameter; it
-- should initially contain the amount of space pointed to by
-- addr; on return it will contain the actual length (in bytes)
-- of the address returned. This call is used with
-- connection-based socket types, currently with SOCK_STREAM.
--
-- It is possible to select(2) a socket for the purposes of
-- doing an accept() by selecting it for read.
--
-- RETURN VALUES
-- accept() returns a non-negative descriptor for the accepted
-- socket on success. On failure, it returns -1 and sets errno
-- to indicate the error.
--
FUNCTION Saccept (S : IN Unix_Base_Types.Int;
Addr : IN Sockaddr_Ptr;
Addrlen : IN Int_Ptr) RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Saccept);
PRAGMA Interface_Name (Saccept, "_accept");
-- NAME
-- bind - bind a name to a socket
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
--
-- int bind(s, name, namelen)
-- int s;
-- struct sockaddr *name;
-- int namelen;
--
-- DESCRIPTION
-- bind() assigns a name to an unnamed socket. When a socket
-- is created with socket(2) it exists in a name space (address
-- family) but has no name assigned. bind() requests that the
-- name pointed to by name be assigned to the socket.
--
-- NOTES
-- Binding a name in the UNIX domain creates a socket in the
-- file system that must be deleted by the caller when it is no
-- longer needed (using unlink(2V),
--
-- The rules used in name binding vary between communication
-- domains. Consult the manual entries in section 4 for
-- detailed information.
--
FUNCTION Bind (S : IN Unix_Base_Types.Int;
Addr : IN Sockaddr_In_Ptr;
Addrlen : IN Unix_Base_Types.Int) RETURN Unix_Base_Types.Int;
-- NAME
-- listen - listen for connections on a socket
--
-- SYNOPSIS
-- int listen(s, backlog)
-- int s, backlog;
--
-- DESCRIPTION
-- To accept connections, a socket is first created with
-- socket(2), a backlog for incoming connections is specified
-- with listen() and then the connections are accepted with
-- accept(2). The listen() call applies only to sockets of
-- type SOCK_STREAM or SOCK_SEQPACKET.
--
-- The backlog parameter defines the maximum length the queue
-- of pending connections may grow to. If a connection request
-- arrives with the queue full the client will receive an error
-- with an indication of ECONNREFUSED.
--
-- RETURN VALUES
-- listen() returns:
--
-- 0 on success.
--
-- -1 on failure and sets errno to indicate the error.
--
FUNCTION Listen (S : IN Unix_Base_Types.Int;
Backlog : IN Unix_Base_Types.Int)
RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Listen);
PRAGMA Interface_Name (Listen, "_listen");
-- NAME
-- socket - create an endpoint for communication
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
--
-- int socket(domain, type, protocol)
-- int domain, type, protocol;
--
-- DESCRIPTION
-- socket() creates an endpoint for communication and returns a
-- descriptor.
--
-- The domain parameter specifies a communications domain
-- within which communication will take place; this selects the
-- protocol family which should be used. The protocol family
-- generally is the same as the address family for the
-- addresses supplied in later operations on the socket. These
-- families are defined in the include file <sys/socket.h>.
-- The currently understood formats are
--
-- PF_UNIX (UNIX system internal protocols),
--
-- PF_INET (ARPA Internet protocols), and
--
-- PF_IMPLINK (IMP "host at IMP" link layer).
--
-- The socket has the indicated type, which specifies the
-- semantics of communication. Currently defined types are:
--
-- SOCK_STREAM
-- SOCK_DGRAM
-- SOCK_RAW
-- SOCK_SEQPACKET
-- SOCK_RDM
--
-- A SOCK_STREAM type provides sequenced, reliable, two-way
-- connection based byte streams. An out-of-band data
-- transmission mechanism may be supported. A SOCK_DGRAM
-- socket supports datagrams (connectionless, unreliable mes-
-- sages of a fixed (typically small) maximum length). A
-- SOCK_SEQPACKET socket may provide a sequenced, reliable,
-- two-way connection-based data transmission path for
-- datagrams of fixed maximum length; a consumer may be
-- required to read an entire packet with each read system
-- call. This facility is protocol specific, and presently not
-- implemented for any protocol family. SOCK_RAW sockets pro-
-- vide access to internal network interfaces. The types
-- SOCK_RAW, which is available only to the super-user, and
-- SOCK_RDM, for which no implementation currently exists, are
-- not described here.
--
-- The protocol specifies a particular protocol to be used with
-- the socket. Normally only a single protocol exists to sup-
-- port a particular socket type within a given protocol fam-
-- ily. However, it is possible that many protocols may exist,
-- in which case a particular protocol must be specified in
-- this manner. The protocol number to use is particular to
-- the "communication domain" in which communication is to take
-- place; see protocols(5).
--
-- Sockets of type SOCK_STREAM are full-duplex byte streams,
-- similar to pipes. A stream socket must be in a connected
-- state before any data may be sent or received on it. A con-
-- nection to another socket is created with a connect(2) call.
-- Once connected, data may be transferred using read(2V) and
-- write(2V) calls or some variant of the send(2) and recv(2)
-- calls. When a session has been completed a close(2V), may
-- be performed. Out-of-band data may also be transmitted as
-- described in send(2) and received as described in recv(2).
--
-- The communications protocols used to implement a SOCK_STREAM
-- insure that data is not lost or duplicated. If a piece of
-- data for which the peer protocol has buffer space cannot be
-- successfully transmitted within a reasonable length of time,
-- then the connection is considered broken and calls will
-- indicate an error with -1 returns and with ETIMEDOUT as the
-- specific code in the global variable errno. The protocols
-- optionally keep sockets "warm" by forcing transmissions
-- roughly every minute in the absence of other activity. An
-- error is then indicated if no response can be elicited on an
-- otherwise idle connection for a extended period (for
-- instance 5 minutes). A SIGPIPE signal is raised if a pro-
-- cess sends on a broken stream; this causes naive processes,
-- which do not handle the signal, to exit.
--
-- SOCK_SEQPACKET sockets employ the same system calls as
-- SOCK_STREAM sockets. The only difference is that read(2V)
-- calls will return only the amount of data requested, and any
-- remaining in the arriving packet will be discarded.
--
-- SOCK_DGRAM and SOCK_RAW sockets allow sending of datagrams
-- to correspondents named in send(2) calls. Datagrams are
-- generally received with recv(2), which returns the next
-- datagram with its return address.
--
-- An fcntl(2V) call can be used to specify a process group to
-- receive a SIGURG signal when the out-of-band data arrives.
-- It may also enable non-blocking I/O and asynchronous notifi-
-- cation of I/O events with SIGIO signals.
--
-- The operation of sockets is controlled by socket level
-- options. These options are defined in the file socket.h.
-- getsockopt(2) and setsockopt() are used to get and set
-- options, respectively.
--
-- RETURN VALUES
-- socket() returns a non-negative descriptor on success. On
-- failure, it returns -1 and sets errno to indicate the error.
FUNCTION Socket (Af : IN Unix_Base_Types.Int;
Socket_Type : IN Unix_Base_Types.Int;
Protocol : IN Unix_Base_Types.Int)
RETURN Unix_Base_Types.Int;
-- NAME
-- connect - initiate a connection on a socket
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
--
--
-- int connect(s, name, namelen)
-- int s;
-- struct sockaddr *name;
-- int namelen;
--
-- DESCRIPTION
-- The parameter s is a socket. If it is of type SOCK_DGRAM,
-- then this call specifies the peer with which the socket is
-- to be associated; this address is that to which datagrams
-- are to be sent, and the only address from which datagrams
-- are to be received. If it is of type SOCK_STREAM, then this
-- call attempts to make a connection to another socket. The
-- other socket is specified by name which is an address in the
-- communications space of the socket. Each communications
-- space interprets the name parameter in its own way. Gen-
-- erally, stream sockets may successfully connect() only once;
-- datagram sockets may use connect() multiple times to change
-- their association. Datagram sockets may dissolve the asso-
-- ciation by connecting to an invalid address, such as a null
-- address.
--
-- RETURN VALUES
-- connect() returns:
--
-- 0 on success.
--
-- -1 on failure and sets errno to indicate the error.
--
FUNCTION Connect (S : IN Unix_Base_Types.Int;
Addr : IN Sockaddr_In_Ptr;
Addrlen : IN Unix_Base_Types.Int)
RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Connect);
PRAGMA Interface_Name (Connect, "_connect");
-- NAME
-- gethostent, gethostbyaddr, gethostbyname, sethostent,
-- endhostent - get network host entry
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
-- #include <netdb.h>
--
-- struct hostent *gethostent()
--
-- struct hostent *gethostbyname(name)
-- char *name;
--
-- struct hostent *gethostbyaddr(addr, len, type)
-- char *addr;
-- int len, type;
--
-- sethostent(stayopen)
-- int stayopen
-- endhostent()
--
-- DESCRIPTION
-- gethostent, gethostbyname, and gethostbyaddr() each return a
-- pointer to an object with the following structure containing
-- the broken-out fields of a line in the network host data
-- base, /etc/hosts. In the case of gethostbyaddr(), addr is a
-- pointer to the binary format address of length len (not a
-- character string).
--
-- struct hostent {
-- char *h_name; /* official name of host */
-- char **h_aliases; /* alias list */
-- int h_addrtype; /* address type */
-- int h_length; /* length of address */
-- char **h_addr_list; /* list of addresses from name server */
-- };
--
-- The members of this structure are:
--
-- h_name Official name of the host.
--
-- h_aliases A zero terminated array of alternate
-- names for the host.
--
-- h_addrtype The type of address being returned;
-- currently always AF_INET.
--
-- h_length The length, in bytes, of the address.
--
-- h_addr_list A pointer to a list of network addresses
-- for the named host. Host addresses are
-- returned in network byte order.
--
-- gethostent() reads the next line of the file, opening the
-- file if necessary.
--
-- sethostent() opens and rewinds the file. If the stayopen
-- flag is non-zero, the host data base will not be closed
-- after each call to gethostent() (either directly, or
-- indirectly through one of the other "gethost" calls).
--
-- endhostent() closes the file.
--
-- gethostbyname() and gethostbyaddr() sequentially search from
-- the beginning of the file until a matching host name or host
-- address is found, or until end-of-file is encountered. Host
-- addresses are supplied in network order.
FUNCTION Gethostbyname (Host : IN Unix_Base_Types.Char_Ptr)
RETURN Hostent_Ptr;
PRAGMA Interface (C, Gethostbyname);
PRAGMA Interface_Name (Gethostbyname, "_gethostbyname");
-- NAME
-- shutdown - shut down part of a full-duplex connection
--
-- SYNOPSIS
-- int shutdown(s, how)
-- int s, how;
--
-- DESCRIPTION
-- The shutdown() call causes all or part of a full-duplex con-
-- nection on the socket associated with s to be shut down. If
-- how is 0, then further receives will be disallowed. If how
-- is 1, then further sends will be disallowed. If how is 2,
-- then further sends and receives will be disallowed.
--
-- RETURN VALUES
-- shutdown() returns:
--
-- 0 on success.
--
-- -1 on failure and sets errno to indicate the error.
--
FUNCTION Shutdown (S : IN Unix_Base_Types.Int;
How : IN Unix_Base_Types.Int)
RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Shutdown);
PRAGMA Interface_Name (Shutdown, "_shutdown");
-- NAME
-- getsockopt, setsockopt - get and set options on sockets
--
-- SYNOPSIS
-- #include <sys/types.h>
-- #include <sys/socket.h>
--
-- int getsockopt(s, level, optname, optval, optlen)
-- int s, level, optname;
-- char *optval;
-- int *optlen;
--
-- int setsockopt(s, level, optname, optval, optlen)
-- int s, level, optname;
-- char *optval;
-- int optlen;
--
-- DESCRIPTION
-- getsockopt() and setsockopt() manipulate options associated
-- with a socket. Options may exist at multiple protocol lev-
-- els; they are always present at the uppermost ``socket''
-- level.
--
-- When manipulating socket options the level at which the
-- option resides and the name of the option must be specified.
-- To manipulate options at the ``socket'' level, level is
-- specified as SOL_SOCKET. To manipulate options at any other
-- level the protocol number of the appropriate protocol con-
-- trolling the option is supplied. For example, to indicate
-- that an option is to be interpreted by the TCP protocol,
-- level should be set to the protocol number of TCP; see
-- getprotoent(3N).
--
-- The parameters optval and optlen are used to access option
-- values for setsockopt(). For getsockopt() they identify a
-- buffer in which the value for the requested option(s) are to
-- be returned. For getsockopt(), optlen is a value-result
-- parameter, initially containing the size of the buffer
-- pointed to by optval, and modified on return to indicate the
-- actual size of the value returned. If no option value is to
-- be supplied or returned, optval may be supplied as 0.
--
-- optname and any specified options are passed uninterpreted
-- to the appropriate protocol module for interpretation. The
-- include file <sys/socket.h> contains definitions for
-- ``socket'' level options, described below. Options at other
-- protocol levels vary in format and name; consult the
-- appropriate entries in section (4P).
--
-- Most socket-level options take an int parameter for optval.
-- For setsockopt(), the parameter should be non-zero to enable
-- a boolean option, or zero if the option is to be disabled.
--
-- SO_LINGER uses a struct linger parameter, defined in
-- <sys/socket.h>, which specifies the desired state of the
-- option and the linger interval (see below).
--
-- The following options are recognized at the socket level.
-- Except as noted, each may be examined with getsockopt() and
-- set with setsockopt().
--
-- SO_DEBUG toggle recording of debugging
-- information
-- SO_REUSEADDR toggle local address reuse
-- SO_KEEPALIVE toggle keep connections alive
-- SO_DONTROUTE toggle routing bypass for outgoing
-- messages
-- SO_LINGER linger on close if data present
-- SO_BROADCAST toggle permission to transmit
-- broadcast messages
-- SO_OOBINLINE toggle reception of out-of-band
-- data in band
-- SO_SNDBUF set buffer size for output
-- SO_RCVBUF set buffer size for input
-- SO_TYPE get the type of the socket (get
-- only)
-- SO_ERROR get and clear error on the socket
-- (get only)
--
-- SO_DEBUG enables debugging in the underlying protocol
-- modules. SO_REUSEADDR indicates that the rules used in
-- validating addresses supplied in a bind(2) call should allow
-- reuse of local addresses. SO_KEEPALIVE enables the periodic
-- transmission of messages on a connected socket. Should the
-- connected party fail to respond to these messages, the con-
-- nection is considered broken. A process attempting to write
-- to the socket receives a SIGPIPE signal and the write opera-
-- tion returns an error. By default, a process exits when it
-- receives SIGPIPE. A read operation on the socket returns an
-- error but does not generate SIGPIPE. If the process is
-- waiting in select(2) when the connection is broken, select()
-- returns true for any read or write events selected for the
-- socket. SO_DONTROUTE indicates that outgoing messages
-- should bypass the standard routing facilities. Instead,
-- messages are directed to the appropriate network interface
-- according to the network portion of the destination address.
--
-- SO_LINGER controls the action taken when unsent messags are
-- queued on socket and a close(2V) is performed. If the
-- socket promises reliable delivery of data and SO_LINGER is
-- set, the system will block the process on the close()
-- attempt until it is able to transmit the data or until it
-- decides it is unable to deliver the information (a timeout
-- period, termed the linger interval, is specified in the set-
-- sockopt() call when SO_LINGER is requested). If SO_LINGER
-- is disabled and a close() is issued, the system will process
-- the close in a manner that allows the process to continue as
-- quickly as possible.
--
-- The option SO_BROADCAST requests permission to send broad-
-- cast datagrams on the socket. Broadcast was a privileged
-- operation in earlier versions of the system. With protocols
-- that support out-of-band data, the SO_OOBINLINE option
-- requests that out-of-band data be placed in the normal data
-- input queue as received; it will then be accessible with
-- recv() or read() calls without the MSG_OOB flag. SO_SNDBUF
-- and SO_RCVBUF are options to adjust the normal buffer sizes
-- allocated for output and input buffers, respectively. The
-- buffer size may be increased for high-volume connections, or
-- may be decreased to limit the possible backlog of incoming
-- data. The system places an absolute limit on these values.
-- Finally, SO_TYPE and SO_ERROR are options used only with
-- getsockopt(). SO_TYPE returns the type of the socket, such
-- as SOCK_STREAM; it is useful for servers that inherit sock-
-- ets on startup. SO_ERROR returns any pending error on the
-- socket and clears the error status. It may be used to check
-- for asynchronous errors on connected datagram sockets or for
-- other asynchronous errors.
--
-- RETURN VALUES
-- getsockopt() and setsockopt() return:
--
-- 0 on success.
--
-- -1 on failure and set errno to indicate the error.
FUNCTION Setsockopt (S : IN Unix_Base_Types.Int;
Level : IN Unix_Base_Types.Int;
Optname : IN Unix_Base_Types.Int;
Optval : IN Unix_Base_Types.Char_Ptr;
Optlen : IN Unix_Base_Types.Int)
RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Setsockopt);
PRAGMA Interface_Name (Setsockopt, "_setsockopt");
-- NAME
-- unlink - remove directory entry
--
-- SYNOPSIS
-- int unlink(path)
-- char *path;
--
-- DESCRIPTION
-- unlink() removes the directory entry named by the pathname
-- pointed to by path and decrements the link count of the file
-- referred to by that entry. If this entry was the last link
-- to the file, and no process has the file open, then all
-- resources associated with the file are reclaimed. If, how-
-- ever, the file was open in any process, the actual resource
-- reclamation is delayed until it is closed, even though the
-- directory entry has disappeared.
--
-- If path refers to a directory, the effective user-ID of the
-- calling process must be super-user.
--
-- Upon successful completion, unlink() marks for update the
-- st_ctime and st_mtime fields of the parent directory. Also,
-- if the file's link count is not zero, the st_ctime field of
-- the file is marked for update.
--
-- RETURN VALUES
-- unlink() returns:
--
-- 0 on success.
--
-- -1 on failure and sets errno to indicate the error.
--
FUNCTION Unlink (Path : Unix_Base_Types.Char_Ptr)
RETURN Unix_Base_Types.Int;
PRAGMA Interface (C, Unlink);
PRAGMA Interface_Name (Unlink, "_unlink");
END Socket_System_Interface;