Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
OTLLCTest.h
/* |
File: OTLLCTest.h |
Contains: headers, defines for the OTLLCTest.c file |
Written by: Rich Kubota |
Copyright: Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
7/22/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 |
*/ |
#ifndef __OTLLCTEST__ |
#define __OTLLCTEST__ |
#ifndef __CONDITIONALMACROS__ |
#include <ConditionalMacros.h> |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
#if PRAGMA_ALIGN_SUPPORTED |
#pragma options align=mac68k |
#endif |
#if PRAGMA_IMPORT_SUPPORTED |
#pragma import on |
#endif |
#include <stdio.h> |
#include <Types.h> |
#include <Memory.h> |
#include <Resources.h> |
#include <Events.h> |
#include <OpenTransport.h> // open transport files |
#include <OpenTptLinks.h> |
// defines for setting and reading the data buffer |
#define DATASIZE 1500 |
#define DATASLOP 50 // extra bytes for the incoming data buffer to hold |
// mentat raw mode header and ethernet header |
#define DATAOFFSET 1400 // first byte in data buffer where we place valid data |
#define SENDCOUNT 10005 // number of data packets to send |
#define TRIGGEREND 10000 // trigger point for receiver to end |
// define the DSAP |
//#define TESTSAP 0x00FF |
#define TESTSAP 0xE0 |
//#define TESTSAP 0xAA |
#define MYSNAP0 0x00 |
#define MYSNAP1 0x00 |
#define MYSNAP2 0x0C |
#define MYSNAP3 0x20 |
#define MYSNAP4 0x00 |
#define TIMEOUT 30 // seconds |
// define the multicast address to use |
#define MCASTADDR0 0x09 |
#define MCASTADDR1 0x00 |
#define MCASTADDR2 0x2B |
#define MCASTADDR3 0x00 |
#define MCASTADDR4 0x00 |
#define MCASTADDR5 0x04 |
// defines for gFlags bits |
#define OTActiveFlag 0 |
#define EPActiveFlag 1 |
#define EPBoundFlag 2 |
#define MCastActiveFlag 3 |
#define WantDataFlag 4 |
#define StillBindFlag 5 |
#define FlowErrFlag 7 |
#define FlowClrFlag 8 |
#define AckSendsFlag 9 |
#define UseAckSendsFlag 10 |
#define WaitOptMgmtFlag 11 |
#define RawModeFlag 12 |
#define UseRawModeFlag 13 |
#define SysTaskSendFlag 14 |
// gFlags macros for setting, testing and clearing the flag bits |
#define SetOTActiveFlag(flags) (flags |= 1 << OTActiveFlag) |
#define ClrOTActiveFlag(flags) (flags &= (-1 ^ (1 << OTActiveFlag))) |
#define TstOTActiveFlag(flags) ((flags & (1 << OTActiveFlag)) != 0) |
#define SetEPActiveFlag(flags) (flags |= 1 << EPActiveFlag) |
#define ClrEPActiveFlag(flags) (flags &= (-1 ^ (1 << EPActiveFlag))) |
#define TstEPActiveFlag(flags) ((flags & (1 << EPActiveFlag)) != 0) |
#define SetEPBoundFlag(flags) (flags |= 1 << EPBoundFlag) |
#define ClrEPBoundFlag(flags) (flags &= (-1 ^ (1 << EPBoundFlag))) |
#define TstEPBoundFlag(flags) ((flags & (1 << EPBoundFlag)) != 0) |
#define SetMCastActiveFlag(flags) (flags |= 1 << MCastActiveFlag) |
#define ClrMCastActiveFlag(flags) (flags &= (-1 ^ (1 << MCastActiveFlag))) |
#define TstMCastActiveFlag(flags) ((flags & (1 << MCastActiveFlag)) != 0) |
#define SetWantDataFlag(flags) (flags |= 1 << WantDataFlag) |
#define ClrWantDataFlag(flags) (flags &= (-1 ^ (1 << WantDataFlag))) |
#define TstWantDataFlag(flags) ((flags & (1 << WantDataFlag)) != 0) |
#define SetStillBindFlag(flags) (flags |= 1 << StillBindFlag) |
#define ClrStillBindFlag(flags) (flags &= (-1 ^ (1 << StillBindFlag))) |
#define TstStillBindFlag(flags) ((flags & (1 << StillBindFlag)) != 0) |
#define SetFlowErrFlag(flags) (flags |= 1 << FlowErrFlag) |
#define ClrFlowErrFlag(flags) (flags &= (-1 ^ (1 << FlowErrFlag))) |
#define TstFlowErrFlag(flags) ((flags & (1 << FlowErrFlag)) != 0) |
#define SetFlowClrFlag(flags) (flags |= 1 << FlowClrFlag) |
#define ClrFlowClrFlag(flags) (flags &= (-1 ^ (1 << FlowClrFlag))) |
#define TstFlowClrFlag(flags) ((flags & (1 << FlowClrFlag)) != 0) |
#define SetAckSendsFlag(flags) (flags |= 1 << AckSendsFlag) |
#define ClrAckSendsFlag(flags) (flags &= (-1 ^ (1 << AckSendsFlag))) |
#define TstAckSendsFlag(flags) ((flags & (1 << AckSendsFlag)) != 0) |
#define SetUseAckSendsFlag(flags) (flags |= 1 << UseAckSendsFlag) |
#define ClrUseAckSendsFlag(flags) (flags &= (-1 ^ (1 << UseAckSendsFlag))) |
#define TstUseAckSendsFlag(flags) ((flags & (1 << UseAckSendsFlag)) != 0) |
#define SetWaitOptMgmtFlag(flags) (flags |= 1 << WaitOptMgmtFlag) |
#define ClrWaitOptMgmtFlag(flags) (flags &= (-1 ^ (1 << WaitOptMgmtFlag))) |
#define TstWaitOptMgmtFlag(flags) ((flags & (1 << WaitOptMgmtFlag)) != 0) |
#define SetRawModeFlag(flags) (flags |= 1 << RawModeFlag) |
#define ClrRawModeFlag(flags) (flags &= (-1 ^ (1 << RawModeFlag))) |
#define TstRawModeFlag(flags) ((flags & (1 << RawModeFlag)) != 0) |
#define SetUseRawModeFlag(flags) (flags |= 1 << UseRawModeFlag) |
#define ClrUseRawModeFlag(flags) (flags &= (-1 ^ (1 << UseRawModeFlag))) |
#define TstUseRawModeFlag(flags) ((flags & (1 << UseRawModeFlag)) != 0) |
#define SetSysTaskSendFlag(flags) (flags |= 1 << SysTaskSendFlag) |
#define ClrSysTaskSendFlag(flags) (flags &= (-1 ^ (1 << SysTaskSendFlag))) |
#define TstSysTaskSendFlag(flags) ((flags & (1 << SysTaskSendFlag)) != 0) |
#define kInSendPacketBit 0x01 |
enum { |
kSendTest = 1, |
kReceiveTest, |
kAcceptOption, |
kDeclineOption, |
kQuitTest |
} TestTypes; |
struct Address8022 { |
OTAddressType fAddrFamily; |
UInt8 fHWAddr[k48BitAddrLength]; |
UInt16 fSAP; |
}; |
typedef struct Address8022 Address8022; |
struct PacketBuffer { |
UInt32 rawModeOffset; |
UInt32 i; |
UInt32 lastFlowErrPacketNum; |
TUnitData unitdata; |
struct T8022Address dAddr; |
UInt8 data[DATASIZE+32]; |
}; |
typedef struct PacketBuffer PacketBuffer; |
typedef struct PacketBuffer *PacketBufPtr; |
#if PRAGMA_IMPORT_SUPPORTED |
#pragma import off |
#endif |
#if PRAGMA_ALIGN_SUPPORTED |
#pragma options align=reset |
#endif |
#ifdef __cplusplus |
} |
#endif |
#endif /* __OTLLCTEST__ */ |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-07-22