NIO CommKit Host Interface Installation and System Administration Manual

6-25
Porting CommKit Applications To Release 4.x
Examples
8
9 dev_xqt_name = dk_xnamer( intf, chan );
dkleveld Example
Figure 6-6 demonstrates the use of the dkleveld function to send both data
and level-D control codes. The program assumes that stdout is a data switch
connection. Lines 6 through 12 define and initialize a dk_lvld_t message
structure. The message contains a BREAK code, three characters, and then
another BREAK. Line 21 calls the dkleveld function and passes the file
descriptor, the address of the message buffer, and its length.
Figure 6-6 dkleveld Example
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <dkit/rdfp.h>
4 #include <dkit/dk_urp.h>
5
6 dk_lvld_t msg{} = {
7 dkDmkctl(URPdBREAK),
8 dkDmkdata('a'),
9 dkDmkdata('b'),
10 dkDmkdata('c'),
11 dkDmkctl(URPdBREAK)
12 };
13
14 main()
15 {
16 int fd, ret;
17
18 fd = fileno( stdout );
19 printf("start the test \n");
20 sleep(3);
21 ret=dkleveld(fd,msg,sizeof(msg));
22 printf("return code %d \n",ret);
23 }
dksplice Example
Figure 6-7 is an example of a simple splice recovery program and assumes
that the original connection to the host was an ordinary TTY login session.
Figure 6-7 dksplice Example
1 #include <dkit/dk.h>
2 #include <sys/stropts.h>
3 #include <sys/termio.h>