/*
	File:		EPPC.h

	Copyright:	© 1984-1993 by Apple Computer, Inc., all rights reserved.

	WARNING
	This file was auto generated by the interfacer tool. Modifications
	must be made to the master file.

*/

#ifndef __EPPC__
#define __EPPC__

#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT
#pragma import on
#endif

#if PRAGMA_STRUCT_ALIGN
	#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
	#pragma pack(2)
#endif

#ifndef __PPCTOOLBOX__
#if LONG_FILENAMES
#include <PPCToolBox.H>
#else
#include <PPCToolB.H>
#endif
#endif

#ifndef __PROCESSES__
#if LONG_FILENAMES
#include <Processes.H>
#else
#include <Processe.H>
#endif
#endif

#define HighLevelEventMsgClass OST_jaym

#define rtrnReceiptMsgID OST_rtrn

enum  {
	kHighLevelEvent			= 23,
/* postOptions currently supported */
#define receiverIDMask	0xF000
#define receiverIDisPSN	0x8000
	receiverIDisSignature		= 0x7000,
	receiverIDisSessionID		= 0x6000,
	receiverIDisTargetID		= 0x5000,
	systemOptionsMask			= 0x0F00,
	nReturnReceipt			= 0x0200,
	priorityMask			= 0x00FF,
	nAttnMsg			= 0x0001,
/* error returns from Post and Accept */
	bufferIsSmall			= -607,
	noOutstandingHLE			= -608,
	connectionInvalid			= -609,
	noUserInteractionAllowed	= -610,			/* no user interaction allowed */
/* constant for return receipts */
	msgWasPartiallyAccepted		= 2,
	msgWasFullyAccepted			= 1,
	msgWasNotAccepted			= 0
};

struct TargetID {
	long			sessionID;
	PPCPortRec			name;
	LocationNameRec			location;
	PPCPortRec			recvrName;
};
typedef struct TargetID TargetID;

typedef TargetID *TargetIDPtr, **TargetIDHdl;

typedef TargetID SenderID;

typedef SenderID *SenderIDPtr;

struct HighLevelEventMsg {
	unsigned short			HighLevelEventMsgHeaderLength;
	unsigned short			version;
	unsigned long			reserved1;
	EventRecord			theMsgEvent;
	unsigned long			userRefcon;
	unsigned long			postingOptions;
	unsigned long			msgLength;
};
typedef struct HighLevelEventMsg HighLevelEventMsg;

typedef HighLevelEventMsg *HighLevelEventMsgPtr, **HighLevelEventMsgHdl;

extern OSErr pascal PostHighLevelEvent(const EventRecord *theEvent, unsigned long receiverID, unsigned long msgRefcon, Ptr msgBuff, unsigned long msgLen, unsigned long postingOptions);
extern OSErr pascal AcceptHighLevelEvent(TargetID *sender, unsigned long *msgRefcon, Ptr msgBuff, unsigned long *msgLen);
extern OSErr pascal GetProcessSerialNumberFromPortName(const PPCPortPtr portName, ProcessSerialNumberPtr pPSN);
extern OSErr pascal GetPortNameFromProcessSerialNumber(PPCPortPtr portName, const ProcessSerialNumberPtr pPSN);

typedef Boolean (pascal *GetSpecificFilterProcPtr)(void *yourDataPtr, HighLevelEventMsgPtr msgBuff, const TargetID *sender);

enum {
	uppGetSpecificFilterProcInfo = kPascalStackBased
		| RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
		| STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void*)))
		| STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(HighLevelEventMsgPtr)))
		| STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(TargetID*)))
};

#if USESROUTINEDESCRIPTORS
typedef UniversalProcPtr GetSpecificFilterUPP;

#define CallGetSpecificFilterProc(userRoutine, yourDataPtr, msgBuff, sender)		\
		CallUniversalProc((UniversalProcPtr)(userRoutine), uppGetSpecificFilterProcInfo, (yourDataPtr), (msgBuff), (sender))
#define NewGetSpecificFilterProc(userRoutine)		\
		(GetSpecificFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppGetSpecificFilterProcInfo, GetCurrentISA())
#else
typedef GetSpecificFilterProcPtr GetSpecificFilterUPP;

#define CallGetSpecificFilterProc(userRoutine, yourDataPtr, msgBuff, sender)		\
		(*(userRoutine))((yourDataPtr), (msgBuff), (sender))
#define NewGetSpecificFilterProc(userRoutine)		\
		(GetSpecificFilterUPP)(userRoutine)
#endif

extern Boolean pascal GetSpecificHighLevelEvent(GetSpecificFilterUPP aFilter, void *yourDataPtr, OSErr *err);

#if PRAGMA_STRUCT_ALIGN
	#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
	#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
	#pragma pack()
#endif

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif

#endif
