ACC X.25 Protocol User's Guide

X.25 Application Programming
Programmatically Configuring X.25
Chapter 468
If you intend to dynamically create the X.25 link ZLU, you must do this
before any of the VC ZLUs are defined. If you dynamically delete the
X.25 link ZLU, all of the X.25 VC ZLUs on that link must also be deleted
as well.
The following code fragment provides an example of how to dynamically
create an X.25 link ZLU and to configure the various X.25 link related
parameters. This example creates an X.25 link ZLU for port 1 on mux 2
(as defined in the currently loaded TTGEN configuration):
#include <zcom/zcomsys.h>
#include <zcom/zcomx25.h>
int lda_offset; /* Holds offset to Logical Data Area */
zaddr_type l2zlu; /* Holds X.25 Link ZLU. */
zaddr_type pzlu; /* Our application’s program ZLU. */
x25cnt_type ldap; /* Ptr to the Logical Data Area in LTT. */
zconfig_type cdata; /* zconfig() Configuration Data */
zcfgret_type rdata; /* Response data from zconfig() */
struct {
zltt_type ltt; /* Holds Logical Terminal Table data. */
char lda[ZCOM_MAXLSIZE]; /* Max Logical Data Area size. */
} ltt_lda;
struct {
unsigned char pttype; /* Physical device type. */
unsigned char ptport; /* Port on mux card. */
unsigned short ptpoll; /* X.25 Link Poll Word. */
unsigned short ptselect; /* X.25 Link Select Word */
unsigned short ptoption; /* X.25 Link Option Word */
} term_parms;
/*
Initialize the ’cdata’ structure to dynamically create an X.25 Link ZLU.
*/
memset ((char *)&cdata, 0, sizeof(cdata));
cdata.header.config = ZCOM_ZCONFIG_TERM; /* Terminal Configuration */
cdata.header.action = 1; /* Create a new Term entry (LTT & PTT) */
cdata.data.setterm.zaddr.zlu = 0; /* Allow ZCOM to choose an unused ZLU. */
cdata.data.setterm.iftno = 2; /* MUX # from TTGEN configuration file */
cdata.data.setterm.portno = 1; /* Port on MUX card for this X.25 link */
cdata.data.setterm.subchno = 0; /* Subchannel # on E1/T1 card for link */
cdata.data.setterm.dtype = 48; /* LTT device type is 48 for HDLC/LAPB */
cdata.data.setterm.ltype = 99; /* Must be set to 99. */
cdata.data.setterm.ltt.ltapno= X25LTAP; /* Must be 10 for X.25 link ZLU */
if (rc = zconfig(&pzlu, 0, 0, &cdata, &rdata)) {
/* Handle error */
}