#ifndef __LINUX_PASS_IOCTL_H__
#define __LINUX_PASS_IOCTL_H__


#include <iostream>
#include <pthread.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>          /* File control definitions */
#include <errno.h>          /* Error number definitions */
#include <unistd.h>         /* fork() */
#include <netinet/in.h>
#include <netdb.h>
#include <stdarg.h>
#ifdef __linux__
	#include <scsi/sg.h>
	#include <scsi/scsi.h>
	#include <scsi/scsi_ioctl.h>
	#include <sys/ipc.h>
	#include <sys/shm.h>
#endif
#include <sys/ioctl.h>
#include <unistd.h>

#include "commdef.h"
#include "interface.h"
#include "arclib.h"

#define SCSI_INQUIRY    0x12
#define SCSI_WRITE_BUF  0x3B
#define SCSI_READ_BUF   0x3C
#define	SENSE_LEN	14
#define CDB_SIZE        10
#define BUF_SIZE        2048



class LinuxPassIoctlInterface : public ArcInterface
{
public:     
	LinuxPassIoctlInterface();  
	~LinuxPassIoctlInterface();
	bool init(const int nScsiPort);
	int send(sIF_CMD_BLOCK *ifData);
	int recv(sIF_CMD_BLOCK *ifData);	
	int syncSend(sIF_CMD_BLOCK *ifData);
	void requirelock();
	void releaselock();
	BOOL ClearReadBuffer();
	BOOL ClearWriteBuffer();
	BOOL ClearReadWriteBuffer();
	int	getMTU();
	void *getDeviceHandle();
public:	
	HANDLE  m_hScsi;    
	int fd;
	pthread_mutex_t mut;
};

#endif
