#ifndef RECCOON_FILEBASE_H
#define RECCOON_FILEBASE_H TRUE
/*
**  $Filename: Reccoon/Filebase.h $
**  $Release: 0.58 $
**  $Revision: 58.1 $
**  $Date: 94/02/21 $
**
**  Reccoon filebase structures.
**
**  (C) Copyright 1991-94 Niclas Emdelius.
**          All Rights Reserved
*/ 

#ifndef RECCOON_RECCOON_H
#include <Reccoon/Reccoon2.h>
#endif

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif


/* File-access flags. One structure per user and filearea. */

struct FileAccess
{
	unsigned int upload	:1;	// Upload files
	unsigned int download	:1;	// Download files
	unsigned int free	:1;	// Free download
	unsigned int visible	:1;	// Visible in arealist
	unsigned int masked	:1;	// Masked in in globalsearch (future)
	unsigned int sysop	:1;	// Validate, remove credits etc. when editing
	unsigned int edit	:1;	// Edit any file
	unsigned int editown	:1;	// Edit own uploads
	unsigned int validate 	:1;	// Auto validate files
	unsigned int listunval	:1;	// List unvalidated files
	unsigned int view	:1;	// View/Test archive?
	unsigned int locked	:1;	// This FileAccess-structure should not be transposed
	unsigned int unused	:20;
};

/* One set of flags for each filearea. */

struct FileAreaFlags
{
	unsigned int	freqable	:1;	// Allow Filerequests? (unused)
	unsigned int	filecomment	:1;	// Put description as a filecomment? (future)
	unsigned int	noselectarea	:1;	// Don't let user select upload area (future)
	unsigned int	msdos		:1;	// MS-DOS filenames (future)
	unsigned int	fileecho	:1;	// FileEcho area
	unsigned int	added		:1;	// Files have been added since last export
	unsigned int	unusedbits	:10;	// unused
	unsigned int	unusedbits2	:16;	// unused
};

/* Filearea information. Use GetFileArea or check out the ctrl->fileareas */
/* list if you want to access the fileareas. */

struct FileArea
{
	UBYTE		filpath[PATHSIZE];	// Path to files
	UBYTE		filname[30];		// Name of filearea
	UWORD		filmenupage;		// Menupage for filearea
	UWORD		filesysop;		// Sysop of this area (obsolete)
	UWORD		aka;			// AKA to use in file-echo
	UWORD		minaccess;		// Minimum accesslevel
	UWORD		msgarea;		// Attached MsgArea (future)			*/
	UWORD		sig;			// Filearea SIG

	struct FileAreaFlags flags;		// Flags

	ULONG		order;			// Structure number in FileAccess etc.
	UWORD		mindlbaud;		// Minimum download baudrate
	UWORD		minulbaud;		// Minimum upload baudrate
	UWORD		minage;			// How old an user have to be
	ULONG		minul;			// Minimum upload-space before UL (in kb)
	UBYTE		tagname[20];		// Tagname
};

/* Fileheaders in FileBaseX.DAT */

struct fil
{
	UBYTE 			filename[14];	// Name of file
	ULONG 			size;		// File length
	UBYTE 			uploader[22];	// Uploader name
	struct 	TimeDate	date;		// Date and clock
	struct 	TimeDate	lastdl;		// Last downloaded (future)
	UWORD 			dloads;		// Nr of downloads (future)
	UBYTE 			desc1[80];	// Description 1
	UBYTE 			desc2[80];	// Description 2
	UWORD 			minaccess;	// Minimum access level

	unsigned int 		unvalidated :1;	// Unvalidated?
	unsigned int 		free	:1;	// Free download?
	unsigned int		proced	:1;	// Processed with ReccProc?
	unsigned int		unused	:29;
};

/* Marked files for Download, View and/or Edit */

struct MarkedFile
{
	struct RNode	node;			// A double linked list
	ULONG		area;			// Filearea
	ULONG		filenr;			// Structure number in FileBaseX.DAT
	UBYTE		filename[PATHSIZE+14];	// Complete filename. Must be used.
	ULONG		size;			// Filesize
	struct fil 	fil;			// Copy of file's fil structure
	unsigned int	free     :1;		// Free download?
	unsigned int	sent     :1;		// File sent?
	unsigned int	unlisted :1;		// File not listed in filearea (future)
	unsigned int	unused   :29;
};

#endif
