// nfiletest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#include "..\lib\NFileServer.h"
/////////////////////////////////////////////////////////////////////////////
// The one and only application object

static int WINAPI m_UserCheckcallback(char *m_url,char *username,char *password)
{
	printf("user to login : %s,username:%s,psw:%s\n",m_url,username,password);
	return 0;
}

static int WINAPI searchfile(NFILE_SEARCHINFO *searchinfo,void *userdata)
{
    NFILE_FILEINFO fileinfo;
	printf("serner name : %s\n",searchinfo->sername);
	
    memset(&fileinfo,0,sizeof(NFILE_FILEINFO));
    fileinfo.channel = 0;
    fileinfo.dwFileSize = 0x12345645;
    strcpy(fileinfo.sername,"videoserver");
    strcpy(fileinfo.sFileName,"d:\\LC8000EServer_1_120351.mp4");
    fileinfo.dwRecvType = 0x01;
	searchinfo->nfileinfosend(&fileinfo,userdata);
	return 0;
}

int main(int argc, char *argv[])
{
	NFile_ServerStartup();
	NFile_ServerRegUserCheck(m_UserCheckcallback);
	NFile_ServerRegSearchCallBack(searchfile);
	NFile_ServerStartServer(NULL,3000);
	printf("net file test start...\n");
	while(1)
	{
		char cc = getchar();
		if(cc == 'x') break;
	}
	NFile_ServerStopServer();
	NFile_ServerCleanup();
	return 0;
}