DLPI Programmer's Guide

Appendix A 167
Sample Programs
Raw Mode
Raw Mode
/*
* (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1993. 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 program demonstrates RAW mode data transfer over an
802.3 interface.
****************************************************************/
#define PPA 1
#define FRAME_LEN 1500 /* max message size is 1514;MAC+LLC+data */
#define SEQ_OFFSET 100
#define INSAP 22
#define OUTSAP 24
#define OUTER_LOOPS 10
#define INNER_LOOPS 25
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <math.h>
#include <ctype.h>
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sys/poll.h>
#include <sys/dlpi.h>
#include <sys/dlpi_ext.h>
#include <netinet/if_ieee.h>
#define bcopy(source, destination, length) memcpy(destination, source, length)
#define ETHER_HLEN 14
char tag[80];
#define AREA_SZ 5000 /*-=-* buffer length in bytes *-=-*/
u_long ctl_area[AREA_SZ];
u_long dat_area[AREA_SZ];
struct strbuf ctl = {AREA_SZ, 0, ctl_area};
struct strbuf dat = {AREA_SZ, 0, dat_area};
#define GOT_CTRL 1