Sample Programs
Connection Mode
/* 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 =
dlsap_addr = (u_char *)ctrl_area +
}
/************************************************************************** unbind, detach, and close
**************************************************************************/
void |
|
|
cleanup(fd) |
|
|
int | fd; | /* 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 */
check_ctrl(DL_OK_ACK);
/* detach */
check_ctrl(DL_OK_ACK);
/* close */ close(fd);
}
/************************************************************************** send a connect request to a DLSAP
**************************************************************************/
void
connect_req(fd, dlsap, dlsap_len)
int | fd; | /* file descriptor */ |
u_char | *dlsap; | /* DLSAP to connect with */ |
int | dlsap_len; | /* length of dlsap */ |
{ |
|
|
dl_connect_req_t | *con_req = (dl_connect_req_t *)ctrl_area; | |
dl_connect_res_t | *con_res = (dl_connect_res_t *)ctrl_area; | |
u_char | *tdlsap; |
|
/* fill in the connect request */
/* QOS is not supported; these fields must be set to zero */
150 | Appendix A |