HP B2355-90138 manual Dlpi Example Program

Page 24

LLA and DLPI Example Programs

DLPI Example Program

data_buf.len = length;

/* call putmsg and check for an error */ if(putmsg(fd, 0, &data_buf, 0) < 0) {

printf(”error: put_data putmsg failed, errno = %d\n”, errno); exit(1);

}

}

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

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

void

 

 

put_ctrl(fd, length, pri)

 

int

fd;

/* file descriptor */

int

length;

/* length of control message */

int

pri;

/* priority of message: either 0 or RS_HIPRI */

{

 

 

/* set the len field in the strbuf structure */ ctrl_buf.len = length;

/* call putmsg and check for an error */ if(putmsg(fd, &ctrl_buf, 0, pri) < 0) {

printf(”error: put_ctrl putmsg failed, errno = %d\n”, errno);

exit(1);

}

}

/********************************************************************* put a message consisting of both a control part and a control part on a stream

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

void

put_both(fd, ctrl_length, data_length, pri)

int

fd;

/* file descriptor */

int

ctrl_length;

/* length of control part */

int

data_length;

/*

length of data part */

int

pri;

/*

priority of message: either 0

 

 

 

or RS_HIPRI */

{

/* set the len fields in the strbuf structures */ ctrl_buf.len = ctrl_length;

data_buf.len = data_length;

/* call putmsg and check for an error */ if(putmsg(fd, &ctrl_buf, &data_buf, pri) < 0) {

printf(”error: put_both putmsg failed, errno = %d\n”, errno);

exit(1);

}

}

/********************************************************************* open the DLPI cloneable device file, get a list of available PPAs, and attach to the first PPA; returns a file descriptor for the stream

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

24

Chapter 2

Image 24
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 Ioctl Requests LLA ioctl req type Dlpi PrimitiveLogreadtimeout Transmitting Data Receiving Data Receiving Data LLA and Dlpi Example LLA and Dlpi Example Programs Dlpi Example Program Snap SAPStruct 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