ACC X.25 Protocol User's Guide

X.25 Application Programming
Programmatically Configuring X.25
Chapter 4 71
#include <zcom/zcomsys.h>
#include <zcom/zcomx25.h>
zaddr_type 13zlu; /* Holds X.25 Virtual Circuit ZLU. */
zaddr_type pzlu; /* Our application’s program ZLU. */
zconfig_type cdata; /* zconfig() Configuration Data */
zcfgret_type rdata; /* Response data from zconfig() */
struct {
unsigned char pttype; /* Physical device type */
unsigned char ptport; /* Port on mux card. */
unsigned short ptpoll; /* X.25 VC Poll Word. */
unsigned short ptselect; /* X.25 VC Select Word */
unsigned short ptoption; /* X.25 VC Option Word */
} term_parms;
/*
Initialize the ’cdata’ structure to dynamically create an X.25 VC 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 VC. */
cdata.data.setterm.dtype = 54; /* LTT device type is 54 for a VC. */
cdata.data.setterm.ltype = 99; /* Must be set to 99. */
cdata.data.setterm.ltt.ltapno= 99; /* Set to app # used in X25UDT defintn */
if (rc = zconfig(&pzlu, 0, 0, &cdata, &rdata) {
/* Handler error */
}
/* rdata.data.termret.zaddr now contains X.25 VC ZLU (zcom address). */
l3zlu = rdata.data.termret.zaddr;
/*
Initialize the Physical Device type, poll, select and option words for the
X.25 Virtual Circuit and insert them into the Physical Terminal Table.
*/
term_parms.pttype = 26; /* Must be 26 for an X.25 VC ZLU. */
term_parms.ptport = 1; /* We created this VC on Port 1 */
term_parms.ptpoll = 0; /* D-bit always supplied in zx25...() calls. */
term_parms.ptselect = 0; /* Not Used for SVCs */
term_parms.ptoption = 0x0F50; /* Set OUT, RSET, CNT, ACK, IN, NLL bits. */
if (rc = zcntl(&l3zlu, 1, ZCOM_MRQCODE_TERM, &term_parms, sizeof(term_parms), 0)) {
/* Handle Error */}