#ifndef	LIBRARIES_FILEVIRUS_H
#define	LIBRARIES_FILEVIRUS_H
/*
**	$VER: filevirus.h 2.02 (09.09.95)
**	$$TAB=8
*/

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

#define	FILEVIRUSNAME "filevirus.library"


/* --- Library structure --- */

struct FilevirusBase {
  struct Library fb_Lib;
  ULONG fb_SegList;           /* Following three entries are for  */
  ULONG fb_Flags;             /* compatibility with LIB:libinit.o */
  APTR  fb_ExecBase;
  ULONG fb_VInfoTotal;        /* Total number of known viruses */
};


/* --- Main structure --- */

struct FilevirusNode {
  void *fv_Buffer;            /* Start of buffer */
  ULONG fv_BufferLen;         /* Length of buffer */
  ULONG fv_SpecialId;         /* For internal use */
  struct FileInfectionNode *fv_FileInfection;
  struct FilevirusInfo *fv_Info;
  ULONG fv_Status;            /* See Reply/Error classes below */
  ULONG fv_VInfoCount;
  ULONG fv_Data;
}; /* FilevirusNode */


/* --- Infection subnode --- */

struct FileInfectionNode {
  struct FileInfectionNode *fi_NextNode;
  const char *fi_VirusName;   /* Textual name of virus */
  const char **fi_NameArray;  /* NULL terminated list of pointers */
  ULONG fi_Type;
  ULONG fi_HunkNum;
  void *fi_Private00;
}; /* FileInfectionNode */


/* --- Info subnode --- */

struct FilevirusInfo {
  const char *fvi_Name;       /* Textual name of virus */
  ULONG fvi_Type;             /* See Virus types below */
}; /* FilevirusInfo */


/* --- Virus types --- */

#define FV_UNKNOWN	0
#define FV_LINK		1	/* Certain hunk(s) must be removed */
#define FV_DELETE	2	/* File must be deleted */
#define FV_RENAME	3	/* File must be overwritten with healty file */
#define FV_CODE		4	/* Some code must be removed from hunk */
#define FV_OVERLAY	5	/* Virus in overlay hunk */


/* --- fvCheckFile flags --- */

#define FVCF_OnlyOne		1<<0	/* Stop after the first virus found */
#define FVCF_NoIntegrity	1<<1	/* Don't perform integrity check before examining the file */

/* --- fvRepairFile flags --- */

#define FVRF_NoMulti		1<<0	/* Don't repair multiple infected hunks */


/* --- Reply/Error classes --- */

/* The reply messages */
#define	FVMSG_OK		0	/* No error has occured (you can */
					/* safely assume that this value */
					/* always will remain zero       */
#define FVMSG_SAVE		1	/* Infected hunks/code have been */
					/* removed. Save the file.       */
#define FVMSG_DELETE		2	/* Delete the file */
#define FVMSG_RENAME		3	/* Rename (or delete) the file */

/* The error messages */
#define FVERRORS		20
#define FVERR_NoMemory		20	/* Out of memory */
#define FVERR_OddBuffer		21	/* Pointer to buffer is misaligned */
#define FVERR_EmptyBuffer	22	/* Length of buffer is zero */

#define	FVERR_NotExecutable	30	/* File is not executable. Files */
					/* that aren't executable cannot */
					/* trigger viruses.              */
#define	FVERR_UnknownHunk	31	/* Unknown or unsupported hunk */
#define	FVERR_SizesMismatch	32	/* Size differs from expected size */
#define FVERR_UnexpectedHunk	33	/* Another hunk was expected */

#endif	/* LIBRARIES_FILEVIRUS_H */
