 |
» |
|
|
 |
|  |  |
The previous chapter discussed how to create an X.25 configuration through
the TTGEN configuration file. This section discusses how to programmatically
modify the X.25 link and virtual circuit configurations and when
those changes will take effect. Before you begin to modify an X.25
link's configuration, all of the VC ZLUs and the X.25 link
ZLU must be disabled (using zcntl).
You may then dynamically add and delete VC ZLUs and modify the various
X.25 related parameters. When the X.25 link ZLU is enabled, the
ACC X.25 subsystem scans through all of the ZLUs in the ZCOM subsystem
and locates all of the VC ZLUs associated with that link. At that
point, the X.25 link's configuration is "frozen" and no
further changes should be made. Configuring the X.25 Link |  |
The X.25 link configuration information is stored in the Logical
Data Area of the Logical Terminal Table (LTT) for the X.25 link
ZLU, and in fields of the Physical Terminal Table (PTT). The format
of the X.25 link Logical Data Area is defined by the x25cnt_type data structure in the include
file /opt/acc/include/zcom/zcomx25.h.
Note that in addition to configuration information, this structure
also contains run-time data such as link statistics and link state.
This structure contains the X.25 Timer values, Logical Channel assignment
table, default Level 3 packet and window sizes, and the auto-start
option. Use the zltstore() routine
to find the offset of the data structure (Logical Data Area) in
the LTT and then use zltup() to
update the contents of the data structure. The link physical device
type, poll, select, and link option words are configured with the zcntl() routine using the Set Terminal
Parameters request code. The X.121 address is kept in the ptcnfg field in the PTT. This can
be modified using the zptup() routine.
To dynamically create or to delete an X.25 link ZLU, you use the zconfig() routine. Note that if zconfig() is used to dynamically
add or delete the X.25 link ZLU, you must notify the ACC X.25 subsystem
by generating an X.25 reconfiguration System Event Message. The zconfig() routine is used to perform
this operation as well and must be issued after the ZLU has been
added or deleted. See the example below to see how to generate the
reconfiguration system event message. 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 */ } /* rdata.data.termret.zaddr now contains X.25 link ZLU (zcom address). */ l2zlu = rdata.data.termret.zaddr; /* Retrieve the contents of the LTT including the Logical Data Area */ if (rc = zinfo(&l2zlu, 1, (char *)<t_lda, sizeof(ltt_lda)) { /* Handle Error */ } /* Now find the Logical Data Area in the LTT (Note: X25LTAP, X25CNTN, and X25LTSZ are all defined in zcomx25.h). */ if (rc = zltstore(X25LTAP, X25CNTN, X25LTSZ, &lda_offset)) { /* Handle Error */ } ldap = (x25cnt_type *)((char *)<t_lda + lda_offset); ldap->ltenbl = X25LTENBL; /* Specify "no_autostart" */ ldap->lthpc = 0; /* No PVCs */ ldap->ltlic = 0; /* No one-way incomming SVCs */ ldap->lthic = 0; ldap->ltltc = 32; /* 2 two-way SVCs starting at LCN 32. */ ldap->lthtc = 33; ldap->ltloc = 0; /* No one-way outgoing SVCs. */ ldap->lthoc = 0; ldap->ltiwn = 7; /* Set L3 inbound and outbound window sizes */ ldap->ltown = 7; ldap->ltipk = 9; /* Set L3 inbound packet size to 512 bytes */ ldap->ltopk = 8; /* Set L3 outbound packet size to 256 bytes */ ldap->ltmT1_res = 1; /* Use T1 timer resolution of 10 milli-seconds */ ldap->ltmT1_mlt = 40; /* Set T1 to 400 milli-seconds. */ ldap->ltmT2_res = 1; /* Use T2 timer resolution of 10 milli-seconds */ ldap->ltmT2_mlt = 20; /* Set T2 to 200 milli-seconds. */ ldap->ltmT34_res = 3; /* Use T3/T4 timer resolution of seconds */ ldap->ltmT34_mlt = 25; /* Set T3/T4 to 25 seconds. */ /* Now insert the new configuration into the X.25 Link's LTT */ if (rc = zltup(&l2zlu, ldap, sizeof(x25cnt_type), lda_offset)) { /* Handle Error */ } /* Initialize the Physical Device type, poll, select and option words for the X.25 link and insert them into the Physical Terminal Table. */ term_parms.pttype = 25; /* Must be 25 for an X.25 Link ZLU. */ term_parms.ptport = 1; /* We created this link on Port 1 */ term_parms.ptpoll = 0x9009; /* DTE, Enforced D-bit negotiation, 512 pkt size */ term_parms.ptselect = 0x01EA; /* K = 7, N2 = 10 */ term_parms.ptoption = 0x18; /* Set NTX and IRX bits */ if (rc = zcntl(&l2zlu, 1, ZCOM_MRQCODE_TERM, &term_parms, sizeof(term_parms), 0)) { /* Handle Error */ } /* Now generate an X.25 Reconfiguration System Event Message (SEM) to inform the ACC X.25 subsystem of the newly created X.25 link ZLU. */ cdata.header.config = ZCOM_ZCONFIG_CNTL; /* DSC Control Request */ cdata.header.action = 3; /* Broadcast Reconfiguration SEM. */ cdata.data.setctl.cfg_class = ZxCLASS_X25; /* X.25 was reconfigured. */ cdata.data.setctl.cfg_info1 = l2zlu.zlu; /* X.25 link ZLU added/deleted. */ if (rc = zconfig(&pzlu, 0, 0, &cdata, &rdata)) { /* Handle error */ } The X.25 link ZLU now exists in the run-time ZCOM subsystem
and has been properly configured for use. You should now configure
any SVCs or PVCs that are needed on this link. Configuring X.25 Virtual Circuits |  |
If the X.25 link ZLU is defined, you may dynamically create
and configure X.25 Virtual Circuit ZLUs. The primary information
that is typically modified programmatically is the poll, select
and option words of a Virtual Circuit. These are changed using the zcntl() routine with a request code
of Set Terminal Parameters, just as in the X.25 Link ZLU. In addition,
you may want to modify the ptcnfg field
in the PTT which may be used to restrict inbound calls to a specific
X.121 address. This will occur if you place an X.121 address into
the ptcnfg field. See the notes
section in the zx25callout() man
page for a description of the address format to use. The following code fragment provides an example of how to
dynamically create an X.25 Virtual Circuit ZLU (SVC) and to configure
the various X.25 VC related parameters. This example creates an
X.25 two-way SVC ZLU on port 1 on mux 2 (as defined in the currently
loaded TTGEN configuration): #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 */}
|