NIO CommKit Host Interface Installation and System Administration Manual

6-23
Porting CommKit Applications To Release 4.x
Examples
7 d1.dest = dstring;
8 d1.intf = 1;
9 d1.baud = (char *)NULL;
10 cmd = DK_DIAL|DK_SELINTF;
11 fdout1 = dkitdial(cmd &d1);
12 /* make a call so TTY processing is done */
13 d1.dest = dstring;
14 d1.intf = 0;
15 d1.baud = (char *)NULL;
16 cmd = DK_DIAL|DK_PUSHTTY;
17 fdout0 = dkitdial(cmd, &d1);
In the following lines, Figure 6-2 shows how to use the dkitdial function to
select the interface for the outgoing call:
Line 4 defines a dial string and line 5 defines the needed structure.
Lines 7-9 initialize the structure with the dial string and interface number.
Line 10 sets the command value to indicate that this is an ordinary dial
(DK_DIAL) using the interface information (DK_SELINTF) set on line 8.
Line 11 is the actual call to the function.
Figure 6-2 also shows how to use the dkitdial function to select TTY
processing:
Lines 13 to 15 initialize the structure, but because line 16 does not use the
DK_SELINTF command, the functioning interface ignores the information and
uses the default interface selection instead.
Line 16 does use the DK_PUSHTIY command and this will request the function
to push the TTY processing modules onto the open stream.
Line 17 is the actual call to the function.
dk_namer Example
Figure 6-3 is an example of the dk_namer function. This function returns a
pointer to a character string that is the name of the raw device indicated by
the two arguments. The first argument (intf) is the interface number, and the
second argument (chan) is the data switch channel number on that interface.