LLA and DLPI Example Programs

LLA Example Program

LLA 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 LLA with LLC SAP headers. The second part of this program demonstrates data transfer over LLA with LLC SNAP headers.

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

#include <stdio.h> #include <fcntl.h> #include <memory.h> #include <errno.h> #include <sys/types.h> #include <sys/netio.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 MAX_PKT_SIZE

1500

/* Maximum packet size for Ethernet */

u_long

data_area[MAX_PKT_SIZE];

/* for data messages */

struct

fis ctrl_buf;

 

 

/************************************************************************* Read a packet on LLA file descriptor fd.

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

int

 

 

get_pkt(fd)

 

 

int

fd;

/* file descriptor */

{

 

 

int recv_cnt;

32

Chapter 2

Page 32
Image 32
HP B2355-90138 manual LLA Example Program