 |
 |  |
 |
 | CAUTION: The API described here may not be used for an X.25
link or VC ZLU that is accessed or used by the X.25/9000 Streams
product. |
 |
 |  |
 |
This chapter contains a general discussion of programming
using the ZCOM and ACC X.25 API calls for communicating across X.25
Virtual Circuits. However, before reading this chapter you should
review chapters 1, 2, and the section "Message Header" in
chapter 3 of the ACC Programmer's Reference
Guide. You should also review the following man pages: zinit(), zopen(), zinfo(), zset_rcvr(), zcntl(), zsend(), zread(), and zclos(),
in the ACC Programmer's Reference Guide.
In most X.25 applications, these are the core general ZCOM API routines
that will be used.
The general ZCOM API routines are used to initialize your
application and to send and receive data to/from Virtual Circuit
ZLUs. The ACC X.25 API routines are used to perform X.25 specific
actions such as establishing and clearing calls on SVCs or sending
Reset Requests. This chapter is broken into four sections: Programmatic
Configuration, X.25 Link Initialization, Sending and Receiving data,
and Using the X.25 API routines.
To help you understand the general structure of an X.25 application,
the following pseudo code example is provided.
 |
 |  |
 |
 | NOTE: This example is intended to show the general order of
how these routines are called and so the parameters have been omitted. |
 |
 |  |
 |
#include <zcom/zcomsys.h>
#include <zcom/zcomx25.h>
/* Initialize access to the ZCOM subsystem */
zinit(...);
/* Create a program ZLU for inbound events */
zopen(&pzlu, ...);
/* Initialize access to the ACC X.25 subsystem */
zx25info(...);
/* Scan through the current active config and look for X.25 links and VCs */
Repeat
zinfo (... PTT ...); /* Grab Physical Terminal table entry. */
zinfo (... LTT ...); /* Grab Logical Terminal table entry. */
/* Check parameters to see if this is an X.25 link or VC zlu. */
Until (All ZLUs searched)
/* Optionally configure missing X.25 links and/or VCs. */
/* Optionally modify X.25 link and/or VC configuration. */
/* Scan through all known VC ZLUs and setup the receiver,enable and activate*/
FOR (each VC ZLU)
{
zset_rcvr (&l3zlu, ...);
zcntl (&l3zlu, mode, ZCOM_MRQCODE_ACT, ...);
zcntl (&l3zlu, mode, ZCOM_MRQCODE_ENB, ...);
}
/* Scan through the X.25 link ZLUs and enable them. Optionally setup
to receive Level 2 unsolicited status messages.*/FOR (each X.25 link ZLU)
{
zx25l2stat_rcvr (&l2zlu, ...); /* Optional */
zcntl (&l2zlu, mode, ZCOM_MRQCODE_ACT, ...);
zcntl (&l2zlu, mode, ZCOM_MRQCODE_ENB, ...);
}
/* Main body of application */
WHILE (forever)
{
zread(&pzlu, ...); /* Get data and/or status messages */
switch (msg type)
{
/* Take action based on msg type and/or status received. */
}
}
zclos( ... ); /* End of program */