LLA and DLPI Example Programs
DLPI Example Program
data_area[0] = i;
/* Initialize data area */ for (j = 1; j < (i+1)*10; j++)
data_area[j] = ”a”; print_dlsap(”sending data to ”,rdlsap, rdlsap_len);
send_data(send_fd, rdlsap, rdlsap_len, (i + 1) * 10); /* receive the data packet */
recv_len = recv_data(recv_fd);
printf(”received %d bytes, first word = %d\n”, recv_len, data_area[0]);
}
/*
We're finished. Now call cleanup to unbind, then detach, then close the device file.
*/
cleanup(send_fd); cleanup(recv_fd);
}
Chapter 2 | 31 |