HASSLE Code documentation |
location:
Home >
Archive >
HASSLE >
|
||
$Header: /bioy2/biocomputing/eggenber/Hassle/RCS/functions1.txt,v 1.23 1994/11/03 07:06:24 eggenber Exp $
[ Previous chapter ][ This chapter ][ Next chapter ]
/*+*****************************************************************************
Function: CloseCliComIP
Purpose: Close the client's communication socket. Previous assignment
of the public variable "i_clientsock" is required.
Arguments: none
Return value: _H_SUCCESS if everything is ok;
CLOSE_ERR if _H_CLOSE failed
VARNOTFOUND on attempt to operate on an undefined variable;
Called by: CloseCliCom[2]
Calls: ProcInt[V]
*****************************************************************************-*/
/*+*****************************************************************************
Function: CloseSerComIP
Purpose: Close the server's communications socket. Previous assignment
of the public variables "i_hasslemode", "i_commsock" and
"i_rendsock" is required.
Arguments: none
Return value: _H_SUCCESS if everything is ok;
CLOSE_ERR if _H_CLOSE failed;
VARNOTFOUND on attempt to operate on an undefined variable
Called by: CloseCliCom[2]
Calls:
*****************************************************************************-*/
/*+*****************************************************************************
Function: GetHostNameIP
Purpose: Get the official name of a host supplied as argument.
If a blank string is supplied, then the official name of
the local host is retrieved.
Arguments: pointer to the hostname to be processed
Return value: _H_SUCCESS if everything is ok;
GETHOSTNAME_ERR if gethostname failed;
GETHOSTBYNAME_ERR if gethostbyname failed
Called by: GetHostName[2]
Calls:
*****************************************************************************-*/
/*+*****************************************************************************
Function: OpenCliComIP
Purpose: Open the client's communications. Determine the MASTER's port
number from public variable "i_mastport" or hard-coded default
value or /etc/services file. Create a socket of type
SOCK_STREAM (TCP) and initiate a connection to the server's
socket. The socket descriptor is copied to public storage
as "i_clientsock". Previous assignment of the public
variable "i_mastport" is optional, assignment of
"i_hasslemode", "cp_hostname" and "i_custport"
(RESPONDER mode only) is required.
Arguments: none
Return value: _H_SUCCESS if everything is ok;
SOCKET_ERR if socket failed;
CONNECT_ERR if _H_CONNECT failed;
CLOSE_ERR if _H_CLOSE failed;
VARNOTFOUND on attempt to operate on an undefined variable
Called by: OpenCliCom[2]
Calls: ProcInt[V];
ProcString[V]
*****************************************************************************-*/
/*+*****************************************************************************
Function: OpenSerComIP
Purpose: Open the server's communications. Create a socket of type
SOCKET_STREAM (TCP) and bind the socket to the network
address associated with the service if the socket does not
already exist. Return to the calling function if running in
CUSTSERVER mode. Otherwise the socket listens for a maximum
configurable time for a connection to be accepted. This
functionality is not used when the server is started by the
internet daemon. The function retrieves the name of the local
host, and address port number, and optionally the name of
remote host. This information is copied to the public
ariables "cp_localname", "cp_remoteaddr", "cp_remoteport"
and "i_remotename". The socket descriptors are copied to
the public variables "i_rendsock" and "i_commsock". Previous
assignment of the public variables "i_hasslemode" and
"i_custport" (CUSTSERVER mode only) is required, assignment
of "i_mastport" and "i_acceptwait" is optional.
Arguments: none
Return value: _H_SUCCESS if everything is ok;
ACCEPT_ERR if _H_ACCEPT failed;
BIND_ERR if _H_BIND failed;
FD_ISSET_ERR if FD_ISSET failed;
GETHOSTNAME_ERR if gethostname failed;
GETHOSTBYNAME_ERR if gethostbyname failed;
GETPEER_ERR if getpeername failed;
LISTEN_ERR if listen failed;
SELECT_ERR if select failed;
SOCKET_ERR if socket failed;
TIMEOUT if the time limit for _H_ACCEPT expired;
VARNOTFOUND on attempt to operate on an undefined variable
Called by: OpenSerCom[2]
Calls: ProcInt[V];
ProcString[V]
*****************************************************************************-*/
/*+*****************************************************************************
Function: ReceiveLineIP
Purpose: Receive a line on a socket. This function is shared by both
the client and server sides. Previous assignment of the public
variables "i_hasslemode", "i_commsock" (server mode only)
and i_clientsock (client mode only) is required.
Arguments: pointer to the line to be processed
Return value: FD_ISSET_ERR if FD_ISSET failed;
READ_ERR if _H_READ failed;
SELECT_ERR if select failed;
_H_SUCCESS if everything is ok;
TIMEDOUT if the time limit for _H_READ expired;
VARNOTFOUND on attempt to operate on an undefined variable
Called by: ReceiveLine[2]
Calls: ProcInt[V]
*****************************************************************************-*/
/*+*****************************************************************************
Function: SendLineIP
Purpose: Send a line on a socket. This function is shared by both
the client and server sides. Previous assignment of the public
variables "i_hasslemode", "i_commsock" (server mode only)
and i_clientsock (client mode only) is required.
Arguments: pointer to the line to be processed
Return value: FD_ISSET_ERR if FD_ISSET failed;
SELECT_ERR if select failed;
_H_SUCCESS if everything is ok;
TIMEDOUT if the time limit for _H_WRITE expired;
WRITE_ERR if _H_WRITE failed;
VARNOTFOUND on attempt to operate on an undefined variable
Called by: SendLine[2]
Calls: ProcInt[V]
*****************************************************************************-*/