Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
ACC X.25 Protocol User's Guide > Chapter 4 X.25 Application Programming

ZX25L2STAT_RCVR (3X) — ACC X.25

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

NAME

zx25l2stat_rcvr - Setup receiver for X.25 link status messages

SYNOPSIS

#include  <zcom/zcomsys.h>
#include <zcom/zcomx25.h>

int zx25l2stat_rcvr (zxip, action, lzap, pzap)

zx25info_type *zxip;
int action;
zaddr_type *lzap;
zaddr_type *pzap;

DESCRIPTION

The zx25l2stat_rcvr routine is used to add or remove the primary or shared receiver for X.25 Link unsolicited status messages. There can be only one primary X.25 link status receiver. If more than one request is issued to add a primary receiver, the last one issued takes precedence.

If more than one application program needs to receive the X.25 link status messages, the application should set itself up as a shared receiver. Any number of applications may request X.25 link status messages as a shared receiver.

Once this routine has been successfully called, X.25 link status messages will continue to be queued on the application program ZLU specified in pzap until another zx25l2stat_rcvr is issued to remove the program ZLU as a receiver of Link status messages. The status messages are retrieved using the zread() routine.

An application program can indicate that it no longer wishes to receive X.25 link status messages by issuing a zx25l2stat_rcvr() call with the same parameters as the specified in the original zx25l2stat_rcvr() request, and setting the action parameter to ZcDEL_PRIMARY or ZcDEL_SHARED.

Note that extreme care must be taken to make sure the application removes itself as a receiver of X.25 link status messages before the application program terminates. Failure to perform this action could cause the ZCOM subsystem to run out of buffer space. That is, the link status messages would continue to be sent to the program's input queue even though the program is no longer running.

The libraries libzx25.a, libzcom_c.a and libpthread.a must be linked into the calling program by giving the "-lzx25 -lzcom_c -lpthread" options to cc(1) or ld(1).

Threads Considerations

This routine may be called from a multi-threaded application using the POSIX (1003.1c) kernel threads API package. It has the following characteristics when called by multi-threaded applications:

cancellation point

Thread cancellation can occur when a thread calls this routine.

async-cancel unsafe

The calling thread's cancelability type must be PTHREAD_CANCEL_DEFERRED if cancellation is enabled.

async-signal unsafe

It cannot be called from a signal handler.

fork unsafe

It cannot be called by a child process after fork(2) but before exec(2).

See the NOTES section that follows for more information on using this routine in a multi-threaded application.

PARAMETERS:

zxip

ZCOM X.25 access data structure (from zx25info call).

action

Type of action to perform.

Zc_ADD_PRIMARY -

Sets the program ZLU as the primary receiver.

Zc_DEL_PRIMARY -

Deletes the primary receiver.

Zc_ADD_SHARED -

Adds the program ZLU to the list of shared receivers.

Zc_DEL_SHARED -

Removes the program ZLU from the list of shared receivers.

lzap

Link terminal ZCOM address (e.g. X.25 LAP-B ZLU).

pzap

Program ZCOM address to receive status on or to be deleted.

RETURN VALUE

Routine zx25l2stat_rcvr returns a 0 when successful. If there was a ZCOM error, it returns a negative value. See /opt/acc/include/zcom/zcomsys.h for the list of ZCOM error codes and their meanings. If zx25l2stat_rcvr, itself, failed, one of the following positive error codes is returned:

ZxeUNKNOWN_L2_ZLU (02)

The ZLU specified is not an X.25 link (HDLC/LAP-B) ZLU.

ZxeREQ_TIMEOUT (04)

The remote ZCOM system did not respond within 30 seconds.

ZxeMUST_CALL_ZX25INFO (17)

The zx25info() routine has not been called. You must call zx25info before issuing any other zx25...() calls.

ZxeBAD_ZX25INFO_ADDR (18)

The pointer to the zx25info_type structure does not contain the same address that was passed to the zx25info() routine.

ZxeBAD_ACTION (19)

The action parameter was not one of the four valid action values.

ZxeX25_NOT_INITIALIZED (98)

The ACC X.25 subsystem has not been initialized. You must run zx25d_init before issuing any zx25...() calls.

ZxeX25_TBL_FULL (99)

The X.25 routines maintain an internal table for accessing remote ZCOM nodes. This table has room to access up to 20 different ZCOM nodes (including the local node). This request attempted to access the 21st ZCOM remote node and the internal table used had insufficient space to save the routing data.

NOTES

The calling program (or thread) must call zx25info before calling this routine. In a multi-threaded application, each thread must make a separate call to zx25info using a per-thread ZCOM X.25 access data buffer zxip. The per-thread data buffer can then be used to call this routine.

EXAMPLE

#include    <zcom/zcomsys.h>
#include <zcom/zcomx25.h>

int ierr;
zx25info_type zxi;
zaddr_type lzaddr;
zaddr_type pzaddr;

/* Allocate our primary program ZLU. */
if (ierr = zopen (&pzaddr, 1, "myprgrm", 0)) exit (ierr);

/* Issue the prerequisite zx25info() call. */
if (ierr = zx25info (&zxi, "auxprog")) exit (ierr);

/* User written routine to find X.25 link ZLU. Returns its address. */
if (ierr = Get_Link_ZLU(&lzaddr)) exit (ierr);

/* Tell ZCOM to send X.25 link status to our application. */
if (ierr = zx25l2stat_rcvr (&zxi, Zc_ADD_PRIMARY, &lzaddr, &pzaddr)) {
/* error return code */
}
else {
/* good return code */
}

/* This code disables X.25 link status messages. */
if (ierr = zx25l2stat_rcvr (&zxi, Zc_DEL_PRIMARY, &lzaddr, &pzaddr)) {
/* error return code */
}
else {
/* good return code */
}

FILES

/opt/acc/include/zcom/zcomsys.h

ZCOM system general include file, containing data types, data structures, constants, error codes, masks, etc. Note that this must be the first include file before any other ZCOM include files.

/opt/acc/include/zcom/zcomx25.h

ZCOM access data structure declarations.

SEE ALSO

zx25info(3x), zopen(3x), zread(3x), zset_rcvr(3x)

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2000 Hewlett-Packard Development Company, L.P.