#ifndef _ARCLIB_H
#define	_ARCLIB_H

#include "commdef.h"
#include "interface.h"
#ifdef _WIN32
#include <Winsock2.h>
#endif

#include "sasbase.h"

#ifdef __cplusplus
extern "C" {
#endif


#pragma pack(1)

//	THE BELOW BLOCK IS ONLY FOR INTERNAL USE
/************************************************************************************/
enum
{
GUI_SET_SERIAL = 0x10,
GUI_SET_VENDOR,
GUI_SET_MODEL,
GUI_IDENTIFY,
GUI_CHECK_PASSWORD,
GUI_LOGOUT,
GUI_HTTP,
GUI_SET_ETHERNET_ADDR,
GUI_SET_LOGO,
GUI_POLL_EVENT,
GUI_GET_EVENT,
GUI_GET_HW_MONITOR,
GUI_SMART_TEST,
GUI_SET_TIME,
GUI_SNMP,
GUI_MISC,

GUI_GET_INFO_R = 0x20,
GUI_GET_INFO_V,
GUI_GET_INFO_P,
GUI_GET_INFO_S,
GUI_CLEAR_EVENT,

GUI_MUTE_BEEPER = 0x30,
GUI_BEEPER_SETTING,
GUI_SET_PASSWORD,
GUI_HOST_INTERFACE_MODE,
GUI_REBUILD_PRIORITY,
GUI_MAX_ATA_MODE,
GUI_RESET_CONTROLLER,
GUI_COM_PORT_SETTING,
GUI_NO_OPERATION,
GUI_DHCP_IP,

GUI_CREATE_PASS_THROUGH = 0x40,
GUI_MODIFY_PASS_THROUGH,
GUI_DELETE_PASS_THROUGH,
GUI_IDENTIFY_DEVICE,

GUI_CREATE_RAIDSET = 0x50,
GUI_DELETE_RAIDSET,
GUI_EXPAND_RAIDSET,
GUI_ACTIVATE_RAIDSET,
GUI_CREATE_HOT_SPARE,
GUI_DELETE_HOT_SPARE,

GUI_CREATE_VOLUME = 0x60,
GUI_MODIFY_VOLUME,
GUI_DELETE_VOLUME,
GUI_START_CHECK_VOLUME,
GUI_STOP_CHECK_VOLUME
};

// Application specific
enum 
{
GUI_RAW_WRITE  = 0xEE,
GUI_SET_ENCLOSURE_UNIT_SERIAL,
GUI_GET_TCPPORT,
GUI_GET_COMATTR,

// status code
GUI_WOULDBLOCK,
GUI_TIMEOUT
};
/****************************************************************************************/


//
// Library returned status
//
#define ARC_STATUS					int
#define ARC_SUCCESS					0x00	// Operation succeeded 
#define ARC_FAILURE					0x01	// Operation failed
#define ARC_RETURN_FRAME_ERROR 		0x02	// The library does not recognize the returned data
                                            // (including invalid data header, length or checksum, etc...)
#define ARC_INVALID_COM_HANDLE		0x03	// Invalid RS-232 handle
#define ARC_DATA_TRANSMIT_ERROR		0x04	// Failed to write to media
#define ARC_DATA_RECEIVE_ERROR		0x05	// Failed to read from media( no response from raid subsystem)
#define ARC_PARAMETER_ERROR			0x06	// The wrong parameter(s)
#define ARC_OPENFILE_ERROR			0x07	// Failed to open file
#define ARC_PASSWORD_REQUIRED       0x08	// Password required
#define ARC_INVALID_PASSWORD        0x09	// Wrong password
#define ARC_INSUFFICIENT_MEM		0x0A	// Memory too small
#define ARC_CANT_ALLOC_MEM			0x0B	// Failed to allocate necessary memory
#define ARC_BUFFER_TOO_SMALL		0x0C	// The buffer is too small to put the returned data
#define	ARC_SOCKET_ERROR			0x0D	// Socket error
#define ARC_INVALID_SOCKET			0x0E	// Invalid socket
#define ARC_INIT_COM_ERROR			0x0F	// Failed to open COM port
#define ARC_SOCKET_STARTUP_ERROR	0x10	// Failed to init socket
#define ARC_INVALID_INTERFACE		0x11	// Invalid interface
#define ARC_NO_SUCH_DEVICE			0x12	// Device not found( including raidset, volumeset, physical drive )
#define ARC_DATA_TRANSMIT_TIMEOUT   0x13	// Failed to write to media in a given time
#define ARC_DATA_RECEIVE_TIMEOUT    0x14	// Failed to read from media in a given time
#define ARC_UNKNOWN_ERROR			0x3F	// Unknown error

// RAID controller returned status
#define GUI_OK						0x41	// Operation successed
#define GUI_RAIDSET_NOT_NORMAL		0x42
#define GUI_VOLUMESET_NOT_NORMAL	0x43
#define GUI_NO_RAIDSET				0x44
#define GUI_NO_VOLUMESET			0x45
#define GUI_NO_PHYSICAL_DRIVE		0x46
#define GUI_PARAMETER_ERROR			0x47
#define GUI_UNSUPPORTED_COMMAND		0x48
#define GUI_DISK_CONFIG_CHANGED		0x49
#define GUI_INVALID_PASSWORD		0x4a
#define GUI_NO_DISK_SPACE			0x4b
#define GUI_CHECKSUM_ERROR			0x4c
#define GUI_PASSWORD_REQUIRED		0x4d
#define GUI_NO_MORE_DATA   			0x4e	// Internal use only
#define GUI_INTERNAL_ERROR   		0x4f
#define GUI_FIRMWARE_CRC_ERROR  	0x50
#define GUI_FIRMWARE_INVALID  		0x51
#define GUI_FIRMWARE_UPDATE_FAILED 	0x52
#define GUI_FIRMWARE_NO_HDD   		0x53
#define GUI_END_OF_DATA    			0x54


// flags of getting event
#define FLAG_ALL			0
#define FLAG_NEW			1

// Beeper settings
#define BEEPER_ON			1
#define BEEPER_OFF			0

// Host Mode
#define RAID				0
#define JBOD				1


#define DISABLE				0
#define ENABLE				1

#define	ON					0
#define OFF					1


#define	TYPE_64BIT_LBA			0
#define	TYPE_4K_FOR_WIN			1


// host type interface
// HostType 
#define HOST_PCI			1
#define HOST_PCIExpress		2
#define HOST_PATA			3
#define HOST_SATA1			4
#define HOST_SATA2			5
#define HOST_SCSI160		6
#define HOST_SCSI320		7
#define HOST_Fibre2G		8
#define HOST_Fibre4G		9
#define HOST_SAS			10

// TargetType
#define TARGET_PATA			1
#define TARGET_SATA			2
#define TARGET_SAS			3
#define TARGET_Fibre		4


// COM port attributes
typedef struct sCOM_ATTR
{
	BYTE comBaudRate;				// BaudRate: 0/1/2/3/4/5/6/7 (1200/2400/4800/9600/19200/38400/57600/115200)					
	BYTE comDataBits;				// DataBit: always 1 (8 bits)
	BYTE comStopBits;				// StopBit: (0:1, 1:2 stop bits)
	BYTE comParity;					// Parity: always 0 (no parity)
	BYTE comFlowControl;			// FlowControl: always 0 (no flow control)
} sCOM_ATTR, *pCOM_ATTR;

// Rebuild priority
enum _REBUILD_PRIORITY
{
	REBUILD_PRIORITY_ULOW,        // Ultra Low(5%)
	REBUILD_PRIORITY_LOW,         // Low(20%)
	REBUILD_PRIORITY_MEDIUM,      // Medium(50%)
	REBUILD_PRIORITY_HIGH,        // High(80%)
	TOTAL_REBUILD_PRIORITY
};

typedef struct sSYSTEM_INFO
{
	BYTE gsiVendorName[40];			// Vendor name
	BYTE gsiSerialNumber[16];		// Serial number
	BYTE gsiFirmVersion[16];		// Version of firmware 
	BYTE gsiBootVersion[16];		// Version of boot
	BYTE gsiMbVersion[16];			// Version of MBR(Master Boot Record)
	BYTE gsiModelName[8];			// Model name
	BYTE gsiLocalIp[4];				// Static IP if DHCP disabled
	BYTE gsiCurrentIp[4];			// Current IP Address, the value is either assigned by DHCP server if DHCP enabled or static IP if DHCP disabled.
	DWORD gsiTimeTick;				// Raid subsystem current time tick
	DWORD gsiCpuSpeed;				// CPU speed ( in MHz )
	DWORD gsiICache;				// CPU internal Instruction cache size ( in bytes )
	DWORD gsiDCache;				// CPU internal Data Cache size	( in bytes )
	DWORD gsiSCache;				// CPU secondary cache size	( in bytes )
	DWORD gsiMemorySize;			// Memory size ( in MBs )
	DWORD gsiMemorySpeed;			// Memory speed ( in MHz )
	DWORD gsiEvents;				// # of IDE events supported
	BYTE gsiMacAddress[6];			// MAC address if ethernet support
	BYTE gsiDhcp;					// 0: DHCP function disabled, 1: DHCP function enabled
	BYTE gsiBeeper;					// 0: Beeper disabled, 1: Beeper enabled
	BYTE gsiChannelUsage;			// 0: RAID , 1: JBOD
	BYTE gsiMaxAtaMode;				// Max ATA mode
	BYTE gsiSdramEcc; 				// 1: If ECC enabled
	BYTE gsiRebuildPriority;		// Initialize/rebuild/migration priority
	sCOM_ATTR gsiComA; 				// Attribute of COM1
	sCOM_ATTR gsiComB; 				// Attribute of COM2
	BYTE gsiIdeChannels;			// # of IDE channels supported
	BYTE gsiScsiHostChannels;		// # of SCSI host channels supported
	BYTE gsiIdeHostChannels;		// # of IDE host channels supported
	BYTE gsiMaxVolumeSet;			// # of VolumeSets supported
	BYTE gsiMaxRaidSet;				// # of RaidSet supported
	BYTE gsiEtherPort; 				// 1: If ethernet port supported
	BYTE gsiRaid6Engine; 			// 1: Raid6 engine supported
	BYTE gsiRs232Snmp;				// 1: SNMP through RS232
	BYTE gsiMIB_1;
	BYTE gsiMIB_2;
	DWORD gsiEnterpriseNum;			// Enterprise number of SNMP
    BYTE gsiHostType;               // Host type
    BYTE gsiTargetType;             // Target type
    BYTE gsiInBandEnable;           // 1: If Inband enabled
    BYTE gsiInBandChannel;          // The SCSI channel of inband device
    BYTE gsiInBandId;               // The SCSI ID of inband device
    BYTE gsiNumberEnclosures;		// # of Enclosures supported(SAS only)
	BYTE gsiR5060Supported;			// 1: Raid Level30/50/60 supported
	BYTE gsiRes[61];				// 
} sSYSTEM_INFO, *pSYSTEM_INFO;




//=======================================================
// Definitions of raidset status
//=======================================================
#define  RAID_NORMAL   		0x01	// Raid set in use
#define  RAID_COMPLETE  	0x04	// 0: If incomplete
#define  RAID_PASSTHROUGH 	0x80	// Pass through raid set


typedef struct sGUI_RAIDSET
{
	BYTE grsRaidSetName[16];	// 16 bytes raidset name
	DWORD grsCapacity;			// Minimum capacity in blocks required for each disk (member disk's minimum capacity)
	DWORD grsCapacityX;			// Reserved for 64 bit extension
	DWORD grsFailMask;			// Bit mask to indicate the failed drive (bit0 -- drive 0, bit1 -- drive 1 ....)
	BYTE grsDevArray[32];		// Array for member disk's channel#
	BYTE grsMemberDevices;		// Number of member disks in this raid set
	BYTE grsNewMemberDevices;	// New number of disks in this raid set (in case of raid EXPANDing)
	BYTE grsRaidState;			// Current state of RAID set
	BYTE grsVolumes;			// # of volumes created in this raid set
	BYTE grsVolumeList[16];		// Array of VOLUME NUMBER of the created volumes in this raid set
	BYTE grsRes1;				// Reserved
	BYTE grsRes2;				// Reserved
	BYTE grsRes3;				// Reserved
	BYTE grsFreeSegments;		// # of free segment in this raid set
	DWORD grsRawStripes[8];		// Free segment array, each segment is 0x200 blocks for each member disk
	DWORD grsRes4;				// Reserved
	DWORD grsRes5;				// Reserved
	DWORD grsRes6;				// Reserved
	BYTE grsVolumeListX[112];	// Array of VOLUME NUMBER of the created volumes in this raid set
	BYTE grsDevEncArray[32];	// Array for member enclosure#
} sGUI_RAIDSET, *pGUI_RAIDSET;





//=======================================================
// Definitions of volume status
// Array status == OR of all of its volumes
// gvsVolumeStatus
//=======================================================
#define  VOLUME_NORMAL				0x00
#define  VOLUME_INITIALIZING		0x01
#define  VOLUME_FAILED				0x02
#define  VOLUME_MIGRATING			0x04
#define  VOLUME_REBUILDING			0x08
#define  VOLUME_NEED_INIT			0x10
#define  VOLUME_NEED_MIGRATE		0x20
#define  VOLUME_INIT_FLAG			0x40
#define  VOLUME_NEED_REGEN			0x80 
#define  VOLUME_CHECKING			0x100
#define  VOLUME_NEED_CHECK			0x200
#define  VOLUME_MIGLBA_INVALID	    0x400
#define  VOLUME_MIGLBA_FAILED	    0x800
#define  VOLUME_CHECK_NO_SCRUB	    0x1000
#define  VOLUME_CHECK_NO_REGEN	    0x2000

//=======================================================
// Definitions of volume state
// gvsVolState
//=======================================================
#define	 VOLUME_R5060_VOLUME		0x000100	// The volume is a member of another volume which raidlevel 30/50/60
#define	 VOLUME_R5060_PARENT		0x100000	// The volume is a root volume of raidlevel 30/50/60

//=======================================================
// Definitions of volume type
//=======================================================
#define  VOLUME_TYPE_STRIPING 		0  // Striping
#define  VOLUME_TYPE_MIRROR  		1  // Mirror 
#define  VOLUME_TYPE_RAID3  		2  // RAID 3 volume
#define  VOLUME_TYPE_RAID5  		3  // RAID 5
#define  VOLUME_TYPE_RAID6  		4  // RAID 6
#define  VOLUME_TYPE_PASSTHROUGH 	5  // Pass through volume

//=======================================================
// Definitions of volume stripe size
//=======================================================
#define STRIPE_SIZE_4K		0
#define STRIPE_SIZE_8K		1
#define STRIPE_SIZE_16K		2
#define STRIPE_SIZE_32K		3
#define STRIPE_SIZE_64K		4
#define STRIPE_SIZE_128K	5

enum _SCSI_SPEED_MODE
{
	SCSI_SPEED_ASYNC = 0,
	SCSI_SPEED_20,
	SCSI_SPEED_40,
	SCSI_SPEED_80,
	SCSI_SPEED_160,
	TOTAL_SCSI_SPEED
};

enum _IDE_SPEED_MODE
{
	IDE_SPEED_33 = 0,
	IDE_SPEED_66,
	IDE_SPEED_100,
	IDE_SPEED_133,
	TOTAL_IDE_SPEED
};


enum _SATA_SPEED_MODE
{
	SATA_SPEED_150 = 0,
	SATA_SPEED_150NCQ,
	SATA_SPEED_300,
	SATA_SPEED_300NCQ,
	TOTAL_SATA_SPEED
};


#define BACKGROUND_INIT		0
#define FOREGROUND_INIT		1

enum _UDMA_MODE
{
	UDMA_MODE_0 = 0, // Ultra DMA Mode 0 235ns 16.7 MB/s ATA-4ĦBUltra ATA/16
	UDMA_MODE_1, // Ultra DMA Mode 1 160ns 25 MB/s ATA-4ĦBUltra ATA/25
	UDMA_MODE_2, // Ultra DMA Mode 2 120ns 33.3 MB/s ATA-4ĦBUltra ATA/33 
	UDMA_MODE_3, // Ultra DMA Mode 3 90ns 44.4 MB/s ATA-5ĦBUltra ATA/44
	UDMA_MODE_4, // Ultra DMA Mode 4 60ns 66.6 MB/s ATA-5ĦBUltra ATA/66 
	UDMA_MODE_5, // Ultra DMA Mode 5 40ns 100 MB/s ATA-6ĦBUltra ATA/100 
	UDMA_MODE_6, // Ultra DMA Mode 6 30ns 133MB/s ATA-7ĦBUltra ATA/133
	TOTAL_UDMA_MODE
};


typedef struct sGUI_VOLUMESET
{
	BYTE gvsVolumeName[16];		// 16 bytes volumeset name
	DWORD gvsCapacity;			// Volume Capacity (in blocks)
	DWORD gvsCapacityX;			// Reserved for 64 bits
	DWORD gvsFailMask;			// Failed mask for the volume (same as raidset)
	DWORD gvsStripeSize;		// (value in blocks) 8--4K, 16--8K, 32--16K, 64--32K, 128--64K, 256--128K
	DWORD gvsNewFailMask;		// For internal use only
	DWORD gvsNewStripeSize;		// New stripe size ( used for MIGRATION)
	DWORD gvsVolumeStatus;		// See above ( volume status )
	DWORD gvsProgress; 			// Progress for the volume if in (initializing/rebuilding/migrating)
	sSCSI_ATTR gvsScsi; 		// SCSI attribute
	BYTE gvsMemberDisks;		// # of member disks
	BYTE gvsRaidLevel; 			// Raid Level of this volume
	BYTE gvsNewMemberDisks;		// Used for migration
	BYTE gvsNewRaidLevel;		// Used for migration
	BYTE gvsRaidSetNumber;		// Raid set number that the volumeset belongs to
	BYTE gvsVolState0;			// Reserved
	DWORD gvsHostSpeed;			// Reserved
	DWORD gvsVolState;			// See above( volume state )
	BYTE gvsVolArray[16];		// Child-volume table
	BYTE gvsNum5060Volumes;		// Number of volumes in the field 'gvsVolArray'
	BYTE gvsRes[43];			// 
} sGUI_VOLUMESET, *pGUI_VOLUMESET;




//=======================================================
// Definitions of device(disk) status
//=======================================================
#define  DEV_INITIALIZED 	0x80  // Device initialized
#define  DEV_AVAILABLE 		0x40  // Device available for use
#define  DEV_HOT_SPARE 		0x20  // Device is reserved for HOT SPARE
#define  DEV_FAILED  		0x10  // Device failed
#define  DEV_ATTACHED 		0x08  // Device attached
#define	 DEV_PASSTHROUGH	0x02  // Pass through device

//=======================================================
// Definitions of device(disk) status for SAS controller
//=======================================================
#define  DEV_SATA_DEVICE	0x100 // Device is a SATA type
#define	 DEV_POWER_DOWN	    0x200 // Device power down


typedef struct sGUI_PHY_DRV
{
	BYTE	gpdModelName[40];		// Model name
	BYTE	gpdSerialNumber[20];	// Serial number
	BYTE	gpdFirmRev[8];			// Firmware version
	DWORD	gpdCapacity;			// Capacity in blocks ( A block = 512 bytes )
	DWORD	gpdCapacityX;			// Reserved for expansion
	BYTE	gpdDeviceState;			// See above, for SAS controller: this field is treated as the low-byte of device state
	BYTE	gpdPioMode;				// For SAS controller: this field is treated as the high-byte of device state	                                
	BYTE	gpdCurrentUdmaMode;		// Current UDMA mode
	BYTE	gpdUdmaMode;			// Max supported UDMA mode
	BYTE	gpdDriveSelect;			// Drive select : master / slave
	BYTE	gpdRaidNumber;			// 0xff if not belongs to a raid set
	sSCSI_ATTR	gpdScsi;			// SCSI attributes
	LONG	gpdMediaErrorCount;		// Media error count
	LONG	gpdTimeOutCount;		// Timeout count
	u_int64_t	gpdSasAddress;		// SAS only
	union
	{
		struct
		{
			sSMART_DATA gpdSmart[TOTAL_SMART_ITEMS];		// see sasbase.h 'enum _SMART_ITEMS'
		} sata;	// SMART data for SATA disk
		struct
		{
			WORD		gpdRotationRPM;						// The rotation(RPM) of disk
			WORD		gpdTemperature;						// The temperature of disk
			WORD		gpdSmartSenseCode;					// The SMART sense code
			WORD		gpdReserved;
			u_int64_t   gpdAttribute[TOTAL_SAS_ATTR_ITEMS];	// The SAS disk attributes, see sasbase.h '_SAS_ATTRIBUTE_ITEMS'
		} sas;	// Attributes for SAS disk
	} u;
} sGUI_PHY_DRV, *pGUI_PHY_DRV;


//=======================================================
// Definition for event buffer
//=======================================================
// Event category
enum
{
	EVENT_NO_EVENT,
	EVENT_RAIDSET,
	EVENT_VOLUMESET,
	EVENT_DEVICE,
	EVENT_HOST,
	EVENT_HW_MONITOR,
	EVENT_NEW_83782D,	
};
// Event type
// 1. RaidSet event 
enum
{
	RS_EVT_CREATE,
	RS_EVT_DELETE,
	RS_EVT_EXPAND,
	RS_EVT_REBUILD,
	RS_EVT_DEGRADED,
	RS_EVT_NO_EVENT,	
};
// 2. volumeset event
enum
{
	VS_EVT_INITIALIZING,
	VS_EVT_REBUILDING,
	VS_EVT_MIGRATING,
	VS_EVT_CHECKING,
	VS_EVT_COMPLETE_INIT,
	VS_EVT_COMPLETE_REBUILD,
	VS_EVT_COMPLETE_MIGRATING,
	VS_EVT_COMPLETE_CHECKING,
	VS_EVT_CREATE,
	VS_EVT_DELETE,
	VS_EVT_MODIFY,
	VS_EVT_DEGRADED,
	VS_EVT_FAILED,
	VS_EVT_REVIVED,

	// init/rebuild/migration ABORT & STOP event
	VS_EVT_ABORT_INIT,
	VS_EVT_ABORT_REBUILD,
	VS_EVT_ABORT_MIGRATING,
	VS_EVT_ABORT_CHECKING,
	VS_EVT_STOP_INIT,
	VS_EVT_STOP_REBUILD,
	VS_EVT_STOP_MIGRATING,
	VS_EVT_STOP_CHECKING,

	VS_EVT_TOTALS
};

#define REBUILD_TYPE_INIT  VS_EVT_INITIALIZING
#define REBUILD_TYPE_REGEN  VS_EVT_REBUILDING
#define REBUILD_TYPE_MIG  VS_EVT_MIGRATING
#define REBUILD_TYPE_CHECK  VS_EVT_COMPLETE_INIT
// IDE device event
enum
{
	DEV_EVT_ADDED,
	DEV_EVT_REMOVED,
	DEV_EVT_READ_ERROR,
	DEV_EVT_WRITE_ERROR,
	DEV_EVT_ATA_ECC_ERROR,
	DEV_EVT_ATA_CHANGE_MODE,
	DEV_EVT_TIMEOUT,
	DEV_EVT_MARK_FAILED,
	DEV_EVT_PCI_ERROR,
	DEV_EVT_SMART_FAILED,
	DEV_EVT_CREATE_PASS,
	DEV_EVT_MODIFY_PASS,
	DEV_EVT_DELETE_PASS,
	DEV_EVT_TOTALS
};

// SCSI bus event
enum
{
	SCSI_EVT_RESET,
	SCSI_EVT_PARITY,
	SCSI_BUS_MODE_CHANGE,
	SCSI_EVT_TOTALS
};

// Hw monitor event
enum
{
	HW_EVT_SDRAM_1BIT_ECC,
	HW_EVT_SDRAM_MULTI_BIT_ECC,
	HW_EVT_TEMP_CONTROLLER,
	HW_EVT_TEMP_BACKPLANE,
	HW_EVT_VOLTAGE15,
	HW_EVT_VOLTAGE3,
	HW_EVT_VOLTAGE5,
	HW_EVT_VOLTAGE12,
	HW_EVT_VOLTAGE1_3,
	HW_EVT_VOLTAGE2_5,
	HW_EVT_VOLTAGE1_25,
	HW_EVT_POWER1_FAILED,
	HW_EVT_FAN1_FAILED,
	HW_EVT_POWER2_FAILED,
	HW_EVT_FAN2_FAILED,
	HW_EVT_POWER3_FAILED,
	HW_EVT_FAN3_FAILED,
	HW_EVT_POWER4_FAILED,
	HW_EVT_FAN4_FAILED,
	HW_EVT_UPS_POWER_LOSS,
	// Add to log H/W monitor recovered
	HW_EVT_TEMP_CONTROLLER_R,
	HW_EVT_TEMP_BACKPLANE_R,
	HW_EVT_VOLTAGE15_R,
	HW_EVT_VOLTAGE3_R,
	HW_EVT_VOLTAGE5_R,
	HW_EVT_VOLTAGE12_R,
	HW_EVT_VOLTAGE1_3_R,
	HW_EVT_VOLTAGE2_5_R,
	HW_EVT_VOLTAGE1_25_R,
	HW_EVT_POWER1_RECOVERED,
	HW_EVT_FAN1_RECOVERED,
	HW_EVT_POWER2_RECOVERED,
	HW_EVT_FAN2_RECOVERED,
	HW_EVT_POWER3_RECOVERED,
	HW_EVT_FAN3_RECOVERED,
	HW_EVT_POWER4_RECOVERED,
	HW_EVT_FAN4_RECOVERED,
	HW_EVT_UPS_POWER_RECOVERED, 

	HW_EVT_SYSTEM_RESTARTED,
	HW_EVT_TEST,
	// added for battery backup
	HW_EVT_SYSTEM_RECOVERED,        // return from BBM
	HW_EVT_TOTALS
};

enum
{
	GHM_RECOVER,
	GHM_OVER_TEMP,
	GHM_FAILED,
	GHM_UNDER_VOLTAGE,
	GHM_OVER_VOLTAGE,
	GHM_DISCOVERED,
	GHM_LOST_MIG,           // record migration point maybe lost
	GHM_OFFLINED,       
	GHM_HTTP_LOGIN,
	GHM_TELNET_LOGIN,
	GHM_VT100_LOGIN,
	GHM_GUI_LOGIN,
	GHM_FC_LINK_UP,
	GHM_FC_LINK_DOWN,
	GHM_16BYTES_CDB,
	GHM_INIT_LBA,           // restart init LBA
	GHM_REBUILD_LBA,        // restart rebuild LBA
	GHM_MIGRATE_LBA,         // restart migration LBA
	GHM_ONE_BIT_ECC,
	GHM_MULTI_BIT_ECC,
	GHM_OFF,
	GHM_UNKNOWN,
	GHM_ADDED,
	GHM_REMOVED,
	GHM_TOTALS
};

#if defined(__BIG_ENDIAN__)
typedef union sSYS_TIME
{
	struct
	{
		DWORD tmFlag:1;
		DWORD tmMonth:4;
		DWORD tmYear:5;
		DWORD tmDate:5;
		DWORD tmHour:5;
		DWORD tmMinute:6;
		DWORD tmSecond:6;
	} u;
	struct
	{
		int32_t tmFlag:1;
		int32_t tmTick:31;		
	} x;
} sSYS_TIME, *pSYS_TIME;	

#else
typedef union sSYS_TIME
{
	struct
	{
		DWORD tmSecond:6;
		DWORD tmMinute:6;
		DWORD tmHour:5;
		DWORD tmDate:5;
		DWORD tmYear:5;
		DWORD tmMonth:4;
		DWORD tmFlag:1;
	} u;
	struct
	{
		int32_t tmTick:31;
		int32_t tmFlag:1;
	} x;
} sSYS_TIME, *pSYS_TIME;
// If (tmFlag == 1) ==> use YY/MM/DD/HH/MM/SS else use time tick
#endif

/* event object data structure */
typedef struct sEVET_DATA
{
	BYTE evtCategory;			// Event category
	BYTE evtType;				// Event type
	BYTE evtChannel;			// Event channel
	BYTE evtFlag;				// Addition data flag
	int32_t evtTime;			// Occurred time
	DWORD evtData1;				// Additional data1
	DWORD evtData2;				// Additional data2
	BYTE evtStr[16];			// string for event
} sEVENT_DATA, *pEVENT_DATA;	// total 32 bytes


/* strings for event category */
static const char *eventCat[] =
{
	"NO_EVENT",
	"RAIDSET",
	"VOLUMESET",
	"DEVICE",
	"HOST",
	"H/W MONITOR"
};
 
/* strings for device event */
static const char *htmDevEvent[] =
{
	"Device Inserted",
	"Device Removed",
	"Reading Error",
	"Writing Error",
	"ATA Ecc Error",
	"Change ATA Mode",
	"Time Out Error",
	"Device Failed",
	"PCI Parity Error",
	"Dev Fail (SMART)",
	"PassThrough Disk Created",
	"PassThrough Disk Modified",
	"PassThrough Disk Deleted"
};

/* strings for volumeset event */
static const char *htmVolEvent[] =
{
	"Start Initialize",
	"Start Rebuilding",
	"Start Migrating",
	"Start Checking",
	"Complete Init",
	"Complete Rebuild",
	"Complete Migrate",
	"Complete Check",
	"Create Volume",
	"Delete Volume",
	"Modify Volume",
	"Volume Degraded",
	"Volume Failed",
	"Failed Volume Revived",
	"Abort Initialization",
	"Abort Rebuilding",
	"Abort Migration",
	"Abort Checking",
	"Stop Initialization",
	"Stop Rebuilding",
	"Stop Migration",
	"Stop Checking"
};

/* strings for raidSet event */
static const char *htmRaidEvent[] =
{
	"Create RaidSet",
	"Delete RaidSet",
	"Expand RaidSet",
	"Rebuild RaidSet",
	"RaidSet Degraded"  
};

/* strings for scsi host event */
static const char *htmScsiHostEvent[] =
{
	"SCSI Bus Reset",
	"SCSI Bus Parity",
	"SCSI Bus SE<>LVD"
};

/* strings for ide host event */
static const char *htmIdeHostEvent[] =
{
	"IDE Bus Reset",
	"IDE Bus UDMA CRC",
	"SCSI Bus SE<>LVD"
};

/* strings for hardware monitor event */
static const char *htmHwMonEvent[] =
{
	"DRAM 1-Bit ECC",					
	"DRAM Fatal Error",		

	"Controller Over Temperature",		
	"Backplane Over Temperature",		
	"1.5V Abnormal",
	"3.3V Abnormal",
	"5V Abnormal",
	"12V Abnormal",
	"1.3V Abnormal",
	"2.5V Abnormal",
	"1.2V or 1.8V or 1.25V Abnormal",
	"Power#1 Failed  ",
	"Fan#1 Failed    ",
	"Power#2 Failed  ",
	"Fan#2 Failed    ",
	"Power#3 Failed  ",
	"Fan#3 Failed    ",
	"Power#4 Failed  ",
	"Fan#4 Failed    ",
	"UPS ACPower Loss",  

	"Controller Over Temperature Recovered",
	"Backplane Over Temperature Recovered",
	"1.5V Abnormal Recovered",
	"3.3V Abnormal Recovered",
	"5V Abnormal Recovered",
	"12V Abnormal Recovered",
	"1.3V Abnormal Recovered",
	"2.5V Abnormal Recovered",
	"1.2V or 1.8V or 1.25V Abnormal Recovered",
	"Power#1 Failed Recovered",
	"Fan#1 Failed Recovered",
	"Power#2 Failed Recovered",
	"Fan#2 Failed Recovered",
	"Power#3 Failed Recovered",
	"Fan#3 Failed Recovered",
	"Power#4 Failed Recovered",
	"Fan#4 Failed Recovered",
	"UPS ACPower Loss Recovered",

	"Raid Powered On",
	"Test Event",
	"Power On With Battery Backup"
};

/* strings for new events */
static const char *htmNewEventStr[] =
{
	"Recovered",
	"Over Temp.",
	"Failed",
	"Under Voltage",
	"Over Voltage",
	"Discovered",
	"Lost Rebuilding/Migration LBA",
	"Offlined",
	"HTTP Log In",
	"Telnet Log In",
	"VT100 Log In",
	"API Log In",
	"FC Link Up",
	"FC Link Down",
    "In U160 Mode",
    "Restart Init LBA Point",
	"Restart Rebuild LBA Point",
	"Restart Migration LBA Point",	

	"One BIT ECC Error",	
	"Multi BIT ECC Error",	
	"Off",
	"Unknown Error",	
	"Added",
	"Removed"
};




/* event notification level*/
enum _EVT_LEVEL
{
	EVT_DISABLE = 0,
	EVT_SERIOUS,		// 1 serious event
	EVT_ERROR,			// 2 error
	EVT_WARNING,		// 3 warning
	EVT_INFO			// 4 information
};

/* event notification level for raidset */
static BYTE raidEventLevel[] =
{
	EVT_WARNING,			//RS_EVT_CREATE,
	EVT_WARNING,			//RS_EVT_DELETE,
	EVT_WARNING,			//RS_EVT_EXPAND,
	EVT_WARNING,			//RS_EVT_REBUILD,
	EVT_SERIOUS				//RS_EVT_DEGRADED,
};

/* event notification level for volumeset */
static BYTE volEventLevel[] =
{
	EVT_WARNING,			//VS_EVT_INITIALIZING,
	EVT_WARNING,			//VS_EVT_REBUILDING,
	EVT_WARNING,			//VS_EVT_MIGRATING,
	EVT_WARNING,			//VS_EVT_CHECKING,
	EVT_WARNING,			//VS_EVT_COMPLETE_INIT,
	EVT_WARNING,			//VS_EVT_COMPLETE_REBUILD,
	EVT_WARNING,			//VS_EVT_COMPLETE_MIGRATING,
	EVT_WARNING,			//VS_EVT_COMPLETE_CHECKING,
	EVT_WARNING,			//VS_EVT_CREATE,
	EVT_WARNING,			//VS_EVT_DELETE,
	EVT_WARNING,			//VS_EVT_MODIFY,
	EVT_SERIOUS,			//VS_EVT_DEGRADED,
	EVT_SERIOUS,			//VS_EVT_FAILED,
	EVT_SERIOUS,			//VS_EVT_REVIVED,

	// init/rebuild/migration ABORT & STOP event
	EVT_WARNING,			//VS_EVT_ABORT_INIT,
	EVT_WARNING,			//VS_EVT_ABORT_REBUILD,
	EVT_WARNING,			//VS_EVT_ABORT_MIGRATING,
	EVT_WARNING,			//VS_EVT_ABORT_CHECKING,
	EVT_WARNING,			//VS_EVT_STOP_INIT,
	EVT_WARNING,			//VS_EVT_STOP_REBUILD,
	EVT_WARNING,			//VS_EVT_STOP_MIGRATING,
	EVT_WARNING			//VS_EVT_STOP_CHECKING,
};

/* event notification level for disk */
static BYTE devEventLevel[] =
{
	EVT_WARNING, //DEV_EVT_ADDED,
	EVT_WARNING, //DEV_EVT_REMOVED,
	EVT_WARNING, //DEV_EVT_READ_ERROR,
	EVT_WARNING, //DEV_EVT_WRITE_ERROR,
	EVT_WARNING, //DEV_EVT_ATA_ECC_ERROR,
	EVT_WARNING, //DEV_EVT_ATA_CHANGE_MODE,
	EVT_WARNING, //DEV_EVT_TIMEOUT,
	EVT_SERIOUS, //DEV_EVT_MARK_FAILED,
	EVT_ERROR,	//DEV_EVT_PCI_ERROR,
	EVT_SERIOUS, //DEV_EVT_SMART_FAILED,
	EVT_INFO,  //DEV_EVT_CREATE_PASS,
	EVT_INFO,  //DEV_EVT_MODIFY_PASS,
	EVT_INFO,  //DEV_EVT_DELETE_PASS,
};

/* event notification level for host */
static BYTE hostEventLevel[] =
{
	EVT_INFO, //SCSI_EVT_RESET,
	EVT_INFO, //SCSI_EVT_PARITY,
	EVT_INFO //SCSI_BUS_MODE_CHANGE,
};

/* event notification level for hardware monitor */
static BYTE hwEventLevel[] =
{
	EVT_SERIOUS, //HW_EVT_SDRAM_1BIT_ECC,
	EVT_SERIOUS, //HW_EVT_SDRAM_MULTI_BIT_ECC,
	EVT_SERIOUS, //HW_EVT_TEMP_CONTROLLER,
	EVT_SERIOUS, //HW_EVT_TEMP_BACKPLANE,
	EVT_SERIOUS, //HW_EVT_VOLTAGE15,
	EVT_SERIOUS, //HW_EVT_VOLTAGE3,
	EVT_SERIOUS, //HW_EVT_VOLTAGE5,
	EVT_SERIOUS, //HW_EVT_VOLTAGE12,
	EVT_SERIOUS, //HW_EVT_VOLTAGE1_3,
	EVT_SERIOUS, //HW_EVT_VOLTAGE2_5,
	EVT_SERIOUS, //HW_EVT_VOLTAGE1_25,
	EVT_SERIOUS, //HW_EVT_POWER1_FAILED,
	EVT_SERIOUS, //HW_EVT_FAN1_FAILED,
	EVT_SERIOUS, //HW_EVT_POWER2_FAILED,
	EVT_SERIOUS, //HW_EVT_FAN2_FAILED,
	EVT_SERIOUS, //HW_EVT_POWER3_FAILED,
	EVT_SERIOUS, //HW_EVT_FAN3_FAILED,
	EVT_SERIOUS, //HW_EVT_POWER4_FAILED,
	EVT_SERIOUS, //HW_EVT_FAN4_FAILED,
	EVT_SERIOUS, //HW_EVT_UPS_POWER_LOSS,
	// Add to log H/W monitor recovered
	EVT_ERROR,	//HW_EVT_TEMP_CONTROLLER_R,
	EVT_ERROR,	//HW_EVT_TEMP_BACKPLANE_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE15_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE3_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE5_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE12_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE1_3_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE2_5_R,
	EVT_ERROR,	//HW_EVT_VOLTAGE1_25_R,
	EVT_ERROR,	//HW_EVT_POWER1_RECOVERED,
	EVT_ERROR,	//HW_EVT_FAN1_RECOVERED,
	EVT_ERROR,	//HW_EVT_POWER2_RECOVERED,
	EVT_ERROR,	//HW_EVT_FAN2_RECOVERED,
	EVT_ERROR,	//HW_EVT_POWER3_RECOVERED,
	EVT_ERROR,	//HW_EVT_FAN3_RECOVERED,
	EVT_ERROR,	//HW_EVT_POWER4_RECOVERED,
	EVT_ERROR,	//HW_EVT_FAN4_RECOVERED,
	EVT_ERROR,	//HW_EVT_UPS_POWER_RECOVERED,

	EVT_WARNING, //HW_EVT_SYSTEM_RESTARTED,
	EVT_SERIOUS, //HW_EVT_TEST_EVENT,
	// added for battery backup
	EVT_ERROR	 //HW_EVT_SYSTEM_RECOVERED,
};


/* event notification level for new event */
static BYTE newEventLevel[] =
{
	EVT_ERROR,	  // 0 GHM_RECOVER
	EVT_SERIOUS,  // 1 GHM_OVER_TEMP
	EVT_SERIOUS,  // 2 GHM_FAILED
	EVT_SERIOUS,  // 3 GHM_UNDER_VOLTAGE
	EVT_SERIOUS,  // 4 GHM_OVER_VOLTAGE
	EVT_ERROR,  // 5 GHM_DISCOVERED
	EVT_SERIOUS,  // 6 GHM_LOST_MIG
	EVT_SERIOUS,  // 7 GHM_RESTART_LBA	// not used
	EVT_ERROR,	  // 8 GHM_HTTP_LOGIN
	EVT_ERROR,	  // 9 GHM_TELNET_LOGIN
	EVT_ERROR,	  // 10 GHM_VT100_LOGIN
	EVT_ERROR,	  // 11 GHM_GUI_LOGIN
	EVT_INFO,	  // 12 GHM_FC_LINK_UP
	EVT_INFO,	  // 13 GHM_FC_LINK_DOWN

	EVT_ERROR,	  // 14 GHM_16BYTES_CDB,
	EVT_SERIOUS,    // 15 GHM_INIT_LBA,           // restart init LBA
	EVT_SERIOUS,    // 16 GHM_REBUILD_LBA,        // restart rebuild LBA
	EVT_SERIOUS     // 17 GHM_MIGRATE_LBA         // restart migration LBA

};


/* event level string */
static const char *eventWLevel[] =
{
	"DISABLE",
	"URGENT",		// EVT_SERIOUS
	"SERIOUS",		// EVT_ERROR
	"WARNING",		// EVT_WARNING
	"INFORMATIONAL"	// EVT_INFO
};



#define UPS_AC_POWER_LOSS	0x03
#define	UPS_OK				0x07


// Battery status
// 0--100 : battery charging status (percentage)
// 255 : battery not installed
// 254 : battery failed
#define BBM_NOT_INSTALLED	255
#define BBM_FAILED			254

///////////////////////////////////////////////////////////////////////////////////
//
// HWMON_ITEMS
// Indicating the ArcGetHWMon(...) how to retrieve hardware information.
//
enum
{
	HWMON_FAN_INFO = 0x01,
	HWMON_VOL_INFO,
	HWMON_TMP_INFO,
	HWMON_PWR_INFO,
	HWMON_UPS_INFO,
	HWMON_BATTERY_INFO,	//BBM(Battery Backup Module)
	HWMON_TOTAL
};

typedef struct _HWMON_INFO
{
	WORD	HwItemCount;	// item count of hardware( including fans, voltages, temperatures, powers)
	WORD	ItemInfo[50];	// item information
}sHwMonInfo, *pHwMonInfo;
///////////////////////////////////////////////////////////////////////////////////
//
//	Hardware monitor information for raid controller excepts ARC-5010 & ARC-6010.
//  ARC-5010 & ARC-6010 should use the "sHwMon5010" data structure instead.
//	Because the number of fans, voltages, temperatures and powers are differ from 
//	models of areca except the ARC-5010 & ARC-6010, so we use the flexible data 
//	structure instead for different models of areca.
//
//  Pass the flag above & pointer of the struct _HWMON_INFO to the ArcGetHWMon(...) to 
//  retrieve the hardware information.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//  For example: Retrieving hardware monitor of fans
//
//	CArclib al;
//  ARC_STATUS status;
//  sHwMonInfo	HwInfo;
//  
//	WinCommInterface *iface = new WinCommInterface();
//	if(!iface->init(0))	// init "COM1"
//		return;
//	status = al.ArcInitSession(iface);
//  if(status != ARC_SUCCESS)
//  {
//      .... handle error .....
//  }
//  status = al.ArcGetHWMon(HWMON_FAN_INFO,  &HwInfo);
//  
//  if the status = ARC_SUCCESS, then the contents of HwInfo are:
//  HwInfo.HwItemCount ==> # of fans
//  HwInfo.ItemInfo[0] ==> RPM of 1st fan
//	HwInfo.ItemInfo[1] ==> RPM of 2nd fan
//   ...
//  HwInfo.ItemInfo[HwInfo.HwItemCount - 1] ==> RPM of the last fan
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//	For example: Retrieving hardware monitor of voltage	
//	status = al.ArcGetHWMon(HWMON_VOL_INFO,  &HwInfo);
//	if the status = ARC_SUCCESS, then the contents of HwInfo are:
//	HwInfo.HwItemCount ==> # of voltage items
//	HwInfo.ItemInfo[0] ==> base value of 1st voltage
//	HwInfo.ItemInfo[1] ==> current value of 1st voltage
//	HwInfo.ItemInfo[2] ==> base value of 2nd voltage
//	HwInfo.ItemInfo[3] ==> current value of 2nd voltage
//	...
//	HwInfo.ItemInfo[HwInfo.HwItemCount * 2 - 2] ==> base value of last voltage
//	HwInfo.ItemInfo[HwInfo.HwItemCount * 2 - 1] ==> current value of last voltage
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//	For example: Retrieving hardware monitor of temperature	
//	status = al.ArcGetHWMon(HWMON_TMP_INFO,  &HwInfo);
//	if the status = ARC_SUCCESS, then the contents of HwInfo are:
//	HwInfo.HwItemCount ==> # of temperature items
//	HwInfo.ItemInfo[0] ==> controller temperature
//	HwInfo.ItemInfo[1] ==> 1st HDD temperature
//	HwInfo.ItemInfo[2] ==> 2nd HDD temperature
//	...
//	HwInfo.ItemInfo[HwInfo.HwItemCount - 1] ==> last temperature of HDD
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//	For example: Retrieving hardware monitor of power	
//	status = al.ArcGetHWMon(HWMON_PWR_INFO,  &HwInfo);
//	if the status = ARC_SUCCESS, then the contents of HwInfo are:
//	HwInfo.HwItemCount ==> # of power items
//	HwInfo.ItemInfo[0] ==> 1st power state
//	HwInfo.ItemInfo[1] ==> 2nd power state
//	...
//	HwInfo.ItemInfo[HwInfo.HwItemCount - 1] ==> last power state
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//  Note: Areca specifications
//	For fans:  the fan speed != 0 means fan ok else failed, if the speed == 0xffff then there is 
//             no fan connected.
//	For voltages: one voltage has pair values, one for base value(fixed), the other for current 
//				  voltage value		   
//				  if ( current value > base value * 1.1) or (current value < base value * 0.9)
//				  then the voltage is abnormal.
//  For temperature: Including Controller & HDD temperature, the 1st value is controller temperature 
//					 and the others are HDD temperatures.
//					 If the value over 60 degrees of centigrade, then the temperature is abnormal.
//  For power:	The value is "1" means the power Ok , "0" means failed.
//


///////////////////////////////////////////////////////////////////////////////////
//
//	Hardware monitor data structure for 5 bays machines only (ARC-5010 & ARC-6010).
//	Since the number of fans, voltages, temperatures and powers of the ARC-5010 & ARC-6010 
//  are fixed, so we can use the "fixed" data structure to retrieve hardware information.
//
typedef struct _HWMON_5010
{	
	BYTE	fans;			// # of fans
	BYTE	voltages;		// # of voltages
	BYTE	temps;			// # of temperatures ( only Controller & BackPlane )
	BYTE	powers;			// # of powers
	WORD	monFan;			// fan speed(in RPM)
	WORD	fixed12V;		// always 12000mV(12V)
	WORD	mon12V;			// current voltage of 12000mV
	WORD	fixed5V;		// always 5000mV(5V)
	WORD	mon5V;			// current voltage of 5000mV
	WORD	fixed3_3V;		// always 3300mV(3.3V)
	WORD	mon3_3V;		// current voltage of 3300mV
	WORD	fixed1_5V;		// always 1500mV(1.5V)
	WORD	mon1_5V;		// current voltage of 1500mV
	BYTE	monCtrlTemp;	// current temperature of contoller(in degrees centigrade)
	BYTE	monBkPlaneTemp;	// current temperature of backplane(in degrees centigrade)
	BYTE	reserved[2];	// not use
} sHwMon5010, *pHwMon5010;



///////////////////////////////////////////////////////////////////////////////////
//
//	Volumeset capabilities pass into ArcCreateVolSet(...)
//
typedef struct _VOLUMESET_CAP
{
	DWORD	structs_size;	// size of _VOLUMESET_CAP structure
	BYTE	raid;			// RAIDSet Number that volumeset belongs to.
	char	volname[16];	// volume Set Name
	double	capacity;		// volume capacity size ( in GBs )	
	BYTE	raidlevel;		// raid level
	BYTE	stripsize;		// stripe size (0/1/2/3/4/5->4/8/16/32/64/128K)
	BYTE	channel;		// channel#
	BYTE	id;				// ID#
	BYTE	lun;			// LUN#
	BOOL	tag;			// Enable tag queue(1 : enabled)
	BOOL	cache;			// Enable cache(1 : enabled)
	BYTE	speed;			// speed (0/1/2/3/4->async/20/40/80/160 for scsi)
							// (0/1/2/3/4->33/66/100/133/150 for IDE)
	BYTE	quickinit;		//0:background init, 1:foreground init
}sVolumeSetCap, *pVolumeSetCap;		

///////////////////////////////////////////////////////////////////////////////////
//
//	New volumeset capabilities pass into ArcModifyVolSet(...)
//
typedef struct _NEW_VOLUMESET_CAP
{
	DWORD	structs_size;		// size of _NEW_VOLUMESET_CAP structure
	BYTE	vol;				// VolumeSet Number
	char	newVolname[16];		// volume Set Name
	double	newCapacity;		// volume capacity size in GBs (reserved)
	BYTE	newRaidlevel;		// raid level
	BYTE	newStripsize;		// stripe size (0/1/2/3/4/5->4/8/16/32/64/128K)
	BYTE	newChannel;			// channel#
	BYTE	newId;				// ID#
	BYTE	newLun;				// LUN#
	BYTE	newTag;				// Enable tag queue(1 : enabled)
	BYTE	newCache;			// Enable cache(1 : enabled)
	BYTE	newSpeed;			// speed (0/1/2/3/4->async/20/40/80/160 for scsi)
								// (0/1/2/3/4->33/66/100/133/150 for IDE)
}sNewVolumeSetCap, *pNewVolumeSetCap;		

///////////////////////////////////////////////////////////////////////////////////
//
//	Pass-through disk capabilities pass into ArcCreatePassthroughDisk(...)
//

#define ATA33			0
#define ATA66			1
#define ATA100			2
#define ATA133			3
#define ATA150			4

typedef struct _PASS_DISK_CAP
{
	DWORD	structs_size;	// size of _PASS_DISK_CAP structure
	BYTE	nDevNum;		// device #
	BYTE	nScsiCh;		// scsi channel (0/1)
	BYTE	nScsiId;		// scsi id (0-->15)
	BYTE	nScsiLun;		// scsi lun (0-->7)
	BYTE	nTaggedQue;		// tagged queue (1 : enabled)
	BYTE	nCache;			// cache mode (1 : enabled)
	BYTE	nMaxSpeed;		// (0/1/2/3/4, async/20/40/80/160 for scsi)
							// (0/1/2/3, 33/66/100/133 for ide)
	                        
}sPassDiskCap, *pPassDiskCap;


typedef struct _VOL_MOD
{
	BYTE	num_vol;		// volumeset# to modify 
	BYTE	newlevel;		// new raid level of volumeset
	BYTE	newstripesize;  // new stripe size of volumeset
	BYTE	reserved;		// reserved
}sVolMod, *pVolMod;

typedef struct _VOL_MOD_LIST
{
	BYTE	total_vol;		// specifies how many volumesets to modify
	sVolMod	vol_list[128];	// 
}sVolModList, *pVolModList;


#ifndef		OID
#define		OID		long
#endif


typedef struct _NET_INFO
{
	BYTE	dhcp;					// 1 for enabled, 0 for disabled
	BYTE	local_ip[4];			// for static IP
	BYTE	gateway_ip[4];			// for static gateway
	BYTE	subnet_mask[4];			// for static subnet mask
	WORD	http_port;				// current http port#
	WORD	telnet_port;			// current telnet port#
	WORD	smtp_port;				// current smtp port#	
	BYTE    current_ip[4];			// current IP address
	BYTE	mac_addr[6];			// MAC address
	BYTE	reserved[3];
}sNET_INFO, *pNET_INFO;

typedef struct _SYS_CONFIG_INFO
{
	BYTE	beeper;							// beeper setting
	BYTE	bgtask_priority;				// background task priority setting
	BYTE	jbod_raid;						// JBOD/RAID setting
	BYTE	hdd_read_ahead;					// HDD read ahead cache setting
	BYTE	stagger_power_on;				// stagger power on setting
	BYTE	auto_spin_down;					// auto spin down
	BYTE	empty_hdd_slot_led;				// empty hdd slot led setting
	BYTE	cpu_fan_detect;					// cpu fan detect
	BYTE	hdd_smart_status_polling;		// hdd smart status polling
	BYTE	auto_activate_incomplete_raid;	// auto activate incomplete raid
	BYTE	disk_write_cache;				// disk write cache
	BYTE	disk_capacity_truncation;		// disk capacity truncation
	BYTE	reserved[1];
}sSYS_CONFIG_INFO, *pSYS_CONFIG_INFO;


//	SMTP SUPPORTED
typedef struct _MAIL_ADDR
{
	BYTE    mailName[20];				// name
	BYTE    mailAddress[50];			// mail address, format: abc@company.com
} sMAIL_ADDR, *pMAIL_ADDR;

typedef struct _MAIL_CONFIG
{
	BYTE				ip[4];			// smtp server ip
	BYTE				account[50];	// account
	BYTE				password[20];	// password	
	sMAIL_ADDR          sender;			// 1 sender address
	sMAIL_ADDR          mailto[4];		// 4 mailto address
	DWORD				eventlevel;		// event notification level(MAIL)
	DWORD				notificationfornoevent;	// notify user if no event occurs within 24 hours
}sMAIL_INFO, *pMAIL_INFO;



// SNMP SUPPORTED
typedef struct _SNMP_CONFIG
{
	BYTE    ip[3][4];		// snmp trap ip 1, 2, 3
	WORD	port[3];		// snmp trap port 1, 2, 3
	BYTE	community[16];  // snmp community
	BYTE    contact[32];	// snmp sys contact
	BYTE    location[32];	// snmp sys location
	BYTE    name[32];		// snmp sys name
	DWORD	eventlevel;		// event notification level(SNMP)
	BYTE	reserved[2];	// reserved
}sSNMP_CONFIG, *pSNMP_CONFIG;



/*
typedef struct _DEVICE_PAIR
{
	BYTE nEncIndex[256];	// the Enclosure index, for non-SAS controller this field is always set to '0'
	BYTE nDrvIndex[256];	// the Drive index
}sDEVICE_PAIR, *pDEVICE_PAIR;;;
*/

typedef struct _DEVICE_LIST
{
	int	total;
	struct
	{
		BYTE nEncIndex;	// the Enclosure index, for non-SAS controller this field is always set to '0'
		BYTE nDrvIndex;	// the Drive index
	}device_pair[128];
}sDEVICE_LIST, *pDEVICE_LIST;


typedef struct _DRV_MAP
{
	int total;
	struct
	{
		BYTE encindex;
		BYTE drvindex;	
		sGUI_PHY_DRV drvInfo;
	}drv[128];
}sDRV_MAP, *pDRV_MAP;
	
typedef struct _VOL_MAP
{
	int total;
	struct
	{
		DWORD volindex;
		sGUI_VOLUMESET volInfo;
	}vol[128];
}sVOL_MAP, *pVOL_MAP;

typedef struct _RAID_MAP
{
	int total;
	struct
	{
		DWORD raidindex;
		sGUI_RAIDSET raidInfo;
	}raid[128];
}sRAID_MAP, *pRAID_MAP;


///////////////////////////////////////////////////////////////////////////////////
//
//	CArclib definitions
//	This class is exported from the Areca GUI library
// 
#ifdef _WIN32
class ARCLIB_API CArclib 
{
#else
class CArclib 
{		
#endif
// public constructors & destructors
public:
	CArclib();
	~CArclib();

// public member functions for raidsubsystem
public:
	/************************************************************************************
	Function Name:	ArcGetLibVersion
	Function:		Get the areca library version
	Input:			None.
	Output:			None.
	Return Values:	1. Library version
	Note:			None.
	************************************************************************************/
	static int ArcGetLibVersion
	(
		void
	);

	virtual ArcInterface *ArcGetInterface();
	/************************************************************************************
	Function Name:	ArcInitSession
	Function:		Startup areca library by assigning an interface to it
	Input:			1. ArcInterface
	Output:			None.
	Return Values:	1. ARC_STATUS					
	Note:			This function should be called before any member functions be called
	************************************************************************************/	
	virtual ARC_STATUS ArcInitSession
	(
		IN ArcInterface *Interface
	);

	/************************************************************************************
	Function Name:	ArcGetSysInfo
	Function:		Get the RAID system information
	Input:			None.
	Output:			1. Pointer to a sSYSTEM_INFO structure that receives the information.					   
	Return Values:	1. ARC_STATUS
	Note:			1. The memory allocation of the sSYSTEM_INFO structure is the 
	                   responsibility of the calling function.		
	************************************************************************************/
	virtual ARC_STATUS ArcGetSysInfo
	(
		OUT pSYSTEM_INFO  pSysInfo
	);

	/************************************************************************************
	Function Name:	ArcGetRaidSetInfo
	Function:		Get the RaidSet information
	Input:			1. RaidSet number 					
	Output:			1. Pointer to a sGUI_RAIDSET structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. RaidSet number is started from 0 to sSYSTEM_INFO.gsiMaxRaidSet
	                2. The memory allocation of the sGUI_RAIDSET structure is the 
	                   responsibility of the calling function.
	************************************************************************************/
	virtual ARC_STATUS ArcGetRaidSetInfo
	(
		IN	BYTE iRaidNumber, 
		OUT pGUI_RAIDSET pRaidInfo		
	);

	/************************************************************************************
	Function Name:	ArcGetVolSetInfo
	Function:		Get the VolumeSet information
	Input:			1. VolumeSet number					
	Output:			1. Pointer to a sGUI_VOLUMESET structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. VolumeSet number is started from 0 to sSYSTEM_INFO.gsiMaxVolumeSet
	                2. The memory allocation of the sGUI_VOLUMESET structure is the 
	                   responsibility of the calling function.
	************************************************************************************/
	virtual ARC_STATUS ArcGetVolSetInfo
	(
		IN	BYTE iVolNumber, 
		OUT pGUI_VOLUMESET pVolSet
	);

	/************************************************************************************
	Function Name:	ArcGetPhysicalDriveInfo
	Function:		Get the physical drive information
	Input:			1. nDrvNum: Physical dirve number	                
	Output:			1. Pointer to a sGUI_PHY_DRV structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. Drive number is started from 0 to sSYSTEM_INFO.gsiIdeChannels
	                2. The memory allocation of the sGUI_PHY_DRV structure is the 
	                   responsibility of the calling function.
	************************************************************************************/
	virtual ARC_STATUS ArcGetPhysicalDriveInfo
	(
		IN	BYTE nDrvNum, 
		OUT	pGUI_PHY_DRV pPhyDrv
	);	

	/************************************************************************************
	Function Name:	ArcGetHWMon
	Function:		Get the H/W monitor status
	Input:			1. Hardware monitor item 
	Output:			1. Pointer to a sHwMonInfo structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. HwItem is described by HWMON_ITEMS
	                2. The memory allocation of the sHwMonInfo structure is the 
	                   responsibility of the calling function.
	************************************************************************************/
	virtual ARC_STATUS ArcGetHWMon
	( 
		IN	DWORD HwItem, 
		OUT	pHwMonInfo pHwInfo 
	);

	/************************************************************************************
	Function Name:	ArcGetHWMon5010
	Function:		Get the H/W monitor status for 5010 & 6010 controller only
	Input:			None.
	Output:			1. Pointer to a sHwMon5010 structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. The memory allocation of the sHwMon5010 structure is the 
	                   responsibility of the calling function.
	************************************************************************************/
	virtual ARC_STATUS ArcGetHWMon5010
	( 
		OUT pHwMon5010 pHwMon 
	);

	/************************************************************************************
	Function Name:	ArcSetSerial
	Function:		Set serial number of RAID subsystem
	Input:			1. Serial number(null terminate), Max 16 characters
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetSerial
	(
		IN char *szSerialNumber
	);

	/************************************************************************************
	Function Name:	ArcSetVendor
	Function:		Set vendor string of RAID subsystem
	Input:			1. Vendor string(null-terminated), Max 40 characters
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetVendor
	(
		IN char *szVerdorName
	);

	/************************************************************************************
	Function Name:	ArcSetModel
	Function:		Set model string of RAID subsystem
	Input:			1. Model string(null-terminated), Max 8 characters
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetModel
	(
		IN char *szModelName
	);

	/************************************************************************************
	Function Name:	ArcGetIdentifyString
	Function:		Get controller identify string
	Input:			None.
	Output:			1. Pointer to a buffer that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			1. The memory allocation of the buffer is the responsibility of the 
	                   calling function and the buffer must be >= 44 bytes 
	************************************************************************************/
	virtual ARC_STATUS ArcGetIdentifyString
	(
		OUT char *strBuf
	);

	/************************************************************************************
	Function Name:	ARC_STATUS ArcIdentify(void)
	Function:		Identify controller
	Input:			None
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:			1. If ARC_STATUS == ARC_SUCCESS then the controller found else
	                   no controller found.
	************************************************************************************/
	virtual ARC_STATUS ArcIdentify
	(
		void
	);

	/************************************************************************************
	Function Name:	ArcMuteBeeper
	Function:		Mute the beeper
	Input:			None
	Output:			None
	Return Values:	1. ARC_STATUS 				
	Note:			1. Password required if password enabled, use ArcChkPassword(...)
					   to validate the password.						
	************************************************************************************/
	virtual ARC_STATUS ArcMuteBeeper
	( 
		void 
	);

	/************************************************************************************
	Function Name:	ArcSetBeeper
	Function:		Set the Beeper state
	Input:			1. DISABLE or ENABLE
	Output:			None
	Return Values:	1. ARC_STATUS  				
	Note:			1. Password required if password enabled, use ArcChkPassword(...)
					   to validate the password.
	************************************************************************************/
	virtual ARC_STATUS ArcSetBeeper
	(
		IN BYTE bSetting
	);

	/************************************************************************************
	Function Name:	ArcSetMacAddr
	Function:		Set MAC Address of RAID subsystem if ethernet supported
	Input:			1. Standard MAC Address format, must be 6 byte characters.
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:			1. Example of MAC Address format, 
	                   char mac[6] = { 0x00, 0x04, 0xD9, 0x60, 0x00, 0x00 };
	************************************************************************************/
	virtual ARC_STATUS ArcSetMacAddr
	(
		IN char *MacAddress
	);

	/************************************************************************************
	Function Name:	ArcSetLogo
	Function:		Set the OEM logo
	Input:			1. The buffer contains the context of the image( .jpg or .gif )
					2. The actually size of image, not the buffer size.
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:			1. Image size must be <= 7998 bytes
					2. The sequences of set logo:
					   2a. Read the image file from disk into the buffer that calling
					       function allocated.
					   2b. Pass the buffer and image size as the parameter into the 
					       member function ArcSetLogo(...)
	************************************************************************************/
	virtual ARC_STATUS ArcSetLogo
	(
		IN char *imageBuf, 
		IN int imageSize
	);

	/************************************************************************************
	Function Name:	ArcSetTime
	Function:		The ArcSetTime method synchronizes the RAID subsystem data-time with 
	                the host date-time.
	Input:			None
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:			None
	************************************************************************************/
	virtual ARC_STATUS ArcSetTime
	(
		void 
	);

	/************************************************************************************
	Function Name:	ArcSNMP
	Function:		Query SNMP value with SNMP standard message ( BER encoding )
	Input:			1. SNMP Message ( BER encoding )
					2. Length of SNMP Message
	Output:			1. SNMP Message returned from RAID subsystem ( BER encoding )
					2. The length of returning SNMP message
	Return Values:	1. ARC_STATUS
	Note:			1. This member function is available if sSYSTEM_INFO.gsiRs232Snmp were true.
	************************************************************************************/
	virtual ARC_STATUS ArcSNMP
	(
		IN	char *SNMPMsg, 
		IN	int length, 
		OUT	char *SNMPResponse, 
		OUT	int *ResLength
	);

	/************************************************************************************
	Function Name:	ArcSNMPWithOid
	Function:		Query SNMP value with OID name
	Input:			1. The OID from the NMS Request
					2. Length of OID( both OID-IN and OID-OUT )
					3. Community string
					4. Exact ( if exact == 1 then SNMPGET else SNMPGETNEXT  )
	Output:			1. The OID returned from RAID-Subsystem 
					2. SNMP tag of the returning value
					3. The answer of this OID
					4. The length of this answer
	Return Values:	1. ARC_STATUS
	Note:			1. This member function is available if sSYSTEM_INFO.gsiRs232Snmp were true.
	                2. That length serve as a dual purpose in both IN and OUT.
					3. The calling thread has the responsibility of freeing memory of var
					   which allocates by ArcSNMPWithOid(...)
	************************************************************************************/
	virtual ARC_STATUS ArcSNMPWithOid
	(
		IN	OID	*oid, 
		IN OUT int	*length, 
		IN  unsigned char *szCommunity,
		OUT OID	*ret_oid, 
		OUT	unsigned char *tag, 
		OUT	unsigned char **var,
		OUT	int		*var_len,
		IN unsigned char exact = 0 // default SNMPGETNEXT
	);

	/************************************************************************************
	Function Name:	ArcSetPassword
	Function:		Set the password of the RAID Subsystem
	Input:			1. New password with null-terminated
	Output:			None.  
	Return Values:	1. ARC_STATUS
	Note:			1. New password string must be <= 15 characters	
	************************************************************************************/
	virtual ARC_STATUS ArcSetPassword
	(
		IN char *szNewPasswordString
	);  

	/************************************************************************************
	Function Name:	ArcSetHostMode
	Function:		Set host mode
	Input:			0->Independent(RAID), 1->cluster(JBOD)
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcSetHostMode
	(
		IN BYTE bHostMode
	);

	/************************************************************************************
	Function Name:	ArcSetRebuildPriority
	Function:		Rebuild priority setting
	Input:			0/1/2/3 (low->high)
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcSetRebuildPriority
	(
		IN BYTE bPriority
	);

	/************************************************************************************
	Function Name:	ArcSetMaxAtaMode
	Function:		Set max ATA or SATA mode
	Input:			IDE_SPEED_33 / IDE_SPEED_66 / IDE_SPEED_100 / IDE_SPEED_133 for IDE
	                SATA_SPEED_150 / SATA_SPEED_150NCQ / SATA_SPEED_300 / SATA_SPEED_300NCQ for SATA
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcSetMaxAtaMode
	(
		IN BYTE bMode
	);

	/************************************************************************************
	Function Name:	ArcSetDhcpIp
	Function:		Set DHCP and IP
	Input:			1. 0:dhcp disabled, 1:dhcp enabled
					2. Null-terminated character string representing a number expressed in the Internet standard "."
					   (dotted) notation, format: "xxx.xxx.xxx.xxx" ex: 192.168.001.100
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcSetDhcpIp
	(
		IN BYTE bDhcp, 
		IN PBYTE szIp
	);

	/************************************************************************************
	Function Name:	ArcSetRaidTermPort
	Function:		Set Raid Terminal Port
	Input:			1. 0->COMA (term port), 1->COMB (debug port)
					2. 0/1/2/3/4/5/6/7 (1200/2400/4800/9600/19200/38400/57600/115200)
					3. stop bit (0:1, 1:2 stop bits)
	Output:			None.  
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcSetTermPort
	(
		IN BYTE nPort, 
		IN BYTE nBaudRate, 
		IN BYTE nStopBit
	);

	/************************************************************************************
	Function Name:	ArcChkPassword
	Function:		Pass the password that user input to RAID Subsystem
	Input:			1. Password with null-terminated
	Output:			None.	
	Return Values:	1. ARC_STATUS
	Note:			1. Password string must be <= 15 characters	
	************************************************************************************/
	virtual ARC_STATUS ArcChkPassword
	(
		IN char *szPassword
	);

	/************************************************************************************
	Function Name:	ArcLogOut
	Function:		Logout GUI (force password checking on next command)
	Input:			None.
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcLogOut
	( 
		void 
	);

	/************************************************************************************
	Function Name:	ArcHttp
	Function:		Translates the HTTP data between BROWSER and RAID Subsystem
	Input:			1. HTTP data from browser( HTML format )
					2. The length of the HTTP data from browser
	Output:			1. The HTTP data returned from RAID subsystem ( HTML format)
					2. The Length of the returning HTTP data
	Return Values:	1. ARC_STATUS
	Note:			1. Sequence of translation.
					   1a. Setup the sockets for waiting connection from remote side.
					   1b. Receive the HTTP data from remote side.
					   1c. Pass the received data and length into ArcHttp.
					   1d. Send the HTTP data returned from RAID subsystem back to remote side.
	************************************************************************************/
	virtual ARC_STATUS ArcHttp
	(
		IN	char *pClientHttpData, 
		IN	int nClientHttpDataSize, 
		OUT	char *pRaidReturnHttp, 
		OUT	int *nRaidReturnSize
	);

	/************************************************************************************
	Function Name:	ArcPollEvent
	Function:		Get the current index of event object in the RAID subsystem
	Input:			None.
	Output:			1. Pointer to an INTEGER to save the index of current event object
	Return Values:	1. ARC_STATUS
	Note:			1. There are 64 event objects inside the RAID subsystem
	************************************************************************************/
	virtual ARC_STATUS ArcPollEvent
	(
		OUT int *nCurrentEvtIndex
	);

	/************************************************************************************
	Function Name:	ArcGetReqEventPage
	Function:		Get the specific number of event pages from RAID subsystem
	Input:			1. The flag to indicate how to retrieve the event object(s), 
	                   this parameter can be one of the following values:
					   1a. FLAG_ALL, retrieve all event objects inside the RAID subsystem
					   1b. FLAG_NEW, retrieve only new event objects
	Output:			1. Number of event objects we retrieved
	Return Values:	1. ARC_STATUS	
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcGetReqEventPage
	(
		IN	char bFlag, 	
		OUT int *iCount
	);

	/************************************************************************************
	Function Name:	ArcGetEventObject
	Function:		Get the individual event object
	Input:			1. Event object index 
	Output:			1. Pointer to an sEVENT_DATA to save the current event object
	Return Values:	1. boolean value, > 0 means successed
	Note:			1. 
	************************************************************************************/
	virtual BOOL ArcGetEventObject
	(
		IN	int nEvtNum, 
		OUT	pEVENT_DATA pEventObject
	);

	/************************************************************************************
	Function Name:	ArcClearEvent
	Function:		Clear all event buffer in the RAID subsystem
	Input:			None.
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcClearEvent
	( 
		void 
	);

	/************************************************************************************
	Function Name:	ArcCreateRaidSet
	Function:		Create RaidSet
	Input:			1. Device mask, bit0 -- drive 0, bit1 -- drive 1 ....
					   ex: Device mask = 0x0000000F means that create raidset with device 0,1,2 and 3
					2. RaidSet name ( <= 16 chars with null-terminated )
	Output:			None.	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateRaidSet
	(
		IN DWORD nDevMask, 
		IN char *szRaidName
	);
	

	/************************************************************************************
	Function Name:	ArcDelRaidSet
	Function:		Delete the particular RaidSet
	Input:			1. RaidSet number to specify which one to be deleted
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDelRaidSet
	(
		IN char nRaidNum
	);

	/************************************************************************************
	Function Name:	ArcExpandRaidSet
	Function:		Expand RaidSet with volumeset(s) modification
	Input:			1. RaidSet number to specify which one to be expanded
					2. Device mask(see ArcCreateRaidSet(...))
					3. The volumeset(s) will be modified 
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcExpandRaidSet
	( 
		IN	BYTE nRaidNum, 
		IN	DWORD nDevMask,
		IN	pVolModList	volmodlist = NULL
	);


	/************************************************************************************
	Function Name:	ArcActiveRaidSet
	Function:		Activate incomplete raid set
	Input:			1. RaidSet number to specify which one to be activated
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcActiveRaidSet
	(
		IN	BYTE nRaidNum
	);

	/************************************************************************************
	Function Name:	ArcCreateHotSpare
	Function:		Create Hot Spare Disk
	Input:			1. Device mask( see ArcCreateRaidSet(...))
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateHotSpare
	(
		IN DWORD nDevMask
	);

	/************************************************************************************
	Function Name:	ArcDeleteHotSpare
	Function:		Delete Hot Spare Disk
	Input:			1. Device mask(see ArcCreateRaidSet(...))
	Output:			None.		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDeleteHotSpare
	(
		IN DWORD nDevMask
	);	

	/************************************************************************************
	Function Name:	ArcCreateVolSet
	Function:		Create VolumeSet
	Input:			1. Pointer to a sVolumeSetCap structure that uses to create VolumeSet
	                2. Specifies the type to create over 2TB volumeset.
					   TYPE_64BIT_LBA: 64bitLBA(default), TYPE_4K_FOR_WIN: 4KByte for Windows
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateVolSet
	(
		IN pVolumeSetCap pVol,
		IN BYTE Over2TBType = TYPE_64BIT_LBA
	);

	/************************************************************************************
	Function Name:	ArcModifyVolSet
	Function:		Modify VolumeSet
	Input:			1. Pointer to a sNewVolumeSetCap structure that uses to modify VolumeSet
	Output:			None.  				
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcModifyVolSet
	(
		IN pNewVolumeSetCap pNewVol
	);

	/************************************************************************************
	Function Name:	ArcDelVolSet
	Function:		Delete VolumeSet
	Input:			1. VolumeSet number to specify which one to be deleted
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDelVolSet
	(
		IN BYTE nVolNum
	);

	/************************************************************************************
	Function Name:	ArcStartCheckVolume
	Function:		Start volume consistency check
	Input:			1. Volume number to specify which one be checked
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcStartCheckVolume
	(
		IN BYTE nVolNum
	);

	/************************************************************************************
	Function Name:	ArcStopCheckVolume
	Function:		Stop volume consistency check
	Input:			None.
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcStopCheckVolume
	(
		void
	);

	/************************************************************************************
	Function Name:	ArcCreatePassthroughDisk
	Function:		Create pass-through disk
	Input:			1. Pointer to a sPassDiskCap structure that uses to create pass-through Disk
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreatePassthroughDisk
	(
		IN pPassDiskCap pDisk
	);

	/************************************************************************************
	Function Name:	ArcModifyPassthroughDisk
	Function:		Modify pass-through disk
	Input:			1. Pointer to a sPassDiskCap structure that uses to create pass-through Disk
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcModifyPassthroughDisk
	(
		IN pPassDiskCap pNewDiskCap
	);

	/************************************************************************************
	Function Name:	ArcDelPassthroughDisk
	Function:		Delete the pass-through disk
	Input:			1. Disk number specify which one to be deleted
	Output:			None.  				
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDelPassthroughDisk
	(
		IN BYTE nDrvNum
	);


	/************************************************************************************
    Function Name:	ArcIdentifyDisk
    Function:		Identify the disk
    Input:			1. Device mask(see ArcCreateRaidSet(...))
    Output:			None.  	
    Return Values:	1. ARC_STATUS
    Note:			1. Set the Device mask to zero to stop the disk identifying.
	                2. Password required if password enabled	                
	************************************************************************************/
    virtual ARC_STATUS ArcIdentifyDisk
    (
        IN DWORD nDriveMask
    );

	/************************************************************************************
	Function Name:	ArcResetController
	Function:		Restart controller
	Input:			None.
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
					2. After restart controller, it is essential to wait controller to 
					   get ready, the time may be 10~60 seconds depends on the models
	************************************************************************************/
	virtual ARC_STATUS ArcResetController( void );	
	
	/************************************************************************************
	Function Name:	ArcUpdateFirmware
	Function:		Update firmware
	Input:			1. The buffer contains the binary data of the firmware
					2. The actually size of firmware, not the buffer size
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:
	************************************************************************************/
	virtual ARC_STATUS ArcUpdateFirmware
	(
		IN char *fileBuf, 
		IN int fileSize
	);	
	
	/************************************************************************************
	Function Name:	ArcUpdateFirmware
	Function:		Update firmware
	Input:			1. The path that point to a firmware binary file				
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:
	************************************************************************************/
	virtual ARC_STATUS ArcUpdateFirmware
	(
		IN char *szFilePath
	);	

	/************************************************************************************
	Function Name:	ArcGetOnBoardNetInfo
	Function:		Get On-Board network information
	Input:			1. Pointer to a sNET_INFO structure that receives the information.
	Output:			None
	Return Values:	1. ARC_STATUS
	Note:
	************************************************************************************/
	virtual ARC_STATUS ArcGetOnBoardNetInfo
	(
		OUT pNET_INFO pNetInfo
	);


	/************************************************************************************
	Function Name:	ArcGetSystemConfigInfo
	Function:		Get the system configurations
	Input:			None.
	Output:			1. Pointer to a sSYS_CONFIG_INFO structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcGetSystemConfigInfo
	(
		OUT pSYS_CONFIG_INFO pSysCfgInfo
	);


	/************************************************************************************
	Function Name:	ArcSetStaggerPowerOn
	Function:		Set stagger poweron mode
	Input:			1. Mode of the stagger poweron
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetStaggerPowerOn
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetDiskCache
	Function:		Set disk cache mode
	Input:			1. Mode of disk cache
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetDiskCache
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetHddReadAhead
	Function:		Set HDD read-ahead mode
	Input:			1. Mode of HDD read-ahead
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetHddReadAhead
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetTruncateMode
	Function:		Set truncate mode
	Input:			1. Mode of truncate
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetTruncateMode
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetHTTPPort
	Function:		Set HTTP port
	Input:			1. HTTP port number
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetHTTPPort
	(
		IN WORD nPort
	);


	/************************************************************************************
	Function Name:	ArcSetTelnetPort
	Function:		Set telnet port
	Input:			1. Telnet port number
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetTelnetPort
	(
		IN WORD nPort
	);


	/************************************************************************************
	Function Name:	ArcSetSMTPPort
	Function:		Set SMTP port
	Input:			1. SMTP port number
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetSMTPPort
	(
		IN WORD nPort
	);

	/************************************************************************************
	Function Name:	ArcSetAutoActivate
	Function:		Set Auto-Activate
	Input:			1. Mode of auto-activate
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetAutoActivate
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetSMARTHddPoll
	Function:		Set SMART HDD Poll Mode
	Input:			1. Mode of SMART HDD poll
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetSMARTHddPoll
	(
		IN BYTE nMode
	);
	
	/************************************************************************************
	Function Name:	ArcSetHddSpinDownMode
	Function:		Set HDD spin down Mode
	Input:			1. Mode of HDD spin down
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/	
	virtual ARC_STATUS ArcSetHddSpinDownMode
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetEmptyHddSlotLed
	Function:		Set empty HDD slot LED mode
	Input:			1. Mode of empty HDD slot LED
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetEmptyHddSlotLed
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	ArcSetCpuFanDetect
	Function:		Set CPU fan detection mode
	Input:			1. Mode of CPU detection mode
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			None.
	************************************************************************************/
	virtual ARC_STATUS ArcSetCpuFanDetection
	(
		IN BYTE nMode
	);

	/************************************************************************************
	Function Name:	IsEnclosure
	Function:		
	Input:			None
	Output:			None
	Return Values:	'true' if the target subsystem is an Enclosure.
	Note:
	************************************************************************************/
	BOOL IsEnclosure();


	/************************************************************************************
	Function Name:	ArcGetEnclosureProperty
	Function:		Get the Enclosure property
	Input:			1. encnum: Enclosure#	                
	Output:			1. Pointer to a sGUI_ENC_PROPERTY structure that receives the information.
	Return Values:	ARC_STATUS
	Note:
	************************************************************************************/
	virtual ARC_STATUS ArcGetEnclosureProperty
	(
		IN BYTE nEncnum, 
		OUT pGUI_ENC_PROPERTY pEncProperty
	);

	/************************************************************************************
	Function Name:	ArcGetEnclosureDescriptor
	Function:		Get the Enclosure descriptor
	Input:			1. nEncnum: Enclosure#
	                2. nItem: see 'enum _SAS_HW' 
					3. nBufsize: the size of output buffer
	Output:			1. pDescbuf: Pointer to a buffer that receives the item descriptor.
	Return Values:	ARC_STATUS
	Note:
	************************************************************************************/	
	virtual ARC_STATUS ArcGetEnclosureDescriptor
	(
		IN BYTE nEncnum, 
		IN BYTE nItem, 
		OUT BYTE *pDescbuf, 
		IN int nBufsize
	);


	/************************************************************************************
	Function Name:	ArcGetEnclosureHwMonitor
	Function:		Get the Enclosure H/W monitor
	Input:			1. nEncnum: Enclosure#	                
	Output:			1. Pointer to a sSENSORS structure that receives the information.
	Return Values:	ARC_STATUS
	Note:
	************************************************************************************/	
	virtual ARC_STATUS ArcGetEnclosureHwMonitor
	(
		IN BYTE nEncnum, 
		OUT pSENSORS pHwInfo
	);

	/************************************************************************************
	Function Name:	ArcGetPhysicalDriveInfo
	Function:		Get the physical drive information
	Input:			1. nEncnum: Enclosure#
					2. nDrvnum: Drive# in Enclsoure#
	Output:			1. Pointer to a sGUI_PHY_DRV structure that receives the information.
	Return Values:	1. ARC_STATUS
	Note:			
	************************************************************************************/
	virtual ARC_STATUS ArcGetPhysicalDriveInfo
	(		
		IN BYTE nEncnum, 
		IN BYTE nDrvnum, 
		OUT	pGUI_PHY_DRV pPhyDrv	
	);

	/************************************************************************************
	Function Name:	ArcCreateRaidSet
	Function:		Create RaidSet
	Input:			1. pDevPairList: Pointer to a sDEVICE_LIST structure containing a list
					   of devices
				    2. RaidSet name ( <= 16 chars with null-terminated )

	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateRaidSet
	(
		IN pDEVICE_LIST pDevPairList,
		IN char *szRaidName
	);

	
	/************************************************************************************
	Function Name:	ArcExpandRaidSet
	Function:		Expand RaidSet With Volumeset(s) Modification
	Input:			1. RaidSet number to specify which one to be expanded
					2. pDevPairList: Pointer to a sDEVICE_LIST structure containing a list
					   of devices					
					3. The volumeset(s) that will be modified 
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcExpandRaidSet
	( 
		IN BYTE nRaidNum, 
		IN pDEVICE_LIST pDevPairList,
		IN pVolModList	volmodlist = NULL
	);

	/************************************************************************************
	Function Name:	ArcCreateHotSpare
	Function:		Create Hot Spare Disk
	Input:			1. pDevPairList: Pointer to a sDEVICE_LIST structure containing a list
					   of devices					
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateHotSpare
	(
		IN pDEVICE_LIST pDevPairList
	);

	/************************************************************************************
	Function Name:	ArcDeleteHotSpare
	Function:		Delete Hot Spare Disk
	Input:			1. pDevPairList: Pointer to a sDEVICE_LIST structure containing a list
					   of devices	
	Output:			None.		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDeleteHotSpare
	(
		IN pDEVICE_LIST pDevPairList
	);
	
	/************************************************************************************
	Function Name:	ArcCreatePassthroughDisk
	Function:		Create Pass-Through Disk
	Input:			1. nEncnum: Enclosure#
					2. nDrvnum: Drive# in Enclsoure#
					3. pDisk: Pointer to a sPassDiskCap structure that uses to create pass-through Disk
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. This function use the nDrvnum instead of pDisk->nDevNum
					2. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreatePassthroughDisk
	(
		IN BYTE nEncnum, 
		IN BYTE nDrvnum,
		IN pPassDiskCap pDisk
	);

	/************************************************************************************
	Function Name:	ArcModifyPassthroughDisk
	Function:		Modify Pass-Through Disk
	Input:			1. nEncnum: Enclosure#
					2. nDrvnum: Drive# in Enclsoure#
					3. pNewDiskCap: Pointer to a sPassDiskCap structure that uses to create pass-through Disk
	Output:			None.
	Return Values:	1. ARC_STATUS
	Note:			1. This function use the nDrvnum instead of pNewDiskCap->nDevNum
					2. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcModifyPassthroughDisk
	(
		IN BYTE nEncnum, 
		IN BYTE nDrvnum, 
		IN pPassDiskCap pNewDiskCap
	);

	/************************************************************************************
	Function Name:	ArcDelPassthroughDisk
	Function:		Delete Pass-Through Disk
	Input:			1. nEncnum: Enclosure#
					2. nDrvnum: Drive# in Enclsoure#
	Output:			None.  				
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcDelPassthroughDisk
	(
		IN BYTE nEncnum, 
		IN BYTE nDrvnum
	);


	/************************************************************************************
    Function Name:	ArcSASIdentifyDisk
    Function:		Identify the disk
    Input:			1. nTarget: The target to be identified.
	                2. nEncnum: Enclosure#
					3. nDrvnum: Drive# in Enclsoure#
    Output:			None.  	
    Return Values:	1. ARC_STATUS
    Note:			1. Set the Device mask to zero to stop the disk identifying.
	                2. Password required if password enabled	                
	************************************************************************************/


	enum _IDENTIFY_TARGET
	{
		TARGET_DRIVE = 0,	// the target is disk
		TARGET_ENCLOSURE,	// the target is enclosure
		TARGET_OFF,			// end identifying
		TARGET_ALL
	};
    virtual ARC_STATUS ArcSASIdentifyDisk
    (
		IN BYTE	nTarget,
        IN BYTE nEncnum = 0xFF, 
		IN BYTE nDrvnum = 0xFF
    );	

	

	/************************************************************************************
	Function Name:	ArcCreateVolSetR5060
	Function:		Create Raid30/50/60 VolumeSet
	Input:			1. nRaidNumber: Number of RaidSets use to create Raid30/50/60
	                   VolumeSet
	                2. nRaidArray: Pointer to an array containing index of RaidSets
	                3. Pointer to a sVolumeSetCap structure that uses to create VolumeSet
	                4. Specifies the type to create over 2TB volumeset.
					   TYPE_64BIT_LBA: 64bitLBA(default), TYPE_4K_FOR_WIN: 4KByte for Windows
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcCreateVolSetR5060
	(
		IN BYTE nRaidNumber,
		IN BYTE nRaidArray[],
		IN pVolumeSetCap pVol,
		IN BYTE Over2TBType = TYPE_64BIT_LBA
	);


	//////////////////////////////////////////
	//////    MAIL   Functions    ////////////
	//////////////////////////////////////////

	/************************************************************************************
	Function Name:	ArcGetMailInfo
	Function:		Get the mail notification information
	Input:			None.
	Output:			1. Pointer to a sMAIL_INFO structure that receives the information.
	Return Values:	ARC_STATUS
	Note:
	************************************************************************************/	
	virtual ARC_STATUS ArcGetMailInfo
	(		
		OUT pMAIL_INFO pMailInfo
	);

	virtual ARC_STATUS	ArcSetMailSmtpIp
	(
		IN char *szSmtpIp	// format: string with null-terminated "192.168.0.1"
	);

	virtual ARC_STATUS	ArcSetMailSmtpLoginAccount
	(
		IN char *szName,			// SMTP server login name
		IN char *szPassword			// SMTP server login password
	);

	enum _MAIL_ADDR_ITEM
	{
		MAIL_ITEM_SENDER,			
		MAIL_ITEM_MAILTO1,			
		MAIL_ITEM_MAILTO2,
		MAIL_ITEM_MAILTO3,
		MAIL_ITEM_MAILTO4,
		TOTAL_MAIL_ITEM
	};

	virtual ARC_STATUS	ArcSetMailAddr
	(
		IN DWORD	  nItem,	// enum _MAIL_ADDR_ITEM
		IN pMAIL_ADDR pMail
	);

	virtual ARC_STATUS	ArcSetMailEvtLevel
	(
		DWORD	nEvtLevel	// enum _EVT_LEVEL
	);

	virtual ARC_STATUS	ArcSetMailNoEvtFor24Hours
	(
		DWORD	nNotificationForNoEvent	// default enabled
	);



//////////////////////////////////////////////
//////////    SNMP   Functions    ////////////
//////////////////////////////////////////////

	/************************************************************************************
	Function Name:	ArcGetSnmpInfo
	Function:		Get the SNMP notification information
	Input:			None.
	Output:			1. Pointer to a sSNMP_CONFIG structure that receives the information.
	Return Values:	ARC_STATUS
	Note:
	************************************************************************************/	
	virtual ARC_STATUS ArcGetSnmpInfo
	(		
		OUT pSNMP_CONFIG pSnmpInfo
	);


	enum _SNMP_TRAP_IP_ITEM
	{
		SNMP_TRAP_IP1,
		SNMP_TRAP_IP2,
		SNMP_TRAP_IP3,
		TOTAL_SNMP_TRAP_IP
	};

	virtual ARC_STATUS ArcSetSnmpTrapIp
	(
		IN DWORD	nItem,	// enum _SNMP_TRAP_IP_ITEM
		char		*szIp
	);
	


	enum _SNMP_TRAP_PORT_ITEM
	{
		SNMP_TRAP_PORT1,
		SNMP_TRAP_PORT2,
		SNMP_TRAP_PORT3,
		TOTAL_SNMP_TRAP_PORT
	};

	virtual ARC_STATUS ArcSetSnmpTrapPort
	(
	    IN DWORD nItem,	// enum _SNMP_TRAP_PORT_ITEM
		WORD	port
	);

	virtual ARC_STATUS ArcSetSnmpCommunity
	(
		IN char	*szCommunity	// SNMP community string with null-terminated
	);

	virtual ARC_STATUS ArcSetSnmpContact
	(
		IN char	*szContact		// contact string with null-terminated
	);

	virtual ARC_STATUS ArcSetSnmpName
	(
		IN char	*szName			// name string with null-terminated
	);

	virtual ARC_STATUS ArcSetSnmpLocation
	(
		IN char	*szLocation		// location string with null-terminated
	);

	virtual ARC_STATUS	ArcSetSnmpEvtLevel
	(
		DWORD	nEvtLevel	// enum _EVT_LEVEL
	);
	
	/************************************************************************************
	Function Name:	ArcSetGatewayIp
	Function:		Set Gateway IP
	Input:			1. Null-terminated character string representing a number expressed in the Internet standard "."
					   (dotted) notation, format: "xxx.xxx.xxx.xxx" ex: 192.168.001.100
	Output:			None.  		
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS	ArcSetGatewayIp
	(
		IN char *szGatewayIp
	);

	/************************************************************************************
	Routine Name:	ArcOfflineRaidSet
	Function:		Offline the particular RaidSet
	Input:			1. RaidSet number
	Output:			None.  	
	Return Values:	1. ARC_STATUS
	Note:			1. Password required if password enabled
	************************************************************************************/
	virtual ARC_STATUS ArcOfflineRaidSet
	(
		IN char nRaidNum
	);

public:
	ARC_STATUS ArcCmdReadWrite(BYTE cmd, void *w_buf, int w_buf_len, void *r_buf, int r_buf_len, int &actual_read_size, DWORD flag = 0);

//
// helper function
//	
	ARC_STATUS ArcHelpBuildDeviceMap(sDRV_MAP *drvMap);		// enumerating disk 
	ARC_STATUS ArcHelpBuildRaidSetMap(sRAID_MAP *raidMap);	// enumerating raidset
	ARC_STATUS ArcHelpBuildVolumeSetMap(sVOL_MAP *volMap);	// enumerating volumeset

protected:	
	ARC_STATUS ArcGetEvent(char nPage);
	ARC_STATUS SetLogoPage(BYTE nPage, BYTE *Data, int len);
	ARC_STATUS ArcGetSetupPage(BYTE *buf, int bufsize);
	ARC_STATUS ArcWriteSetupData(int setupitem, char *data, int datalen);
	ARC_STATUS ArcReadSetupData(int setupitem, char *buf, int buflen, int *retlen);
	ARC_STATUS ArcGetModelNumber(DWORD *model); 
	//BOOL	ArcCkFrameValid(PBYTE frame, DWORD dwLength);
	//BYTE	CalCheckSum( PBYTE src, int len);	
	BOOL	IsValidHandle();
	int DetermineTableNumber();		
	ArcInterface *m_Interface;	// The communication path to the raid-subsystem
	sSYSTEM_INFO m_SysInfo;

private:
	// save the previous index of event
	int		m_iPreIndex;
	// save the current index of event
	int		m_iCurrentIndex;
	int		m_iNewCount;
	BYTE	*m_pEventPage;
	BYTE	*m_pEventMapping;
	int		m_iMtu;	
};

#pragma pack()

#ifdef __cplusplus
}
#endif

#endif	// # _ARCLIB_H

