HP B2355-90138 manual Dlpi Example Program, Snap SAP

Models: B2355-90138

1 41
Download 41 pages 55.62 Kb
Page 21
Image 21

LLA and DLPI Example Programs

DLPI Example Program

DLPI Example Program

/*********************************************************************

(C)COPYRIGHT HEWLETT-PACKARD COMPANY 1992. ALL RIGHTS RESERVED. NO PART OF THIS PROGRAM MAY BE PHOTOCOPIED, REPRODUCED, OR TRANSLATED TO ANOTHER PROGRAM LANGUAGE WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT PACKARD COMPANY

*********************************************************************/

/********************************************************************* 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

*/

 

 

 

Chapter 2

21

Page 21
Image 21
HP B2355-90138 manual Dlpi Example Program, Snap SAP