LLA and DLPI Example Programs
DLPI Example Program
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 */
/* 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 =
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);
}
/********************************************************************* receive a data packet;
*********************************************************************/
int |
|
|
recv_data(fd) |
|
|
int | fd; | /* file descriptor */ |
{ |
|
|
dl_unitdata_ind_t *data_ind = (dl_unitdata_ind_t *)ctrl_area;
Chapter 2 | 27 |