
/*
 *  PARALLEL NETWORK INTERFACE
 */

#define ACTION_OPENRW	    1004
#define ACTION_OPENOLD	    1005
#define ACTION_OPENNEW	    1006
#define ACTION_CLOSE	    1007
#define ACTION_SEEK	    1008
#define ACTION_RAWMODE	    994
#define ACTION_MORECACHE    18
#define ACTION_FLUSH	    27

#define CTOB(x) (void *)(((long)(x))>>2)
#define BTOC(x) (void *)(((long)(x))<<2)

#define bmov(ss,dd,nn) CopyMem(ss,dd,nn)

#define DOS_FALSE   0
#define DOS_TRUE    -1

#define RAMFILE struct _RAMFILE
#define FENTRY	struct _FENTRY
#define MYLOCK	struct _MYLOCK
#define MYFH	struct _MYFH

typedef unsigned char	ubyte;
typedef unsigned short	uword;
typedef unsigned long	ulong;

typedef struct Interrupt	INTERRUPT;
typedef struct Task		TASK;
typedef struct FileLock 	LOCK;
typedef struct FileInfoBlock	FIB;
typedef struct DosPacket	PACKET;
typedef struct Process		PROC;
typedef struct DeviceNode	DEVNODE;
typedef struct FileHandle	FH;
typedef struct MsgPort		PORT;
typedef struct Message		MSG;
typedef struct MinList		LIST;
typedef struct MinNode		NODE;
typedef struct DateStamp	STAMP;
typedef struct InfoData 	INFODATA;

#define FILE_DIR    1
#define FILE_FILE   -1

RAMFILE {
    NODE    node;
    RAMFILE *parent;
    char    *name;
    char    *comment;
    short   type;	/*  -1 = file,	1 = dir 	    */
    short   locks;	/*  <0:exclusive 0:none >0:shared   */
    ulong   protection;
    ulong   bytes;
    LIST    list;	/*  list of FENTRY's or RAMFILE's   */
    STAMP   date;
};

FENTRY {
    NODE    node;
    ubyte   *buf;
    ulong   bytes;
};

MYLOCK {
    LOCK    lock;
    NODE    node;
    RAMFILE *file;
};

MYFH {
    NODE    node;
    RAMFILE *file;	/*  file header     */
    FENTRY  *fentry;
    long    base;	/*  base of FENTRY	*/
    long    offset;	/*  offset into FENTRY	*/
};

extern long AbsExecBase;

extern void *AllocMem(), *RemHead(), *CreatePort(), *GetMsg();
extern void *FindTask(), *Open();

extern void   *dosalloc(), *NextNode(), *GetHead();
extern void   freedata(), freeramfile(), ramunlock(), btos(), returnpacket();
extern MYLOCK *ramlock();
extern RAMFILE *searchpath(), *createramfile(), *getlockfile();

extern char *getpathelement();

