| United States-English |
|
|
|
![]() |
ACC Programmer's Reference Guide > Chapter 4 ZCOM C I/F Library RoutinesZSET_RCVR (3X) |
|
NAMEzset_rcvr - Set up program ZLU as message receiver for a terminal ZLU SYNOPSIS#include <zcom/zcomsys.h> DESCRIPTIONThe zset_rcvr() routine is used to establish where incoming data from a terminal ZLU is to be queued. When zset_rcvr() is called, the rzap parameter is used to supply the program ZLU to queue the data on. (Note: An application's program ZLU is returned by the zopen() routine.) The type of data queued is selected using the mode parameter. You may choose to receive data/status messages, and/or control messages. The location (Virtual Circuit/device/terminal/etc) from which you want to receive the data is specified by the zap parameter. An action parameter value of ZcADD_PRIMARY sets the primary receiver. Once you have called zset_rcvr(), the application program can issue zread() requests to retrieve any data that may have arrived from the selected terminal ZLU. An application program that issues a zset_rcvr() call, as described above, is the primary receiver of the specified messages. Another application program can take over being the primary receiver by issuing a zset_rcvr() request, using the same mode and rzap parameters, with the action code also set to ZcADD_PRIMARY. In this situation, data is no longer queued to the original application. The zset_rcvr() routine can also be used to allow messages to be received by more than one application program at a time. This feature is selected by using an action parameter value of ZcADD_SHARED. When ZcADD_SHARED is used, it specifies that the program does not want to take over being the primary receiver, but simply added as an additional receiver of the incoming messages. Use of this feature does not require that a primary receiver be defined. For every terminal, each receiver mode (except mode ZcOUTB_MLTPLX) allows a maximum of ZcMAX_SHARED_RCVRS (64) program ZLUs to be set with action ZcADD_SHARED. An application program can indicate that it no longer wishes to receive messages by issuing a zset_rcvr() call with the same parameters as those specified in the original zset_rcvr() request, and setting the action parameter to ZcDEL_PRIMARY or ZcDEL_SHARED. The libraries libzcom_c.a and libpthread.a must be linked into the calling program by giving the options "-lzcom_c -lpthread" to cc(1) or ld(1). Threads ConsiderationsThis routine may be called from a multi-threaded application using the POSIX (1003.1c) kernel threads API package. This routine has the following characteristics when called by a multi-threaded application:
PARAMETERS
NOTESUsually, an application uses only mode ZcNORMAL to set up itself as the receiver for normal data and status messages. An application uses mode ZcCONTROL only if it needs to receive “control” messages. Control messages are generated by ZCOM protocol modules. You should refer to the specific ZCOM Protocol Manual to determine the “control” messages generated by that protocol, if any. Modes ZcINB_MLTPLX and ZcOUTB_MLTPLX require the terminal to be an inbound and outbound multiplexed terminal, respectively. Otherwise, error ZERTYPE (-54) is returned. A multiplexed terminal is usually set up by defining the proper device type in the TTGEN configuration file (using TERM or LTERM statements). It may also be modified by using zltmx. When inbound multiplexing is enabled for a terminal, an inbound receiver must be set up (using mode ZcINB_MLTPLX) by the multiplexing program, which will be responsible for receiving messages from the terminal and passing them to the “normal receivers” kept in the logical terminal tables. When outbound multiplexing is enabled for a terminal, an outbound receiver must be set up (using mode ZcOUTB_MLTPLX) by the multiplexing program, which will intercept data sent from other programs. The outbound multiplexing program is responsible for passing the correct data onto the physical terminal (using zsend with mode bit ZCOM_ZSEND_NOMX). For more information, see the section on Multiplexing in the Multiprotocol ACC Programmer's Reference Guide. The ZcADD_SHARED action is not supported for mode ZcOUTB_MLTPLX (outbound multiplexer receiver). RETURN VALUERoutine zset_rcvr returns 0 if successful. Otherwise, a non-zero error code is returned. See /opt/acc/include/zcom/zcomsys.h for the list of ZCOM error codes and their meanings. EXAMPLE#include <zcom/zcomsys.h> FILES
SEE ALSOzltmx(3X), zevent_rcvr(3X), zpeek(3X), zread(3X) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||