![](/images/new-backgrounds/1315828/31582851x1.webp)
LLA and DLPI Example Programs
DLPI Example Program
put_ctrl(fd, sizeof(dl_attach_req_t), 0); 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 # 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* dl_bind_ack_t* u_char*
bind_req = (dl_bind_req_t *)ctrl_area; bind_ack = (dl_bind_ack_t *)ctrl_area; dlsap_addr;
/* fill in the BIND_REQ */
0;/* | conn_mgmt is NOT supported */ | |
= 0; | /* user handles 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 =
dlsap_addr = (u_char *)ctrl_area +
}
/********************************************************************* bind to a SNAP sap via the DL_PEER_BIND, or DL_HIERARCHICAL_BIND subsequent bind class; returns the local DLSAP and its length
*********************************************************************/
void
subs_bind(fd, snapsap, snapsap_len, subs_bind_class, dlsap, dlsap_len)
int | fd; |
u_char* | snapsap; |
int | subs_bind_class; |
u_char | *dlsap; |
int | *dlsap_len; |
{ |
|
26 | Chapter 2 |