HP rp5450 HP DLPI Programmer's Guide - Page 205
and attach to the first PPA; returns a file descriptor for the stream
View all HP rp5450 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 205 highlights
Sample Programs Connectionless Mode Example /* 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) intfd;/* file descriptor */ intctrl_length;/* length of control part */ intdata_length;/* length of data part */ intpri;/* 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 int attach() { intfd;/* file descriptor */ intppa;/* PPA to attach to */ dl_hp_ppa_req_t*ppa_req = (dl_attach_req_t *)ctrl_area; dl_hp_ppa_ack_t *ppa_ack = (dl_hp_ppa_ack_t *)ctrl_area; dl_hp_ppa_info_t *ppa_info; dl_attach_req_t*attach_req = (dl_attach_req_t *)ctrl_area; char *mac_name; /* open the device file */ if((fd = open("/dev/dlpi", O_RDWR)) == -1) { Appendix A 205