Network Access Functions
These functions provide a layer of indirection between the TCP
routines and upper level routines. This makes it possible to insert
additional code (e.g. privacy or checksum handling).
NETSTREAM *net_open (char *host,char *service,unsigned long port);
host host name
service contact service name
port contact port number
This function opens a TCP connection to the given host and service
or port.
NETSTREAM *net_aopen (NETMBX *mb,char *service,char *usrbuf);
NETMBX parsed mailbox specification
service stream to open (at present, only /etc/rimapd is used)
usrbuf buffer to return login user name
This function attempts to open a preauthenticated connection to the
given mailbox and service. It will return the login user name of the
preauthenticated connection, as well as an open network stream, if
successful.
char *net_getline (NETSTREAM *stream);
stream network stream to read
This routine reads a text line from the stream. It calls
stream->dtb->getline, which normally points to tcp_getline() but can be
set to some other function.
long net_getbuffer (void *stream,unsigned long size,char *buffer);
stream network stream to read
size length of data in octets
buffer buffer of at least size octets
This routine reads data from the stream. It calls
stream->dtb->getbuffer, which normally points to tcp_getbuffer() but can
be set to some other function.
long net_soutr (NETSTREAM *stream,char *string);
stream network stream to write
string null-terminated string to output
This routine writes a null-terminated string to the stream. It
calls stream->dtb->soutr, which normally points to tcp_soutr() but can
be set to some other function.
long net_sout (NETSTREAM *stream,char *string,unsigned long size);
stream network stream to write
string string to output
size length of string in octets
This routine writes a string of length size to the stream. It
calls stream->dtb->sout, which normally points to tcp_sout() but can be
set to some other function.
void net_close (NETSTREAM *stream);
stream stream to close
This routine closes the stream. It calls stream->dtb->close, which
normally points to tcp_close() but can point to some other function.
char *net_host (NETSTREAM *stream);
stream stream to inspect
This routine returns the remote host name of the stream. It calls
stream->dtb->host, which normally points to tcp_host() but can point
to some other function.
unsigned long net_port (NETSTREAM *stream);
stream stream to inspect
This routine returns the remote port number of the stream. It calls
stream->dtb->port, which normally points to tcp_port() but can point
to some other function.
char *net_localhost (NETSTREAM *stream);
stream stream to inspect
This routine returns the local host name of the stream. It calls
stream->dtb->localhost, which normally points to tcp_localhost() but can
point to some other function.