HP rp4440 HP DLPI Programmer's Guide - Page 210
check_ctrlDL_SUBS_BIND_ACK, return the DLSAP to the caller
View all HP rp4440 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 210 highlights
Sample Programs Connectionless Mode Example void subs_bind(fd, snapsap, snapsap_len, subs_bind_class, dlsap, dlsap_len) intfd; u_char*snapsap; intsubs_bind_class; u_char*dlsap; int*dlsap_len; { dl_subs_bind_req_t*subs_bind_req = (dl_subs_bind_req_t*)ctrl_area; dl_subs_bind_ack_t*subs_bind_ack = (dl_subs_bind_ack_t*)ctrl_area; u_char*dlsap_addr; /* Fill in Subsequent bind req */ subs_bind_req->dl_primitive = DL_SUBS_BIND_REQ; subs_bind_req->dl_subs_sap_offset = DL_SUBS_BIND_REQ_SIZE; subs_bind_req->dl_subs_sap_length = snapsap_len; subs_bind_req->dl_subs_bind_class = subs_bind_class; memcpy((caddr_t)&subs_bind_req[1], snapsap, snapsap_len); /* send the SUBS_BIND_REQ and wait for the OK_ACK */ put_ctrl(fd, sizeof(dl_subs_bind_req_t)+snapsap_len, 0); get_msg(fd); check_ctrl(DL_SUBS_BIND_ACK); /* return the DLSAP to the caller */ *dlsap_len = subs_bind_ack->dl_subs_sap_length; dlsap_addr = (u_char *)ctrl_area + subs_bind_ack->dl_subs_sap_offset; memcpy(dlsap, dlsap_addr, *dlsap_len); } unbind, detach, and close void cleanup(fd) intfd;/* file descriptor */ { dl_unbind_req_t*unbind_req = (dl_unbind_req_t *)ctrl_area; dl_detach_req_t*detach_req = (dl_detach_req_t *)ctrl_area; /* unbind */ unbind_req->dl_primitive = DL_UNBIND_REQ; put_ctrl(fd, sizeof(dl_unbind_req_t), 0); get_msg(fd); check_ctrl(DL_OK_ACK); 210 Appendix A