|
|
These functions provide a layer of indirection between the TCP routines and upper level routines. This makes it possible to insert additional code (for example, privacy or checksum handling).
NETSTREAM *net_open(char *host, char *service, unsigned long port);
This function opens a TCP connection to the given host and service or port.
NETSTREAM *net_aopen(NETMBX *mb, char *service, char *usrbuf);
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);
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);
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);
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);
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);
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);
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);
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);
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.