Sample Programs
Connection Mode
case DL_FDDI:
mac_name = ”FDDI”; break;
default:
printf(”error: unknown MAC type in ppa_info\n”); exit(1);
}
printf(”attaching to %s media on PPA %d\n”, mac_name, ppa);
/*
fill in ATTACH_REQ with the PPA we found, send the ATTACH_REQ, and wait for the OK_ACK
*/
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)
int | fd; | /* file descriptor */ |
int | sap; | /* 802.2 SAP to bind on */ |
int | max_conind; | /* max # of connect indications to accept */ |
int | service_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 */
Appendix A | 149 |