⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nfsserver.h

📁 c++系统开发实例精粹内附的80例源代码 环境:windows2000,c++6.0
💻 H
字号:
//////////////////////////////////////////////////////////////////////
// FileFury
// Copyright (c) 2000 Tenebril Incorporated
// All rights reserved.
//
// This source code is governed by the Tenebril open source
// license (http://www.tenebril.com/developers/opensource/license.html)
//
// For more information on this and other open source applications,
// visit the Tenebril OpenSource page:
//       http://www.tenebril.com/developers/opensource
//
//////////////////////////////////////////////////////////////////////

#ifndef NFSSERVER_INCLUDE
#define NFSSERVER_INCLUDE

#define THREAD_DIE_WAIT            50
#define LISTEN_BUFFER              24
#define SEARCH_LISTEN_BUFFER       24
#define IM_LISTEN_BUFFER           12
#define MAX_INSTANCES              500

#define SERVER_VERSION             1000

#include "TimeoutSocket.h"
#include "SecureFileSystem.h"
#include "NetworkFileSystem.h"

typedef struct
{
	CSecureFileSystem *pFileSystem;
	BOOL bIsValid;
	UINT nNum;
	UINT nServerVer;
} NFS_FSEntry;

class CNFSServer
{
public:
	CNFSServer(CSecurityFilter *pFilter);
	~CNFSServer();

	bool Start();
	bool Stop(bool wait);

private:
	BOOL AppendComment(LPCTSTR czComment);
	CSecurityFilter * m_pFilter;
	UINT m_nNextID;
	UINT m_nNumInstances;
	bool m_bStayOn;
	NFS_FSEntry *m_pEntries;

	static UINT PASCAL DriveWork(LPVOID *Param);

protected:
	void FillTransferStruct(FileStatusTransferStruct *fsTrans, CFileStatus fileStatus);
	FileCacheEntry * BuildFileCache(LPCTSTR strDir, UINT *pnNumEntries,
		CSecureFileSystem *pFileSystem);
	void HandleSpecial_GetCompInfo(CTimeoutSocket *sock, 
		CSecureFileSystem *pFileSystem);
	void HandleSpecial_BuildCache(CTimeoutSocket *sock, 
		CSecureFileSystem *pFileSystem);
	void HandleSpecial_FillFileInfo(CTimeoutSocket *sock, 
		CSecureFileSystem *pFileSystem);
	void HandleSpecial_GetFileStatus(CTimeoutSocket *sock, 
		CSecureFileSystem *pFileSystem);
	void PruneIdentifiers();
	void ReleaseIdentifier(UINT nID);
	CSecureFileSystem *GetFileSystem(UINT nID);
	int GenerateNewInstanceID(UINT nClientVer, UINT &nServerVer);
	void HandleStringOp_1P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleStringOp_0P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleUintOp_1P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleBoolOp_0P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleBoolOp_1P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleBoolOp_2P(CTimeoutSocket *sock,
		CSecureFileSystem *pFileSystem, int nRequest);
	void HandleRequest(CTimeoutSocket *sock);
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -