HP rp5450 HP DLPI Programmer's Guide - Page 209
send the BIND_REQ and wait for the OK_ACK, put_ctrlfd, sizeofdl_bind_req_t
View all HP rp5450 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 209 highlights
Sample Programs Connectionless Mode Example get_msg(fd); check_ctrl(DL_OK_ACK); /* return the file descriptor for the stream to the caller */ return(fd); } bind to a sap with a specified service mode and max_conind; returns the local DLSAP and its length void bind(fd, sap, max_conind, service_mode, dlsap, dlsap_len) intfd;/* file descriptor */ intsap;/* 802.2 SAP to bind on */ intmax_conind;/* max # of connect indications to accept */ intservice_mode;/* either DL_CODLS or DL_CLDLS */ u_char*dlsap;/* return DLSAP */ int*dlsap_len;/* return length of dlsap */ { dl_bind_req_t*bind_req = (dl_bind_req_t *)ctrl_area; dl_bind_ack_t*bind_ack = (dl_bind_ack_t *)ctrl_area; u_char*dlsap_addr; /* fill in the BIND_REQ */ bind_req->dl_primitive = DL_BIND_REQ; bind_req->dl_sap = sap; bind_req->dl_max_conind = max_conind; bind_req->dl_service_mode = service_mode; bind_req->dl_conn_mgmt = 0;/* conn_mgmt is NOT supported */ bind_req->dl_xidtest_flg = 0;/* user will handle TEST & XID pkts */ /* send the BIND_REQ and wait for the OK_ACK */ put_ctrl(fd, sizeof(dl_bind_req_t), 0); get_msg(fd); check_ctrl(DL_BIND_ACK); /* return the DLSAP to the caller */ *dlsap_len = bind_ack->dl_addr_length; dlsap_addr = (u_char *)ctrl_area + bind_ack->dl_addr_offset; memcpy(dlsap, dlsap_addr, *dlsap_len); } bind to a SNAP sap via the DL_PEER_BIND, or DL_HIERARCHICAL_BIND subsequent bind class; returns the local DLSAP and its length Appendix A 209