
Sample Programs
Connectionless Mode
Connectionless Mode
/**************************************************************************
(C)COPYRIGHT 
**************************************************************************/
/************************************************************************** The main part of this program is composed of two parts.
The first part demonstrates data transfer over a connectionless stream with LLC SAP headers. The second part of this program demonstrates data transfer over a connectionless stream with LLC SNAP headers.
*************************************************************************/
#include <stdio.h> #include <fcntl.h> #include <memory.h> #include <sys/types.h> #include <sys/stream.h> #include <sys/stropts.h> #include <sys/dlpi.h> #include <sys/dlpi_ext.h>
| #define SEND_SAP | 0x80 | /* sending SAP */ | |
| #define RECV_SAP | 0x82 | /* | receiving SAP */ | 
| #define SNAP_SAP | 0xAA | /* | SNAP SAP */ | 
/************************************************************************* SNAP protocol values.
**************************************************************************/
u_char SEND_SNAP_SAP[5] = {0x50, 0x00, 0x00, 0x00, 0x00}; u_char RECV_SNAP_SAP[5] = {0x60, 0x00, 0x00, 0x00, 0x00};
/************************************************************************* global areas for sending and receiving messages
**************************************************************************/
| #define | AREA_SIZE | 5000 | /* | bytes; big enough for largest possible msg */ | 
| #define | LONG_AREA_SIZE | (AREA_SIZE | / sizeof(u_long)) /* AREA_SIZE / 4 */ | |
| u_long | ctrl_area[LONG_AREA_SIZE]; | /* for control messages */ | ||
| u_long | data_area[LONG_AREA_SIZE]; | /* for data messages */ | ||
| struct strbuf ctrl_buf = { | 
 | 
 | ||
| 
 | AREA_SIZE, | 
 | /* maxlen = AREA_SIZE */ | |
| 
 | 0, | 
 | /* len gets filled in for each message */ | |
| }; | ctrl_area | 
 | /* buf = control area */ | |
| 
 | 
 | 
 | 
 | |
struct strbuf data_buf = {
| 156 | Appendix A |