HP B2355-90138 manual Dlpi Example Program

Page 23

LLA and DLPI Example Programs

DLPI Example Program

/* did we get a control part */ if(ctrl_buf.len) {

/* yup; is it an ERROR_ACK? */

if(err_ack->dl_primitive == DL_ERROR_ACK) { /* yup; format the ERROR_ACK info */ printf(”error: expected primitive

0x%02x, ”, ex_prim);

printf(”got DL_ERROR_ACK\n”); printf(” dl_error_primitive =

0x%02x\n”, err_ack-> dl_error_primitive);

printf(” dl_errno = 0x%02x\n”, err_ack->dl_errno);

printf(” dl_unix_errno = %d\n”, err_ack->dl_unix_errno);

exit(1);

} else {

/*

didn't get an ERROR_ACK either; print whatever primitive we did get

*/

printf(”error: expected primitive 0x%02x, ”, ex_prim);

printf(”got primitive 0x%02x\n”, err_ack->dl_primitive);

exit(1);

}

} else {

/* no control; did we get data? */ if(data_buf.len) {

/* tell user we only got data */ printf(”error: check_ctrl found only

data\n”);

exit(1);

} else {

/*

no message???; well, it was probably an interrupted system call

*/

printf(”error: check_ctrl found no message\n”);

exit(1);

}

}

}

}

/********************************************************************* put a message consisting of only a data part on a stream

*********************************************************************/

void

 

 

put_data(fd, length)

 

int

fd;

/* file descriptor */

int

length;

/* length of data message */

{

 

 

/* set the len field in the strbuf structure */

Chapter 2

23

Image 23
Contents LLA to Dlpi Migration Guide Legal Notices Page Page Contents Contents Printing History Page Preface Page LLA to Dlpi Migration LLA to Dlpi Migration Device Files LLA ioctl req type Dlpi Primitive Ioctl RequestsLogreadtimeout Transmitting Data Receiving Data Receiving Data LLA and Dlpi Example LLA and Dlpi Example Programs Snap SAP Dlpi Example ProgramStruct strbuf databuf = Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program Dlpi Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program LLA Example Program Index