HP rp5400 HP DLPI Programmer's Guide - Page 191
print_dlsapstring, dlsap, dlsap_len, print a string followed by a DLSAP
View all HP rp5400 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 191 highlights
Sample Programs Connection Mode Example 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); } } print a string followed by a DLSAP void print_dlsap(string, dlsap, dlsap_len) char*string;/* label */ u_char*dlsap;/* the DLSAP */ intdlsap_len;/* length of dlsap */ { inti; printf("%s0x", string); for(i = 0; i < dlsap_len; i++) { printf("%02x", dlsap[i]); } printf("\n"); } 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 */ Appendix A 191