//============================================================
//============================================================
//==														==
//==					AppleTalkDDP Header					==
//==														==
//============================================================
//============================================================

#include <AppleTalk.h>
#include "Globals.h"


//========================================================  Defines  

#define kBufferSize				1536
#define kLookupBufferSize		2048

#define	kThisType				"\pPararena"
#define kAnyZone				"\p*"
#define kLookUpSelector			"\p="
#define kMaxLookUpNumber		8

#define rNetStringID			190
#define rNetSelectDialogID		190
#define	kButtNetOkay			1
#define	kButtNetCancel			2
#define	kButtNetLook			3
#define	kButtNetNext			4
#define kButtNetPrev			5
#define	kTextNetNumber			6
#define	kTextNetWho				7
#define kNetPowBalloonItem		10
#define	kUserNetFrame			11

#define kNetErrWrongSize		321

#define kNetErrNoErr			0
#define kNetErrBadHardware		1
#define kNetErrDriverFailed		2
#define kNetErrSocketFailed		3
#define kNetErrRegisterFailed	4
#define kNetErrCloseFailed		5
#define kNetErrUserCancelled	6
#define kNetErrRemoveFailed		7
#define kNetErrBuffersFailed	8


//========================================================  Type Definitions  


typedef struct
{
	Str255			name;
	AddrBlock		address;
} netUserArray[kMaxLookUpNumber];


//========================================================  Prototypes  

short InitializeAppleTalk (void);		// functions to call from outside 
OSErr RegisterNameOnNet (void);			// listed in calling sequence 
pascal Boolean NamesFilter (DialogPtr, EventRecord *, short *);
Boolean SelectNetOpponentAsynch (void);
OSErr RequestReceiveDDP (void);
OSErr PollIncomingDDP (long, short, short);
OSErr PollSpecificDDP (long, short, short);
OSErr SendOutgoingDDP (long, short);
short CloseDownAppleTalk (void);

OSErr OpenAppleTalkDriver (void);		// functions called internally 
void GetDefaultName (void);
OSErr OpenSocketDDP (void);
OSErr LookUpNamesAsynch (void);
Boolean IsThereAnotherName (short);
Boolean IsLookUpFinished (void);
OSErr ProcessAName (netUserArray, short);
void UpdateNetOpponents (DialogPtr, netUserArray, short, short);
Boolean DetermineMasterSlave (void);
OSErr DeRegisterName (void);
OSErr CloseSocketDDP (void);


//========================================================  External Variables  

extern string31			theNames[10];
extern long				speedFlag, theirSpeed;
extern short			whichHumanNumber;
extern Boolean			isColor;


