//LUNetNFileServerLib.h
#ifndef __LUNETNFILESERVERLIB_H__
#define __LUNETNFILESERVERLIB_H__

#include "eti_base_def.h"
enum
{
    TIMEOPERATE_CLOSE = 0,
	TIMEOPERATE_GETFILEHEAD,
	TIMEOPERATE_GETFILESIZE,
	TIMEOPERATE_DOWN_GETDATA,
	TIMEOPERATE_PLAY_GETFRAME,
	TIMEOPERATE_PLAY_SETTIME
};

typedef struct
{
    char        sername[40];    //server name,to distinguish the different devices
    int         channel;        //channel
    int         dwRecvType;     //record type:0xff-all,0x01-manually record,0x02-timed record,0x04-video move record,0x08-sensor alarm record,
                                //0x10-video lost record,0x20-video hide record,0x40-other record
    char        sFileName[256]; //file name
    unsigned int dwFileSize;    //file size
    VSNETPLAY_NETTIME StartTime;//start time
    VSNETPLAY_NETTIME StopTime; //end time
    int         dwIsLocked;     //is file locked:0-unlocked,1-locked
    int         auxtype;        //use extra data:0-nouse,nonzero-use
    char        auxdata[64];    //extra data
}NFILE_FILEINFO;

typedef struct
{
    char        sername[40];    //server name,to distinguish the different devices
    int         channel;        //channel, all channel if -1
    int         dwFileType;     //file type:1-MP4,2-JPEG
    int         dwRecvType;     //record type:0xff-all,0x01-manually record,0x02-timed record,0x04-video move record,0x08-sensor alarm record,
                                //0x10-video lost record,0x20-video hide record,0x40-other record
    int         dwIsLocked;     //is file locked:0-unlocked,1-locked,all if 0xff
    BOOL        bTimelimite;    //is time limite
    VSNETPLAY_NETTIME StartTime;//start time
    VSNETPLAY_NETTIME StopTime; //end time
    int         auxtype;        //use extra data:0-nouse,nonzero-use
    char        auxdata[64];    //extra data
	int         (*nfileinfosend)(NFILE_FILEINFO *pfileinfo,void *userdata);
}NFILE_SEARCHINFO;

//search
typedef int(WINAPI *NFILE_SEARCHCALLBACK)(NFILE_SEARCHINFO *searchinfo,void *userdata);
//play/down by time
typedef int(WINAPI *NFILE_TIMEFILECALLBACK)(NFILE_SEARCHINFO *searchinfo, int handle);		// return zero if successful
typedef int(WINAPI *NFILE_TIMEOPERATECALLBACK)(int handle, int operate, char *pbuff, int size);	// return pbuff actual size

#ifndef CNET_APIIMPORT
#define CNET_APIIMPORT  extern "C"__declspec(dllexport)
#endif//CNET_APIIMPORT

CNET_APIIMPORT BOOL  __stdcall NFile_ServerStartup();
CNET_APIIMPORT BOOL  __stdcall NFile_ServerCleanup();
CNET_APIIMPORT BOOL  __stdcall NFile_ServerRegUserCheck(int (WINAPI *m_UserCheckcallback)(char *m_url,char *username,char *password));
CNET_APIIMPORT BOOL  __stdcall NFile_ServerRegSearchCallBack(NFILE_SEARCHCALLBACK pCallBack);
CNET_APIIMPORT BOOL  __stdcall NFile_ServerRegTimeFileCallBack(NFILE_TIMEFILECALLBACK pCallBack);
CNET_APIIMPORT BOOL  __stdcall NFile_ServerRegTimeOperateCallBack(NFILE_TIMEOPERATECALLBACK pCallBack);
CNET_APIIMPORT BOOL  __stdcall NFile_ServerStartServer(char *m_localAddrIP,WORD m_wPort);
CNET_APIIMPORT BOOL  __stdcall NFile_ServerStopServer();

#endif//__LUNETNFILESERVERLIB_H__
