/*
 * record.h --- 
 * 	records to be passed from front end to back end simulator
 *
 * $Header: /priv1/pc/scratch4/src/cmds/ultrix/RCS/record.h,v 1.3 1994/01/12 05:28:55 pc Exp $
 */

#ifndef __REPL_SIM_RECORD
#define __REPL_SIM_RECORD

#include <sprite.h>
#include <stdio.h>
#include <stdlib.h>
#include <option.h>
#include <spriteTime.h>
#include <errno.h>
#include <sysStats.h>
#include <sys/file.h>
#include "sosp.h"

#define SETID(A, B)	{A.host = B.host; A.domain = B.domain; A.inode = B.inode;}
#define IDEQUAL(A, B)	((A.host == B.host) && (A.domain == B.domain) && (A.inode == B.inode))

struct f_rec {
	int type;			/* type */

#ifdef ULTRIX_TRACE
	int time[2];	
#endif
#ifdef SPRITE_TRACE
	RecordHeader	*recp1, *recp2;	/* pointers to relevant record */
#endif

	int hostID;		/* which machine */
	int userid;		/* which user */
	FileID fid;		/* which file */

	int start;	/* starting offset in the file */
	int size;	/* size of the access */
	int flags;

	long reftime;	/* reftime in microseconds */
};

typedef struct f_rec *Rec;

#define OP_OF(Type)	(Type & 0xff)
	
/* for f_rec.type */
#define REPL_NONE	0
#define	REPL_OPEN	1
#define REPL_CLOSE	2
#define REPL_LSEEK	3
#define REPL_READ	4
#define REPL_WRITE	5
#define REPL_CREATE	6
#define REPL_TRUNC	7
#define REPL_DELDESC	9
#define REPL_LOOKUP	8
#define REPL_FORK	10
#define REPL_EXIT	11

/* read/write record generated from sosp_lseek, sosp_close, or sosp_read 
 * record */
#define FROM_LSEEK	0x10000
#define FROM_CLOSE	0x20000
#define FROM_READ	0x40000

#define BY_OF(Type)	(Type & 0xf0000)

void	lcache_rec(Rec rp);
void	rec_to_cman(Rec rp);
void	serverc_rec(Rec rp);

#endif
